battery level
This commit is contained in:
@@ -64,12 +64,22 @@ function Decoder(fPort, bytes, variables) {
|
|||||||
|
|
||||||
Index = bitShift(8) * 1;
|
Index = bitShift(8) * 1;
|
||||||
|
|
||||||
|
Battery_t = bitShift(1);
|
||||||
|
|
||||||
if ((Index % 10) <= 4) {
|
if ((Index % 10) <= 4) {
|
||||||
bitShift(1); // is 9th bit useless?
|
Battery_voltage = (Index % 10) * 0.2 + 3.3;
|
||||||
Battery = (Index % 10) * 0.2 + 3.3;
|
if (Battery_t) {
|
||||||
|
Battery = "> " + Battery_voltage;
|
||||||
|
} else {
|
||||||
|
Battery = "< " + Battery_voltage;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bitShift(1); // is 9th bit useless?
|
Battery_voltage = (Index % 10) * 0.2 + 3.3 - 1;
|
||||||
Battery = (Index % 10) * 0.2 + 3.3 - 1;
|
if (Battery_t) {
|
||||||
|
Battery = "> " + Battery_voltage;
|
||||||
|
} else {
|
||||||
|
Battery = "< " + Battery_voltage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Hz_avg = bitShift(12) * 0.02;
|
Hz_avg = bitShift(12) * 0.02;
|
||||||
@@ -133,4 +143,3 @@ function decodeUplink(input) {
|
|||||||
|
|
||||||
// console.log("Testing decoder with sample data 0x0B80520C1C001F399C852001: ")
|
// console.log("Testing decoder with sample data 0x0B80520C1C001F399C852001: ")
|
||||||
// console.table(Decoder(1,hexToBytes("0B80520C1C001F399C852001"),1))
|
// console.table(Decoder(1,hexToBytes("0B80520C1C001F399C852001"),1))
|
||||||
// console.log("Done!")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user