From 104caa93fa4db6ecc3eaecaf97506d90173471fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 23:27:20 +0200 Subject: [PATCH] Fix warnings --- code/espurna/api.ino | 4 ++-- code/espurna/button.ino | 1 + code/espurna/config/prototypes.h | 2 +- code/espurna/libs/StreamInjector.h | 3 ++- code/espurna/libs/WebSocketIncommingBuffer.h | 2 +- code/espurna/scheduler.ino | 2 +- code/espurna/settings.ino | 2 +- code/espurna/thinkspeak.ino | 6 +++++- 8 files changed, 14 insertions(+), 8 deletions(-) diff --git a/code/espurna/api.ino b/code/espurna/api.ino index ad41988a..58dcf50a 100644 --- a/code/espurna/api.ino +++ b/code/espurna/api.ino @@ -88,11 +88,11 @@ ArRequestHandlerFunction _bindAPI(unsigned int apiID) { } // Get response from callback - char value[API_BUFFER_SIZE]; + char value[API_BUFFER_SIZE] = {0}; (api.getFn)(value, API_BUFFER_SIZE); // The response will be a 404 NOT FOUND if the resource is not available - if (!value) { + if (0 == value[0]) { DEBUG_MSG_P(PSTR("[API] Sending 404 response\n")); request->send(404); return; diff --git a/code/espurna/button.ino b/code/espurna/button.ino index dd0d3b5b..e85fba43 100644 --- a/code/espurna/button.ino +++ b/code/espurna/button.ino @@ -84,6 +84,7 @@ uint8_t mapEvent(uint8_t event, uint8_t count, uint16_t length) { } if (count == 2) return BUTTON_EVENT_DBLCLICK; } + return BUTTON_EVENT_NONE; } void buttonEvent(unsigned int id, unsigned char event) { diff --git a/code/espurna/config/prototypes.h b/code/espurna/config/prototypes.h index a9316d74..2a581218 100644 --- a/code/espurna/config/prototypes.h +++ b/code/espurna/config/prototypes.h @@ -63,7 +63,7 @@ template bool setSetting(const String& key, T value); template bool setSetting(const String& key, unsigned int index, T value); template String getSetting(const String& key, T defaultValue); template String getSetting(const String& key, unsigned int index, T defaultValue); -bool settingsGetJson(JsonObject& data); +void settingsGetJson(JsonObject& data); bool settingsRestoreJson(JsonObject& data); void settingsRegisterCommand(const String& name, void (*call)(Embedis*)); void settingsInject(void *data, size_t len); diff --git a/code/espurna/libs/StreamInjector.h b/code/espurna/libs/StreamInjector.h index c9377c98..03dbd51b 100644 --- a/code/espurna/libs/StreamInjector.h +++ b/code/espurna/libs/StreamInjector.h @@ -46,7 +46,7 @@ class StreamInjector : public Stream { } virtual uint8_t inject(char *data, size_t len) { - for (int i=0; i *_buffer; }; diff --git a/code/espurna/scheduler.ino b/code/espurna/scheduler.ino index adb89579..003a6f69 100644 --- a/code/espurna/scheduler.ino +++ b/code/espurna/scheduler.ino @@ -104,7 +104,7 @@ bool _schIsThisWeekday(time_t t, String weekdays){ char pch; char * p = (char *) weekdays.c_str(); unsigned char position = 0; - while (pch = p[position++]) { + while ((pch = p[position++])) { if ((pch - '0') == w) return true; } return false; diff --git a/code/espurna/settings.ino b/code/espurna/settings.ino index 2e3f7a4b..ce98370a 100644 --- a/code/espurna/settings.ino +++ b/code/espurna/settings.ino @@ -382,7 +382,7 @@ bool settingsRestoreJson(JsonObject& data) { } -bool settingsGetJson(JsonObject& root) { +void settingsGetJson(JsonObject& root) { // Get sorted list of keys std::vector keys = _settingsKeys(); diff --git a/code/espurna/thinkspeak.ino b/code/espurna/thinkspeak.ino index 35ad9a2d..04b0c85c 100644 --- a/code/espurna/thinkspeak.ino +++ b/code/espurna/thinkspeak.ino @@ -192,7 +192,7 @@ void _tspkPost(String data) { #endif // THINGSPEAK_USE_ASYNC -bool _tspkEnqueue(unsigned char index, char * payload) { +void _tspkEnqueue(unsigned char index, char * payload) { DEBUG_MSG_P(PSTR("[THINGSPEAK] Enqueuing field #%d with value %s\n"), index, payload); --index; if (_tspk_queue[index] != NULL) free(_tspk_queue[index]); @@ -230,7 +230,9 @@ bool tspkEnqueueRelay(unsigned char index, unsigned char status) { char payload[3] = {0}; itoa(status ? 1 : 0, payload, 10); _tspkEnqueue(id, payload); + return true; } + return false; } bool tspkEnqueueMeasurement(unsigned char index, char * payload) { @@ -238,7 +240,9 @@ bool tspkEnqueueMeasurement(unsigned char index, char * payload) { unsigned char id = getSetting("tspkMagnitude", index, 0).toInt(); if (id > 0) { _tspkEnqueue(id, payload); + return true; } + return false; } void tspkFlush() {