gmag11 / EnigmaIOT

Secure sensor and gateway platform based on ESP8266 and ESP32
https://gmag11.github.io/EnigmaIOT
MIT License
240 stars 46 forks source link

GatewayAPI.cpp getNodeInfo() compile error #35

Closed GeoffreyMills closed 3 years ago

GeoffreyMills commented 3 years ago

In 0.98 release GatewayAPI.cpp L155 char* GatewayAPI::getNodeInfo ....

L165 The index = snprint parameters keyValidSince & lastMessageTime changed to using %11d (were using %1d pre July commit) and now compile fails on Arduino IDE. latest v0.98: L165: index = snprintf (nodeInfo, len, "{\"version\":\"%d.%d.%d\",\"node_id\":%d,\"address\":\"" MACSTR "\","\ "\"keyValidSince\":%lld,\"lastMessageTime\":%lld,\"sleepy\":%s,"\ "\"Broadcast\":%s,\"TimeSync\":%s,\"rssi\":%d,\"packetsHour\":%f,\"per\":%f",

Before July commit ( this works OK ) L:165 index = snprintf (nodeInfo, len, "{\"version\":\"%d.%d.%d\",\"node_id\":%d,\"address\":\"" MACSTR "\","\ "\"keyValidSince\":%ld,\"lastMessageTime\":%ld,\"sleepy\":%s,"\ "\"Broadcast\":%s,\"TimeSync\":%s,\"rssi\":%d,\"packetsHour\":%f,\"per\":%f",

Regards Geoffrey

gmag11 commented 3 years ago

Hi. In my case compiler generates a warning. I'm aware of that. I've decided not to fix it because time_t type is different in ESP32 and ESP8266. So, if you fix it for ESP32 the warning appears in ESP8266. Of course I could add a directive to separate lines for both platforms but I think it is not worth here. I left the less restrictive %lld.

Are you getting an error instead?

GeoffreyMills commented 3 years ago

Hi. Unfortunately, yes, an error condition and would not compile (Arduino IDE). Most of my nodes are ESP8266, didn't think of testing with an ESP32

gmag11 commented 3 years ago

I've just compiled gateway code using these settings:

image