restart counter added
This commit is contained in:
parent
cc4daa0954
commit
385c5a1b9b
@ -49,7 +49,7 @@ public:
|
||||
void addCount(uint16_t value, uint8_t sniffytpe);
|
||||
void addConfig(configData_t value);
|
||||
void addStatus(uint16_t voltage, uint64_t uptime, float cputemp, uint32_t mem,
|
||||
uint8_t reset1, uint8_t reset2);
|
||||
uint8_t reset0, uint32_t restarts);
|
||||
void addAlarm(int8_t rssi, uint8_t message);
|
||||
void addVoltage(uint16_t value);
|
||||
void addGPS(gpsStatus_t value);
|
||||
|
@ -328,7 +328,7 @@
|
||||
"z": "c26229c6.2d1ae8",
|
||||
"name": "device status",
|
||||
"property": "payload",
|
||||
"pattern": "l16 => voltage,\nl64 => uptime,\nb8 => temperature,\nl32 => ram,\nb8 => reset0,\nb8 => reset1",
|
||||
"pattern": "l16 => voltage,\nl64 => uptime,\nb8 => temperature,\nl32 => ram,\nb8 => reset0,\nl32 => restarts",
|
||||
"x": 650,
|
||||
"y": 200,
|
||||
"wires": [
|
||||
|
@ -38,8 +38,8 @@ function Decoder(bytes, port) {
|
||||
|
||||
if (port === 2) {
|
||||
// device status data
|
||||
if (bytes.length === 17) {
|
||||
return decode(bytes, [uint16, uptime, uint8, uint32, uint8, uint8], ['voltage', 'uptime', 'cputemp', 'memory', 'reset0', 'reset1']);
|
||||
if (bytes.length === 20) {
|
||||
return decode(bytes, [uint16, uptime, uint8, uint32, uint8, uint32], ['voltage', 'uptime', 'cputemp', 'memory', 'reset0', 'restarts']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ function Decoder(bytes, port) {
|
||||
decoded.temp = bytes[i++];
|
||||
decoded.memory = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);
|
||||
decoded.reset0 = bytes[i++];
|
||||
decoded.reset1 = bytes[i++];
|
||||
decoded.restarts = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);
|
||||
}
|
||||
|
||||
if (port === 4) {
|
||||
|
@ -46,8 +46,8 @@ function decodeUplink(input) {
|
||||
|
||||
if (input.fPort === 2) {
|
||||
// device status data
|
||||
if (input.bytes.length === 17) {
|
||||
data = decode(input.bytes, [uint16, uptime, uint8, uint32, uint8, uint8], ['voltage', 'uptime', 'cputemp', 'memory', 'reset0', 'reset1']);
|
||||
if (input.bytes.length === 20) {
|
||||
data = decode(input.bytes, [uint16, uptime, uint8, uint32, uint8, uint32], ['voltage', 'uptime', 'cputemp', 'memory', 'reset0', 'restarts']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ function decodeUplink(input) {
|
||||
data.cputemp = input.bytes[i++];
|
||||
data.memory = ((input.bytes[i++] << 24) | (input.bytes[i++] << 16) | (input.bytes[i++] << 8) | input.bytes[i++]);
|
||||
data.reset0 = input.bytes[i++];
|
||||
data.reset1 = input.bytes[i++];
|
||||
data.restarts = ((input.bytes[i++] << 24) | (input.bytes[i++] << 16) | (input.bytes[i++] << 8) | input.bytes[i++]);
|
||||
}
|
||||
|
||||
if (input.fPort === 4) {
|
||||
|
@ -58,7 +58,7 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
}
|
||||
|
||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
||||
uint32_t mem, uint8_t reset1, uint8_t reset2) {
|
||||
uint32_t mem, uint8_t reset0, uint32_t restarts) {
|
||||
|
||||
buffer[cursor++] = highByte(voltage);
|
||||
buffer[cursor++] = lowByte(voltage);
|
||||
@ -75,8 +75,11 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
||||
buffer[cursor++] = (byte)((mem & 0x00FF0000) >> 16);
|
||||
buffer[cursor++] = (byte)((mem & 0x0000FF00) >> 8);
|
||||
buffer[cursor++] = (byte)((mem & 0x000000FF));
|
||||
buffer[cursor++] = (byte)(reset1);
|
||||
buffer[cursor++] = (byte)(reset2);
|
||||
buffer[cursor++] = (byte)(reset0);
|
||||
buffer[cursor++] = (byte)((restarts & 0xFF000000) >> 24);
|
||||
buffer[cursor++] = (byte)((restarts & 0x00FF0000) >> 16);
|
||||
buffer[cursor++] = (byte)((restarts & 0x0000FF00) >> 8);
|
||||
buffer[cursor++] = (byte)((restarts & 0x000000FF));
|
||||
}
|
||||
|
||||
void PayloadConvert::addGPS(gpsStatus_t value) {
|
||||
@ -185,13 +188,13 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
}
|
||||
|
||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float cputemp,
|
||||
uint32_t mem, uint8_t reset1, uint8_t reset2) {
|
||||
uint32_t mem, uint8_t reset0, uint32_t restarts) {
|
||||
writeUint16(voltage);
|
||||
writeUptime(uptime);
|
||||
writeUint8((byte)cputemp);
|
||||
writeUint32(mem);
|
||||
writeUint8(reset1);
|
||||
writeUint8(reset2);
|
||||
writeUint8(reset0);
|
||||
writeUint32(restarts);
|
||||
}
|
||||
|
||||
void PayloadConvert::addGPS(gpsStatus_t value) {
|
||||
@ -397,7 +400,7 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
}
|
||||
|
||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime, float celsius,
|
||||
uint32_t mem, uint8_t reset1, uint8_t reset2) {
|
||||
uint32_t mem, uint8_t reset0, uint32_t restarts) {
|
||||
uint16_t temp = celsius * 10;
|
||||
uint16_t volt = voltage / 10;
|
||||
#if (defined BAT_MEASURE_ADC || defined HAS_PMU)
|
||||
|
@ -306,7 +306,7 @@ void get_status(uint8_t val[]) {
|
||||
payload.reset();
|
||||
payload.addStatus(read_voltage(), (uint64_t)(uptime() / 1000ULL),
|
||||
temperatureRead(), getFreeRAM(), rtc_get_reset_reason(0),
|
||||
(uint8_t)RTC_restarts);
|
||||
RTC_restarts);
|
||||
SendPayload(STATUSPORT);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user