Remove warning/errors when compiling Zigbee for ESP32

This commit is contained in:
Stephan Hadinger 2020-04-17 17:52:44 +02:00 committed by Javier Arigita
parent fa51f9f4ad
commit 3f9fdc09ce
3 changed files with 10 additions and 12 deletions

View File

@ -25,15 +25,15 @@ void ZigbeeZCLSend_Raw(uint16_t dtsAddr, uint16_t groupaddr, uint16_t clusterId,
// Get an JSON attribute, with case insensitive key search
JsonVariant &getCaseInsensitive(const JsonObject &json, const char *needle) {
const JsonVariant &getCaseInsensitive(const JsonObject &json, const char *needle) {
// key can be in PROGMEM
if ((nullptr == &json) || (nullptr == needle) || (0 == pgm_read_byte(needle))) {
return *(JsonVariant*)nullptr;
}
for (auto kv : json) {
const char *key = kv.key;
JsonVariant &value = kv.value;
for (JsonObject::const_iterator it=json.begin(); it!=json.end(); ++it) {
const char *key = it->key;
const JsonVariant &value = it->value;
if (0 == strcasecmp_P(key, needle)) {
return value;

View File

@ -201,12 +201,10 @@ void ZigbeeHandleHue(uint16_t shortaddr, uint32_t device_id, String &response) {
PSTR("{\"success\":{\"/lights/%d/state/on\":%s}}"),
device_id, on ? "true" : "false");
switch(on)
{
case false : ZigbeeHuePower(shortaddr, 0x00);
break;
case true : ZigbeeHuePower(shortaddr, 0x01);
break;
if (on) {
ZigbeeHuePower(shortaddr, 0x01);
} else {
ZigbeeHuePower(shortaddr, 0x00);
}
response += buf;
resp = true;

View File

@ -109,7 +109,7 @@ public:
uint16_t srcaddr, uint8_t srcendpoint, uint8_t dstendpoint, uint8_t wasbroadcast,
uint8_t linkquality, uint8_t securityuse, uint8_t seqnumber,
uint32_t timestamp):
_cmd_id(cmd_id), _manuf_code(manuf_code), _transact_seq(transact_seq),
_manuf_code(manuf_code), _transact_seq(transact_seq), _cmd_id(cmd_id),
_payload(buf_len ? buf_len : 250), // allocate the data frame from source or preallocate big enough
_cluster_id(clusterid), _groupaddr(groupaddr),
_srcaddr(srcaddr), _srcendpoint(srcendpoint), _dstendpoint(dstendpoint), _wasbroadcast(wasbroadcast),
@ -215,9 +215,9 @@ private:
uint16_t _manuf_code = 0; // optional
uint8_t _transact_seq = 0; // transaction sequence number
uint8_t _cmd_id = 0;
SBuffer _payload;
uint16_t _cluster_id = 0;
uint16_t _groupaddr = 0;
SBuffer _payload;
// information from decoded ZCL frame
uint16_t _srcaddr;
uint8_t _srcendpoint;