gmag11 / EnigmaIOT

Secure sensor and gateway platform based on ESP8266 and ESP32

Home Page:https://gmag11.github.io/EnigmaIOT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GatewayAPI.cpp getNodeInfo() compile error

GeoffreyMills opened this issue · comments

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

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?

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

I've just compiled gateway code using these settings:

image