fix reference and types
This commit is contained in:
parent
5b1948df26
commit
f1e67a80d4
@ -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++) {
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user