use chars for protocol 1 group, with leading 0, to match the way is defined in devices

This commit is contained in:
Nicu Hodos 2024-05-30 12:16:28 +02:00
parent cad27ea106
commit 2411750b35
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ public:
RcDecoder decoder; RcDecoder decoder;
decoder.decode(value); decoder.decode(value);
rcSwitch["state"] = decoder.state; rcSwitch["state"] = decoder.state;
rcSwitch["group"] = String(decoder.group, BIN); rcSwitch["group"] = decoder.group;
rcSwitch["channel"] = decoder.device; rcSwitch["channel"] = decoder.device;
rcSwitch["raw_value"] = value; rcSwitch["raw_value"] = value;
} }

View File

@ -4,7 +4,7 @@
struct RcDecoder { struct RcDecoder {
bool state; bool state;
char group; char group[6];
unsigned char device; unsigned char device;
void decode(unsigned long value) { void decode(unsigned long value) {
@ -16,7 +16,7 @@ struct RcDecoder {
} }
state = RC_STATE(res); state = RC_STATE(res);
group = RC_GROUP(res); sprintf(group, "%05ld", RC_GROUP(res));
switch (RC_DEVICE(res)) { switch (RC_DEVICE(res)) {
case 0b10000: case 0b10000:
device = 1; device = 1;