Fix compilation errors

This commit is contained in:
Stephan Hadinger 2020-09-21 22:21:05 +02:00
parent 2ff756b3cc
commit 31c6f7af3c
3 changed files with 14 additions and 11 deletions

View File

@ -360,6 +360,9 @@ uint32_t JsonParserObject::getUInt(const char * needle, uint32_t val) const {
uint64_t JsonParserObject::getULong(const char * needle, uint64_t val) const {
return (*this)[needle].getULong(val);
}
float JsonParserObject::getFloat(const char * needle, float val) const {
return (*this)[needle].getFloat(val);
}
const char * JsonParserObject::getStr(const char * needle, const char * val) const {
return (*this)[needle].getStr(val);
}

View File

@ -204,15 +204,15 @@ uint32_t IrRemoteCmndIrSendJson(void)
uint16_t repeat = root[UpperCase_P(parm_uc, PSTR(D_JSON_IR_REPEAT))];
#else
RemoveSpace(XdrvMailbox.data); // TODO is this really needed?
JsonParserObject root = JsonParser((chat*) XdrvMailbox.data).getRootObject();
JsonParserObject root = JsonParser((char*) XdrvMailbox.data).getRootObject();
if (!root) { return IE_INVALID_JSON; }
// IRsend { "protocol": "SAMSUNG", "bits": 32, "data": 551502015 }
// IRsend { "protocol": "NEC", "bits": 32, "data":"0x02FDFE80", "repeat": 2 }
const char *protocol = root.getStr(PSTR(D_JSON_IR_PROTOCOL));
uint16_t bits = root.getUInt(PSTR(D_JSON_IR_BITS));
uint64_t data = root.getULong(PSTR(D_JSON_IR_DATA));
uint16_t repeat = root.getUInt(PSTR(D_JSON_IR_REPEAT));
const char *protocol = root.getStr(PSTR(D_JSON_IR_PROTOCOL), "");
uint16_t bits = root.getUInt(PSTR(D_JSON_IR_BITS), 0);
uint64_t data = root.getULong(PSTR(D_JSON_IR_DATA), 0);
uint16_t repeat = root.getUInt(PSTR(D_JSON_IR_REPEAT), 0);
#endif
// check if the IRSend<x> is great than repeat
if (XdrvMailbox.index > repeat + 1) {

View File

@ -311,8 +311,8 @@ uint32_t IrRemoteCmndIrHvacJson(void)
state.clean = false; // Turn off any Cleaning options if we can.
state.clock = -1; // Don't set any current time if we can avoid it.
if (root[PSTR(D_JSON_IRHVAC_VENDOR)]) { state.protocol = strToDecodeType(root.getStr(PSTR(D_JSON_IRHVAC_VENDOR))); }
if (root[PSTR(D_JSON_IRHVAC_PROTOCOL)]) { state.protocol = strToDecodeType(root.getStr(PSTR(D_JSON_IRHVAC_PROTOCOL))); }
if (root[PSTR(D_JSON_IRHVAC_VENDOR)]) { state.protocol = strToDecodeType(root.getStr(PSTR(D_JSON_IRHVAC_VENDOR), "")); }
if (root[PSTR(D_JSON_IRHVAC_PROTOCOL)]) { state.protocol = strToDecodeType(root.getStr(PSTR(D_JSON_IRHVAC_PROTOCOL), "")); }
// UpperCase_P(parm_uc, PSTR(D_JSON_IRHVAC_VENDOR));
// if (json.containsKey(parm_uc)) { state.protocol = strToDecodeType(json[parm_uc]); }
// UpperCase_P(parm_uc, PSTR(D_JSON_IRHVAC_PROTOCOL));
@ -331,10 +331,10 @@ uint32_t IrRemoteCmndIrHvacJson(void)
}
}
if (root[PSTR(D_JSON_IRHVAC_MODEL)]) { state.model = IRac::strToModel(PSTR(D_JSON_IRHVAC_MODEL)]); }
if (root[PSTR(D_JSON_IRHVAC_MODE)]) { state.mode = IRac::strToOpmode(PSTR(D_JSON_IRHVAC_MODE)]); }
if (root[PSTR(D_JSON_IRHVAC_SWINGV)]) { state.swingv = IRac::strToSwingV(PSTR(D_JSON_IRHVAC_SWINGV)]); }
if (root[PSTR(D_JSON_IRHVAC_SWINGH)]) { state.swingh = IRac::strToSwingV(PSTR(D_JSON_IRHVAC_SWINGH)]); }
if (root[PSTR(D_JSON_IRHVAC_MODEL)]) { state.model = IRac::strToModel(PSTR(D_JSON_IRHVAC_MODEL)); }
if (root[PSTR(D_JSON_IRHVAC_MODE)]) { state.mode = IRac::strToOpmode(PSTR(D_JSON_IRHVAC_MODE)); }
if (root[PSTR(D_JSON_IRHVAC_SWINGV)]) { state.swingv = IRac::strToSwingV(PSTR(D_JSON_IRHVAC_SWINGV)); }
if (root[PSTR(D_JSON_IRHVAC_SWINGH)]) { state.swingh = IRac::strToSwingH(PSTR(D_JSON_IRHVAC_SWINGH)); }
state.degrees = root.getFloat(PSTR(D_JSON_IRHVAC_TEMP), state.degrees);
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("model %d, mode %d, fanspeed %d, swingv %d, swingh %d"),
// state.model, state.mode, state.fanspeed, state.swingv, state.swingh);