From 046d4f3ec61850cfd2a10da2824f93cc367d35d7 Mon Sep 17 00:00:00 2001 From: fvanroie Date: Sun, 29 Nov 2020 23:10:27 +0100 Subject: [PATCH] Fix dependencies and typos --- include/hasp_conf.h | 3 ++- include/lv_conf.h | 4 ++++ src/hasp.cpp | 4 ++-- src/hasp.h | 1 - src/hasp_dispatch.cpp | 14 +++++++++++++- src/hasp_ethernet_esp32.cpp | 2 +- src/hasp_ethernet_stm32.cpp | 2 ++ src/hasp_mqtt.cpp | 2 +- src/hasp_network.cpp | 1 + 9 files changed, 26 insertions(+), 7 deletions(-) diff --git a/include/hasp_conf.h b/include/hasp_conf.h index 9a9d4b46..79dcd4b1 100644 --- a/include/hasp_conf.h +++ b/include/hasp_conf.h @@ -107,10 +107,11 @@ #if HASP_USE_LITTLEFS > 0 #if defined(ARDUINO_ARCH_ESP32) #include "LITTLEFS.h" -#endif +#elif defined(ARDUINO_ARCH_ESP8266) #include // Include the FS library #include "hasp_filesystem.h" #endif +#endif #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) diff --git a/include/lv_conf.h b/include/lv_conf.h index 119c14ac..60b6d86a 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -185,7 +185,11 @@ typedef void* lv_fs_drv_user_data_t; #if LV_USE_FS_IF # define LV_FS_IF_FATFS '\0' # define LV_FS_IF_PC '\0' +#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) # define LV_FS_IF_SPIFFS 'E' // internal esp Flash +#else +# define LV_FS_IF_SPIFFS '\0' // no internal esp Flash +#endif #endif /*LV_USE_FS_IF*/ #endif diff --git a/src/hasp.cpp b/src/hasp.cpp index 43cbcb24..7c5d53b2 100644 --- a/src/hasp.cpp +++ b/src/hasp.cpp @@ -580,8 +580,8 @@ void haspLoadPage(const char * pages) #if HASP_USE_EEPROM > 0 Log.notice(TAG_HASP, F("Loading jsonl from EEPROM...")); EepromStream eepromStream(4096, 1024); - dispatchJsonl(eepromStream); - Log.tr(TAG_HASP, F("Loaded jsonl from EEPROM")); + dispatch_parse_jsonl(eepromStream); + Log.trace(TAG_HASP, F("Loaded jsonl from EEPROM")); #endif #endif diff --git a/src/hasp.h b/src/hasp.h index 1d76c917..dec550f7 100644 --- a/src/hasp.h +++ b/src/hasp.h @@ -59,7 +59,6 @@ void haspSetPage(uint8_t id); uint8_t haspGetPage(); void haspClearPage(uint16_t pageid); -String haspGetNodename(); void haspGetVersion(char* version,size_t len); void haspBackground(uint16_t pageid, uint16_t imageid); diff --git a/src/hasp_dispatch.cpp b/src/hasp_dispatch.cpp index 0dc6efc4..f25063e6 100644 --- a/src/hasp_dispatch.cpp +++ b/src/hasp_dispatch.cpp @@ -14,6 +14,8 @@ #include "hasp_object.h" #include "hasp_gui.h" #include "hasp_oobe.h" +#include "hasp_mqtt.h" +#include "hasp_gpio.h" #include "hasp_hal.h" #include "hasp.h" @@ -30,6 +32,8 @@ bool is_true(const char * s) void dispatch_screenshot(const char *, const char * filename) { +#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 + if(strlen(filename) == 0) { // no filename given char tempfile[32]; memcpy_P(tempfile, PSTR("/screenshot.bmp"), sizeof(tempfile)); @@ -39,12 +43,17 @@ void dispatch_screenshot(const char *, const char * filename) } else { // Valid filename guiTakeScreenshot(filename); } + +#else + Log.warning(TAG_MSGR, "Failed to save %s, no storage", filename); +#endif } // Format filesystem and erase EEPROM bool dispatch_factory_reset() { - bool formated, erased = true; + bool formated = true; + bool erased = true; #if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0 formated = HASP_FS.format(); @@ -149,9 +158,12 @@ void dispatch_command(const char * topic, const char * payload) // char item[5]; // memset(item, 0, sizeof(item)); // strncpy(item, topic + 4, 4); + +#if HASP_USE_MQTT > 0 DynamicJsonDocument settings(45); settings[topic + 4] = payload; mqttSetConfig(settings.as()); +#endif } else { if(strlen(payload) == 0) { diff --git a/src/hasp_ethernet_esp32.cpp b/src/hasp_ethernet_esp32.cpp index 403faede..0811f16d 100644 --- a/src/hasp_ethernet_esp32.cpp +++ b/src/hasp_ethernet_esp32.cpp @@ -10,7 +10,7 @@ #include "hasp_debug.h" #include "hasp_network.h" -#if HASP_USE_ETHERNET > 0 +#if HASP_USE_ETHERNET > 0 && defined(ARDUINO_ARCH_ESP32) IPAddress ip; diff --git a/src/hasp_ethernet_stm32.cpp b/src/hasp_ethernet_stm32.cpp index 407e7a1b..8386a4f0 100644 --- a/src/hasp_ethernet_stm32.cpp +++ b/src/hasp_ethernet_stm32.cpp @@ -4,6 +4,8 @@ #include #include "ArduinoJson.h" #include "ArduinoLog.h" + +#include "hasp_debug.h" #include "hasp_conf.h" #include "hasp_hal.h" diff --git a/src/hasp_mqtt.cpp b/src/hasp_mqtt.cpp index b3940660..cc5dedb2 100644 --- a/src/hasp_mqtt.cpp +++ b/src/hasp_mqtt.cpp @@ -303,7 +303,7 @@ static void mqtt_message_cb(char * topic, byte * payload, unsigned int length) snprintf_P(tmp_topic, sizeof(tmp_topic), PSTR("%sstatus"), mqttNodeTopic); snprintf_P(msg, sizeof(msg), PSTR("ON")); - bool res = mqttClient.publish(tmp_topic, msg, true); + /*bool res =*/ mqttClient.publish(tmp_topic, msg, true); } } else { diff --git a/src/hasp_network.cpp b/src/hasp_network.cpp index 6da6f588..e120e07d 100644 --- a/src/hasp_network.cpp +++ b/src/hasp_network.cpp @@ -7,6 +7,7 @@ #include "hasp_conf.h" #include "hasp_hal.h" #include "hasp_debug.h" +#include "hasp_mdns.h" #include "hasp.h" #if HASP_USE_ETHERNET > 0 || HASP_USE_WIFI > 0