Merge branch 'V12' of http://gitea.yunhorn.com/sundp/M7 into V12
This commit is contained in:
commit
643297929d
|
@ -0,0 +1,31 @@
|
||||||
|
function Decode(fPort, data, variables) {
|
||||||
|
if (fPort === 20) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
led_state: bytes[0]===0?"Off":"On",
|
||||||
|
mtm_code_1:bytes[1],
|
||||||
|
mtm_code_2:bytes[2],
|
||||||
|
hw_code:bytes[3],
|
||||||
|
battery_level:bytes[4]+"%",
|
||||||
|
size_value:bytes[5],
|
||||||
|
duration: bytes[6]+"Sec",
|
||||||
|
x_freq: (bytes[7] << 8 | bytes[8])+" Hz",
|
||||||
|
y_freq: (bytes[9] << 8 | bytes[10])+" Hz",
|
||||||
|
z_freq: (bytes[11] << 8 | bytes[12])+" Hz",
|
||||||
|
x_amp: (bytes[13] << 8 | bytes[14])+" Mag",
|
||||||
|
y_amp: (bytes[15] << 8 | bytes[16])+" Mag",
|
||||||
|
z_amp: (bytes[17] << 8 | bytes[18])+" Mag"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (fPort === 21) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
led_state: bytes[0]===0?"Off":"On",
|
||||||
|
battery_level: bytes[1]+"%",
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue