Añadir lsn50-v2-xkc-y25-v-drainage/docs/decoder-pa12.md

This commit is contained in:
victor.fraile 2026-03-25 15:49:04 +00:00
parent 13d6b39049
commit 70f76ba107

View File

@ -0,0 +1,32 @@
# Decoder PA12
## Decisión final
El decoder correcto para leer `PA12` en este kit es:
- byte objetivo: `byte6`
- bit objetivo: `bit1`
- máscara: `0x02`
Expresión correcta:
```js
const byte6 = (b.length > 6) ? b[6] : 0x00;
const pa12 = (byte6 & 0x02) ? 1 : 0;
function decodeUplink(input) {
const b = input.bytes;
const byte6 = (b.length > 6) ? b[6] : 0;
const pa12 = (byte6 & 0x02) ? 1 : 0;
return {
data: {
pa12,
drenaje: pa12,
drenaje_inv: pa12 ? 0 : 1,
byte6,
raw_hex: b.map(x => x.toString(16).padStart(2, '0')).join('')
}
};
}