cpu temp reduced to 8bit
This commit is contained in:
parent
e0de50acd8
commit
8873a7ce70
@ -18,7 +18,7 @@ function Decoder(bytes, port) {
|
||||
|
||||
if (port === 2) {
|
||||
// device status data
|
||||
return decode(bytes, [uint16, uptime, temperature, uint32], ['voltage', 'uptime', 'cputemp', 'memory']);
|
||||
return decode(bytes, [uint16, uptime, uint8, uint32], ['voltage', 'uptime', 'cputemp', 'memory']);
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ function Decoder(bytes, port) {
|
||||
if (bytes.length > 4) {
|
||||
decoded.latitude = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);
|
||||
decoded.longitude = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);
|
||||
decoded.sats = (bytes[i++]);
|
||||
decoded.sats = bytes[i++];
|
||||
decoded.hdop = (bytes[i++] << 8) | (bytes[i++]);
|
||||
decoded.altitude = (bytes[i++] << 8) | (bytes[i++]);
|
||||
}
|
||||
@ -24,18 +24,18 @@ function Decoder(bytes, port) {
|
||||
decoded.battery = ((bytes[i++] << 8) | bytes[i++]);
|
||||
decoded.uptime = ((bytes[i++] << 56) | (bytes[i++] << 48) | (bytes[i++] << 40) | (bytes[i++] << 32) |
|
||||
(bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);
|
||||
decoded.temp = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]);
|
||||
decoded.temp = bytes[i++];
|
||||
}
|
||||
|
||||
if (port === 5) {
|
||||
var i = 0;
|
||||
decoded.button = (bytes[i++]);
|
||||
decoded.button = bytes[i++];
|
||||
}
|
||||
|
||||
if (port === 6) {
|
||||
var i = 0;
|
||||
decoded.rssi = (bytes[i++]);
|
||||
decoded.beacon = (bytes[i++]);
|
||||
decoded.rssi = bytes[i++];
|
||||
decoded.beacon = bytes[i++];
|
||||
}
|
||||
|
||||
return decoded;
|
||||
|
@ -54,7 +54,6 @@ void PayloadConvert::addConfig(configData_t value) {
|
||||
|
||||
void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime,
|
||||
float cputemp, uint32_t mem) {
|
||||
uint32_t temp = (uint32_t)cputemp;
|
||||
buffer[cursor++] = highByte(voltage);
|
||||
buffer[cursor++] = lowByte(voltage);
|
||||
buffer[cursor++] = (byte)((uptime & 0xFF00000000000000) >> 56);
|
||||
@ -65,10 +64,7 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime,
|
||||
buffer[cursor++] = (byte)((uptime & 0x0000000000FF0000) >> 16);
|
||||
buffer[cursor++] = (byte)((uptime & 0x000000000000FF00) >> 8);
|
||||
buffer[cursor++] = (byte)((uptime & 0x00000000000000FF));
|
||||
buffer[cursor++] = (byte)((temp & 0xFF000000) >> 24);
|
||||
buffer[cursor++] = (byte)((temp & 0x00FF0000) >> 16);
|
||||
buffer[cursor++] = (byte)((temp & 0x0000FF00) >> 8);
|
||||
buffer[cursor++] = (byte)((temp & 0x000000FF));
|
||||
buffer[cursor++] = (byte)(cputemp);
|
||||
buffer[cursor++] = (byte)((mem & 0xFF000000) >> 24);
|
||||
buffer[cursor++] = (byte)((mem & 0x00FF0000) >> 16);
|
||||
buffer[cursor++] = (byte)((mem & 0x0000FF00) >> 8);
|
||||
@ -131,7 +127,7 @@ void PayloadConvert::addStatus(uint16_t voltage, uint64_t uptime,
|
||||
float cputemp, uint32_t mem) {
|
||||
writeUint16(voltage);
|
||||
writeUptime(uptime);
|
||||
writeTemperature(cputemp);
|
||||
writeUint8((byte)cputemp);
|
||||
writeUint32(mem);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user