fix reference and types

This commit is contained in:
Nicu Hodos 2022-10-25 18:05:37 +02:00
parent 5b1948df26
commit f1e67a80d4
2 changed files with 3 additions and 3 deletions

View File

@ -7,10 +7,10 @@ namespace RcDecoder {
struct RcSwitch { struct RcSwitch {
bool state; bool state;
char group; char group;
char device; byte device;
}; };
void decode(unsigned long value, RcSwitch decoded) { void decode(unsigned long value, RcSwitch& decoded) {
value = value >> 2; value = value >> 2;
unsigned long res = 0; unsigned long res = 0;
for (int i = 0; i < 12; i++) { for (int i = 0; i < 12; i++) {

View File

@ -99,7 +99,7 @@ void readRcSwitch(JsonDocument& jsonDoc) {
RcDecoder::RcSwitch decoded; RcDecoder::RcSwitch decoded;
RcDecoder::decode(value, decoded); RcDecoder::decode(value, decoded);
rcSwitch["state"] = decoded.state; rcSwitch["state"] = decoded.state;
rcSwitch["group"] = decoded.group; rcSwitch["group"] = String(decoded.group, BIN);
rcSwitch["channel"] = decoded.device; rcSwitch["channel"] = decoded.device;
} else { } else {
rcSwitch["value"] = value; rcSwitch["value"] = value;