Browse Source

Fix warnings

rfm69
Xose Pérez 6 years ago
parent
commit
104caa93fa
8 changed files with 14 additions and 8 deletions
  1. +2
    -2
      code/espurna/api.ino
  2. +1
    -0
      code/espurna/button.ino
  3. +1
    -1
      code/espurna/config/prototypes.h
  4. +2
    -1
      code/espurna/libs/StreamInjector.h
  5. +1
    -1
      code/espurna/libs/WebSocketIncommingBuffer.h
  6. +1
    -1
      code/espurna/scheduler.ino
  7. +1
    -1
      code/espurna/settings.ino
  8. +5
    -1
      code/espurna/thinkspeak.ino

+ 2
- 2
code/espurna/api.ino View File

@ -88,11 +88,11 @@ ArRequestHandlerFunction _bindAPI(unsigned int apiID) {
} }
// Get response from callback // Get response from callback
char value[API_BUFFER_SIZE];
char value[API_BUFFER_SIZE] = {0};
(api.getFn)(value, API_BUFFER_SIZE); (api.getFn)(value, API_BUFFER_SIZE);
// The response will be a 404 NOT FOUND if the resource is not available // 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")); DEBUG_MSG_P(PSTR("[API] Sending 404 response\n"));
request->send(404); request->send(404);
return; return;


+ 1
- 0
code/espurna/button.ino View File

@ -84,6 +84,7 @@ uint8_t mapEvent(uint8_t event, uint8_t count, uint16_t length) {
} }
if (count == 2) return BUTTON_EVENT_DBLCLICK; if (count == 2) return BUTTON_EVENT_DBLCLICK;
} }
return BUTTON_EVENT_NONE;
} }
void buttonEvent(unsigned int id, unsigned char event) { void buttonEvent(unsigned int id, unsigned char event) {


+ 1
- 1
code/espurna/config/prototypes.h View File

@ -63,7 +63,7 @@ template<typename T> bool setSetting(const String& key, T value);
template<typename T> bool setSetting(const String& key, unsigned int index, T value); template<typename T> bool setSetting(const String& key, unsigned int index, T value);
template<typename T> String getSetting(const String& key, T defaultValue); template<typename T> String getSetting(const String& key, T defaultValue);
template<typename T> String getSetting(const String& key, unsigned int index, T defaultValue); template<typename T> String getSetting(const String& key, unsigned int index, T defaultValue);
bool settingsGetJson(JsonObject& data);
void settingsGetJson(JsonObject& data);
bool settingsRestoreJson(JsonObject& data); bool settingsRestoreJson(JsonObject& data);
void settingsRegisterCommand(const String& name, void (*call)(Embedis*)); void settingsRegisterCommand(const String& name, void (*call)(Embedis*));
void settingsInject(void *data, size_t len); void settingsInject(void *data, size_t len);


+ 2
- 1
code/espurna/libs/StreamInjector.h View File

@ -46,7 +46,7 @@ class StreamInjector : public Stream {
} }
virtual uint8_t inject(char *data, size_t len) { virtual uint8_t inject(char *data, size_t len) {
for (int i=0; i<len; i++) {
for (uint8_t i=0; i<len; i++) {
inject(data[i]); inject(data[i]);
} }
return len; return len;
@ -60,6 +60,7 @@ class StreamInjector : public Stream {
virtual size_t write(uint8_t ch) { virtual size_t write(uint8_t ch) {
if (_callback) _callback(ch); if (_callback) _callback(ch);
return 1;
} }
virtual int read() { virtual int read() {


+ 1
- 1
code/espurna/libs/WebSocketIncommingBuffer.h View File

@ -80,8 +80,8 @@ class WebSocketIncommingBuffer {
private: private:
AwsMessageHandler _cb; AwsMessageHandler _cb;
bool _cb_on_fragments;
bool _terminate_string; bool _terminate_string;
bool _cb_on_fragments;
std::vector<uint8_t> *_buffer; std::vector<uint8_t> *_buffer;
}; };

+ 1
- 1
code/espurna/scheduler.ino View File

@ -104,7 +104,7 @@ bool _schIsThisWeekday(time_t t, String weekdays){
char pch; char pch;
char * p = (char *) weekdays.c_str(); char * p = (char *) weekdays.c_str();
unsigned char position = 0; unsigned char position = 0;
while (pch = p[position++]) {
while ((pch = p[position++])) {
if ((pch - '0') == w) return true; if ((pch - '0') == w) return true;
} }
return false; return false;


+ 1
- 1
code/espurna/settings.ino View File

@ -382,7 +382,7 @@ bool settingsRestoreJson(JsonObject& data) {
} }
bool settingsGetJson(JsonObject& root) {
void settingsGetJson(JsonObject& root) {
// Get sorted list of keys // Get sorted list of keys
std::vector<String> keys = _settingsKeys(); std::vector<String> keys = _settingsKeys();


+ 5
- 1
code/espurna/thinkspeak.ino View File

@ -192,7 +192,7 @@ void _tspkPost(String data) {
#endif // THINGSPEAK_USE_ASYNC #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); DEBUG_MSG_P(PSTR("[THINGSPEAK] Enqueuing field #%d with value %s\n"), index, payload);
--index; --index;
if (_tspk_queue[index] != NULL) free(_tspk_queue[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}; char payload[3] = {0};
itoa(status ? 1 : 0, payload, 10); itoa(status ? 1 : 0, payload, 10);
_tspkEnqueue(id, payload); _tspkEnqueue(id, payload);
return true;
} }
return false;
} }
bool tspkEnqueueMeasurement(unsigned char index, char * payload) { 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(); unsigned char id = getSetting("tspkMagnitude", index, 0).toInt();
if (id > 0) { if (id > 0) {
_tspkEnqueue(id, payload); _tspkEnqueue(id, payload);
return true;
} }
return false;
} }
void tspkFlush() { void tspkFlush() {


Loading…
Cancel
Save