From 3858d68a5b702694f42a784b6fd00ae3f4576b5f Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Tue, 16 Feb 2021 01:49:46 +0100 Subject: [PATCH 01/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d542cfdb..49b9dc7c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # HASP - Open Hardware edition [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/fvanroie/hasp-lvgl/PlatformIO%20CI?label=build%20status&logo=github&logoColor=%23dddddd)](https://github.com/fvanroie/hasp-lvgl/actions?query=workflow%3A%22PlatformIO+CI%22) -[![GitHub release](https://img.shields.io/github/release/fvanroie/hasp-lvgl.svg)](https://github.com/fvanroie/hasp-lvgl/releases) +[![GitHub release](https://img.shields.io/github/v/release/fvanroie/hasp-lvgl?include_prereleases)](https://github.com/fvanroie/hasp-lvgl/releases) [![GitHub issues](https://img.shields.io/github/issues/fvanroie/hasp-lvgl.svg)](http://github.com/fvanroie/hasp-lvgl/issues) [![Discord](https://img.shields.io/discord/538814618106331137?color=%237289DA&label=support&logo=discord&logoColor=white)][6] [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing) From 6008e94142fb25b3960619c2ec809610ab45a994 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 21 Feb 2021 02:26:49 +0100 Subject: [PATCH 02/29] Create FUNDING.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..3bea9806 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [bblanchon] # Replace with up to 4 GitHub Sponsors-enabled usernames +patreon: # Replace with a single Patreon username +open_collective: opencollective.com/lvgl # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: ['https://www.buymeacoffee.com/gW5rPpsKR'] # Up to 4 links From cc59d93e80599f7b361a5cc1191c911ac6778245 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 21 Feb 2021 02:30:14 +0100 Subject: [PATCH 03/29] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 3bea9806..de985e89 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,7 +2,7 @@ github: [bblanchon] # Replace with up to 4 GitHub Sponsors-enabled usernames patreon: # Replace with a single Patreon username -open_collective: opencollective.com/lvgl # Replace with a single Open Collective username +open_collective: lvgl # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry From 1afc9f281cb50dcf0ece8108bd6d9911e9c7ed68 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 21 Feb 2021 02:31:29 +0100 Subject: [PATCH 04/29] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index de985e89..a2a37f79 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username -custom: ['https://www.buymeacoffee.com/gW5rPpsKR'] # Up to 4 links +custom: ['https://www.buymeacoffee.com/gW5rPpsKR','https://arduinojson.org/book/'] # Up to 4 links From ed76abc24535667da2e5cb2cac337d229b5b612b Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 21 Feb 2021 02:38:35 +0100 Subject: [PATCH 05/29] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index a2a37f79..222103bf 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: [bblanchon] # Replace with up to 4 GitHub Sponsors-enabled usernames +github: [fvanroie,bblanchon] # Replace with up to 4 GitHub Sponsors-enabled usernames patreon: # Replace with a single Patreon username open_collective: lvgl # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username From ba34f1dd25a1d32818b7ed101ae2c19c558ce157 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 21 Feb 2021 02:38:57 +0100 Subject: [PATCH 06/29] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 222103bf..a2a37f79 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,6 +1,6 @@ # These are supported funding model platforms -github: [fvanroie,bblanchon] # Replace with up to 4 GitHub Sponsors-enabled usernames +github: [bblanchon] # Replace with up to 4 GitHub Sponsors-enabled usernames patreon: # Replace with a single Patreon username open_collective: lvgl # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username From 06949a9c081207170c1a5a7442d878cef712d87b Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 21 Feb 2021 11:50:06 +0100 Subject: [PATCH 07/29] Update LICENSE --- LICENSE | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 71b929c8..db138af1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,7 @@ MIT License Copyright (c) 2020 Francis Van Roie - -Based upon HASwitchPlate - Copyright (c) 2019 Allen Derusha allen@derusha.org +Copyright (c) 2019 Allen Derusha allen@derusha.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 4aeea47deeb07b7a4818e0ed03e89d67f2b0b0b9 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 21 Feb 2021 11:51:09 +0100 Subject: [PATCH 08/29] Update LICENSE --- LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index db138af1..dfe689c9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ MIT License -Copyright (c) 2020 Francis Van Roie -Copyright (c) 2019 Allen Derusha allen@derusha.org +Copyright (c) 2019-2021 Francis Van Roie +Copyright (c) 2018-2019 Allen Derusha allen@derusha.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From f874ff924845de0be631fa03a5b7901f60488294 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Mon, 22 Feb 2021 23:33:31 +0100 Subject: [PATCH 09/29] Bump version --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 7b671f8f..c76e2040 100644 --- a/platformio.ini +++ b/platformio.ini @@ -61,7 +61,7 @@ build_flags = ; -- Hasp build options ---------------------------- -D HASP_VER_MAJ=0 -D HASP_VER_MIN=3 - -D HASP_VER_REV=3 + -D HASP_VER_REV=4 -D HASP_LOG_LEVEL=9 -D HASP_USE_CONFIG=1 ; Native application, not library ${override.build_flags} From 952034af06a8ec9119064c2ca071c4dc408ebd47 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Mon, 22 Feb 2021 23:34:23 +0100 Subject: [PATCH 10/29] Add .on("/config") to AP mode --- src/svc/hasp_http.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/svc/hasp_http.cpp b/src/svc/hasp_http.cpp index 1fea82a0..dff3244f 100644 --- a/src/svc/hasp_http.cpp +++ b/src/svc/hasp_http.cpp @@ -118,7 +118,6 @@ extern char mqttNodeName[16]; char mqttNodeName[3] = "na"; #endif - //////////////////////////////////////////////////////////////////////////////////////////////////// String getOption(int value, String label, bool selected) { @@ -187,7 +186,7 @@ bool httpIsAuthenticated(const __FlashStringHelper * fstr_page) #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) LOG_TRACE(TAG_HTTP, F("Sending %S page to client connected from: %s"), fstr_page, - webServer.client().remoteIP().toString().c_str()); + webServer.client().remoteIP().toString().c_str()); #else // LOG_INFO(TAG_HTTP,F("Sending %s page to client connected from: %s"), page, // String(webServer.client().remoteIP()).c_str()); @@ -1129,7 +1128,8 @@ void webHandleMqttConfig() F("'>

"); add_form_button(httpMessage, F("↩ " D_HTTP_CONFIGURATION), F("/config"), F("")); - // httpMessage += PSTR("

"); webSendPage(httpGetNodename(), httpMessage.length(), false); @@ -1753,7 +1753,7 @@ void httpHandleNotFound() #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) LOG_TRACE(TAG_HTTP, F("Sending 404 to client connected from: %s"), - webServer.client().remoteIP().toString().c_str()); + webServer.client().remoteIP().toString().c_str()); #else // LOG_TRACE(TAG_HTTP,F("Sending 404 to client connected from: %s"), String(webServer.client().remoteIP()).c_str()); #endif @@ -1901,7 +1901,7 @@ void httpStart() LOG_INFO(TAG_HTTP, F(D_SERVICE_STARTED " @ http://%d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]); #else LOG_INFO(TAG_HTTP, F(D_SERVICE_STARTED " @ http://%s"), - (WiFi.getMode() != WIFI_STA ? WiFi.softAPIP().toString().c_str() : WiFi.localIP().toString().c_str())); + (WiFi.getMode() != WIFI_STA ? WiFi.softAPIP().toString().c_str() : WiFi.localIP().toString().c_str())); #endif #else IPAddress ip; @@ -1942,6 +1942,7 @@ void httpSetup() if(WiFi.getMode() != WIFI_STA) { LOG_TRACE(TAG_HTTP, F("Wifi access point")); webServer.on(F("/"), webHandleWifiConfig); + webServer.on(F("/config"), webHandleWifiConfig); return; } From 98def24a74f954e67e669cb56ca848050db739b9 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Mon, 22 Feb 2021 23:35:10 +0100 Subject: [PATCH 11/29] Start network services in AP mode --- src/net/hasp_wifi.cpp | 131 +++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 65 deletions(-) diff --git a/src/net/hasp_wifi.cpp b/src/net/hasp_wifi.cpp index b2b95d68..94d86806 100644 --- a/src/net/hasp_wifi.cpp +++ b/src/net/hasp_wifi.cpp @@ -9,45 +9,45 @@ #if HASP_USE_WIFI > 0 -#include "hasp_debug.h" -#include "hasp_config.h" -#include "hasp_network.h" -#include "hasp_gui.h" + #include "hasp_debug.h" + #include "hasp_config.h" + #include "hasp_network.h" + #include "hasp_gui.h" -#include "hasp/hasp_dispatch.h" -#include "hasp/hasp.h" + #include "hasp/hasp_dispatch.h" + #include "hasp/hasp.h" -#if defined(ARDUINO_ARCH_ESP32) -#include -#elif defined(ARDUINO_ARCH_ESP8266) -#include -#include "user_interface.h" // Wifi Reasons + #if defined(ARDUINO_ARCH_ESP32) + #include + #elif defined(ARDUINO_ARCH_ESP8266) + #include + #include "user_interface.h" // Wifi Reasons static WiFiEventHandler gotIpEventHandler, disconnectedEventHandler; -#elif defined(STM32F4xx) + #elif defined(STM32F4xx) // #include // #include "WiFiSpi.h" // extern WiFiSpiClass WiFi; SPIClass espSPI(ESPSPI_MOSI, ESPSPI_MISO, ESPSPI_SCLK); // SPI port where esp is connected -#endif + #endif //#include "DNSserver.h" -#ifdef USE_CONFIG_OVERRIDE -#include "user_config_override.h" -#endif + #ifdef USE_CONFIG_OVERRIDE + #include "user_config_override.h" + #endif -#ifdef WIFI_SSID + #ifdef WIFI_SSID char wifiSsid[32] = WIFI_SSID; -#else + #else char wifiSsid[32] = ""; -#endif -#ifdef WIFI_PASSW + #endif + #ifdef WIFI_PASSW char wifiPassword[32] = WIFI_PASSW; -#else + #else char wifiPassword[32] = ""; -#endif + #endif uint8_t wifiReconnectCounter = 0; // const byte DNS_PORT = 53; @@ -57,15 +57,16 @@ uint8_t wifiReconnectCounter = 0; static void wifiConnected(IPAddress ipaddress) { -#if defined(STM32F4xx) + #if defined(STM32F4xx) IPAddress ip; ip = WiFi.localIP(); LOG_TRACE(TAG_WIFI, F("Received IP address %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]); -#else + #else LOG_TRACE(TAG_WIFI, F(D_NETWORK_IP_ADDRESS_RECEIVED), ipaddress.toString().c_str()); -#endif + #endif - LOG_VERBOSE(TAG_WIFI, F("Connected = %s"), WiFi.status() == WL_CONNECTED ? PSTR(D_NETWORK_ONLINE) : PSTR(D_NETWORK_OFFLINE)); + LOG_VERBOSE(TAG_WIFI, F("Connected = %s"), + WiFi.status() == WL_CONNECTED ? PSTR(D_NETWORK_ONLINE) : PSTR(D_NETWORK_OFFLINE)); networkStart(); } @@ -84,7 +85,7 @@ static void wifiDisconnected(const char * ssid, uint8_t reason) char buffer[64]; switch(reason) { -#if defined(ARDUINO_ARCH_ESP8266) + #if defined(ARDUINO_ARCH_ESP8266) case REASON_UNSPECIFIED: snprintf_P(buffer, sizeof(buffer), PSTR("unspecified")); break; @@ -170,9 +171,9 @@ static void wifiDisconnected(const char * ssid, uint8_t reason) case REASON_HANDSHAKE_TIMEOUT: snprintf_P(buffer, sizeof(buffer), PSTR("handshake timeout")); break; -#endif + #endif -#if defined(ARDUINO_ARCH_ESP32) + #if defined(ARDUINO_ARCH_ESP32) case WIFI_REASON_UNSPECIFIED: snprintf_P(buffer, sizeof(buffer), PSTR("unspecified")); break; @@ -261,7 +262,7 @@ static void wifiDisconnected(const char * ssid, uint8_t reason) case WIFI_REASON_CONNECTION_FAIL: snprintf_P(buffer, sizeof(buffer), PSTR(D_NETWORK_CONNECTION_FAILED)); break; -#endif + #endif default: snprintf_P(buffer, sizeof(buffer), PSTR("unknown")); @@ -276,7 +277,7 @@ static void wifiSsidConnected(const char * ssid) wifiReconnectCounter = 0; } -#if defined(ARDUINO_ARCH_ESP32) + #if defined(ARDUINO_ARCH_ESP32) static void wifi_callback(system_event_id_t event, system_event_info_t info) { switch(event) { @@ -294,9 +295,9 @@ static void wifi_callback(system_event_id_t event, system_event_info_t info) break; } } -#endif + #endif -#if defined(ARDUINO_ARCH_ESP8266) + #if defined(ARDUINO_ARCH_ESP8266) static void wifiSTAConnected(WiFiEventStationModeConnected info) { wifiSsidConnected(info.ssid.c_str()); @@ -313,7 +314,7 @@ static void wifiSTADisconnected(WiFiEventStationModeDisconnected info) { wifiDisconnected(info.ssid.c_str(), info.reason); } -#endif + #endif /* ================================================================================================ */ @@ -333,9 +334,9 @@ bool wifiShowAP(char * ssid, char * pass) WiFi.macAddress(mac); sprintf_P(ssid, PSTR("HASP-%02x%02x%02x"), mac[3], mac[4], mac[5]); sprintf_P(pass, PSTR("haspadmin")); -#if defined(STM32F4xx) + #if defined(STM32F4xx) LOG_WARNING(TAG_WIFI, F("We should setup Temporary Access Point %s password: %s"), ssid, pass); -#else + #else WiFi.softAP(ssid, pass); /* Setup the DNS server redirecting all the domains to the apIP */ @@ -344,20 +345,20 @@ bool wifiShowAP(char * ssid, char * pass) LOG_WARNING(TAG_WIFI, F("Temporary Access Point %s password: %s"), ssid, pass); LOG_WARNING(TAG_WIFI, F("AP IP address : %s"), WiFi.softAPIP().toString().c_str()); -// httpReconnect();} -#endif + // httpReconnect();} + #endif return true; } static void wifiReconnect(void) { WiFi.disconnect(true); -#if defined(ARDUINO_ARCH_ESP8266) + #if defined(ARDUINO_ARCH_ESP8266) WiFi.hostname(mqttGetNodename().c_str()); -#elif defined(ARDUINO_ARCH_ESP32) + #elif defined(ARDUINO_ARCH_ESP32) WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE); WiFi.setHostname(mqttGetNodename().c_str()); -#endif + #endif WiFi.begin(wifiSsid, wifiPassword); } @@ -365,7 +366,7 @@ static void wifiReconnect(void) void wifiSetup() { -#if defined(STM32F4xx) + #if defined(STM32F4xx) // Temp ESP reset function pinMode(ESPSPI_RST, OUTPUT); digitalWrite(ESPSPI_RST, 0); @@ -401,41 +402,41 @@ void wifiSetup() // status = WiFi.begin(wifiSsid, wifiPassword); WiFi.begin(wifiSsid, wifiPassword); } - // } + // } -#else + #else if(wifiShowAP()) { WiFi.mode(WIFI_AP_STA); } else { WiFi.mode(WIFI_STA); -#if defined(ARDUINO_ARCH_ESP8266) + #if defined(ARDUINO_ARCH_ESP8266) // wifiEventHandler[0] = WiFi.onStationModeConnected(wifiSTAConnected); gotIpEventHandler = WiFi.onStationModeGotIP(wifiSTAGotIP); // As soon WiFi is connected, start NTP Client disconnectedEventHandler = WiFi.onStationModeDisconnected(wifiSTADisconnected); WiFi.setSleepMode(WIFI_NONE_SLEEP); -#elif defined(ARDUINO_ARCH_ESP32) + #elif defined(ARDUINO_ARCH_ESP32) WiFi.onEvent(wifi_callback); WiFi.setSleep(false); -#endif + #endif wifiReconnect(); LOG_TRACE(TAG_WIFI, F("Connecting to : %s"), wifiSsid); } -#endif + #endif } bool wifiEvery5Seconds() { -#if defined(STM32F4xx) + #if defined(STM32F4xx) if(wifiShowAP()) { // no ssid is set yet wait for user on-screen input return false; } else if(WiFi.status() == WL_CONNECTED) { -#else + #else if(WiFi.getMode() != WIFI_STA) { return false; } else if(WiFi.status() == WL_CONNECTED) { -#endif + #endif return true; } else { wifiReconnectCounter++; @@ -456,27 +457,27 @@ bool wifiValidateSsid(const char * ssid, const char * pass) uint8_t attempt = 0; WiFi.begin(ssid, pass); -#if defined(STM32F4xx) + #if defined(STM32F4xx) IPAddress ip; ip = WiFi.localIP(); char espIp[16]; memset(espIp, 0, sizeof(espIp)); snprintf_P(espIp, sizeof(espIp), PSTR("%d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]); while(attempt < 15 && (WiFi.status() != WL_CONNECTED || String(espIp) == F("0.0.0.0"))) { -#else + #else while(attempt < 15 && (WiFi.status() != WL_CONNECTED || WiFi.localIP().toString() == F("0.0.0.0"))) { -#endif + #endif attempt++; LOG_INFO(TAG_WIFI, F("Trying to connect to %s... %u"), wifiSsid, attempt); delay(500); } -#if defined(STM32F4xx) + #if defined(STM32F4xx) LOG_INFO(TAG_WIFI, F(D_NETWORK_IP_ADDRESS_RECEIVED), espIp); if((WiFi.status() == WL_CONNECTED && String(espIp) != F("0.0.0.0"))) return true; -#else + #else LOG_INFO(TAG_WIFI, F(D_NETWORK_IP_ADDRESS_RECEIVED), WiFi.localIP().toString().c_str()); if((WiFi.status() == WL_CONNECTED && WiFi.localIP().toString() != F("0.0.0.0"))) return true; -#endif + #endif LOG_WARNING(TAG_WIFI, F(D_NETWORK_IP_ADDRESS_RECEIVED), WiFi.localIP().toString().c_str()); WiFi.disconnect(); @@ -487,29 +488,29 @@ void wifiStop() { wifiReconnectCounter = 0; // Prevent endless loop in wifiDisconnected WiFi.disconnect(); -#if !defined(STM32F4xx) + #if !defined(STM32F4xx) WiFi.mode(WIFI_OFF); -#endif + #endif LOG_WARNING(TAG_WIFI, F(D_SERVICE_STOPPED)); } void wifi_get_statusupdate(char * buffer, size_t len) { -#if defined(STM32F4xx) + #if defined(STM32F4xx) IPAddress ip; ip = WiFi.localIP(); char espIp[16]; memset(espIp, 0, sizeof(espIp)); snprintf_P(buffer, len, PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%d.%d.%d.%d\","), WiFi.SSID(), WiFi.RSSI(), ip[0], ip[1], ip[2], ip[3]); -#else + #else snprintf_P(buffer, len, PSTR("\"ssid\":\"%s\",\"rssi\":%i,\"ip\":\"%s\","), WiFi.SSID().c_str(), WiFi.RSSI(), WiFi.localIP().toString().c_str()); -#endif + #endif } -/* ============ Confiuration =============================================================== */ -#if HASP_USE_CONFIG > 0 + /* ============ Confiuration =============================================================== */ + #if HASP_USE_CONFIG > 0 bool wifiGetConfig(const JsonObject & settings) { bool changed = false; @@ -550,6 +551,6 @@ bool wifiSetConfig(const JsonObject & settings) return changed; } -#endif // HASP_USE_CONFIG + #endif // HASP_USE_CONFIG #endif \ No newline at end of file From b50278a68ba47f8def04a1b9dcd87295e23e0bf6 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Tue, 23 Feb 2021 00:06:57 +0100 Subject: [PATCH 12/29] Fix webHandleConfig callback --- src/svc/hasp_http.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/svc/hasp_http.cpp b/src/svc/hasp_http.cpp index dff3244f..1525a60f 100644 --- a/src/svc/hasp_http.cpp +++ b/src/svc/hasp_http.cpp @@ -1942,7 +1942,7 @@ void httpSetup() if(WiFi.getMode() != WIFI_STA) { LOG_TRACE(TAG_HTTP, F("Wifi access point")); webServer.on(F("/"), webHandleWifiConfig); - webServer.on(F("/config"), webHandleWifiConfig); + webServer.on(F("/config"), webHandleConfig); return; } From 203c575d7064448a78635e7d284753f28ee855cc Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Tue, 23 Feb 2021 00:43:13 +0100 Subject: [PATCH 13/29] Fix telnet --- src/svc/hasp_telnet.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/svc/hasp_telnet.cpp b/src/svc/hasp_telnet.cpp index 8b9689d3..794bfc3d 100644 --- a/src/svc/hasp_telnet.cpp +++ b/src/svc/hasp_telnet.cpp @@ -85,7 +85,7 @@ void telnetAcceptClient() #if HASP_USE_HTTP > 0 if(strlen(httpUser) != 0 || strlen(httpPassword) != 0) { - telnetClient.println(F("\r\n" D_TELNET_USERNAME " ")); + telnetClient.println(F("\r\n" D_USERNAME " ")); telnetLoginState = TELNET_UNAUTHENTICATED; } else #endif @@ -186,7 +186,7 @@ static inline void telnetProcessLine(const char * input) switch(telnetLoginState) { case TELNET_UNAUTHENTICATED: { char buffer[20]; - snprintf_P(buffer, sizeof(buffer), PSTR(D_TELNET_PASSWORD " %c%c%c\n"), 0xFF, 0xFB, + snprintf_P(buffer, sizeof(buffer), PSTR(D_PASSWORD " %c%c%c\n"), 0xFF, 0xFB, 0x01); // Hide characters telnetClient.print(buffer); #if HASP_USE_HTTP > 0 @@ -206,7 +206,7 @@ static inline void telnetProcessLine(const char * input) if(telnetLoginAttempt >= 3) { telnetClientDisconnect(); } else { - telnetClient.print(F(D_TELNET_USERNAME " ")); + telnetClient.print(F(D_USERNAME " ")); } } #else @@ -218,7 +218,7 @@ static inline void telnetProcessLine(const char * input) if(strcasecmp_P(input, PSTR("exit")) == 0) { telnetClientDisconnect(); } else if(strcasecmp_P(input, PSTR("logoff")) == 0) { - telnetClient.println(F("\r\n" D_TELNET_USERNAME " ")); + telnetClient.println(F("\r\n" D_USERNAME " ")); telnetLoginState = TELNET_UNAUTHENTICATED; } else { dispatch_text_line(input); From e649fa9941f63215bb387f6f5871d0461ce5dd1c Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Tue, 23 Feb 2021 00:46:22 +0100 Subject: [PATCH 14/29] Start network in AP mode --- src/net/hasp_wifi.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/net/hasp_wifi.cpp b/src/net/hasp_wifi.cpp index 94d86806..beb9d191 100644 --- a/src/net/hasp_wifi.cpp +++ b/src/net/hasp_wifi.cpp @@ -345,6 +345,7 @@ bool wifiShowAP(char * ssid, char * pass) LOG_WARNING(TAG_WIFI, F("Temporary Access Point %s password: %s"), ssid, pass); LOG_WARNING(TAG_WIFI, F("AP IP address : %s"), WiFi.softAPIP().toString().c_str()); + networkStart(); // httpReconnect();} #endif return true; From 7f765c9a85ee4715ae6c7c7dc46dd66831e5ff7c Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Tue, 23 Feb 2021 20:53:47 +0100 Subject: [PATCH 15/29] Version bump --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index c76e2040..34b4f9e8 100644 --- a/platformio.ini +++ b/platformio.ini @@ -61,7 +61,7 @@ build_flags = ; -- Hasp build options ---------------------------- -D HASP_VER_MAJ=0 -D HASP_VER_MIN=3 - -D HASP_VER_REV=4 + -D HASP_VER_REV=5 -D HASP_LOG_LEVEL=9 -D HASP_USE_CONFIG=1 ; Native application, not library ${override.build_flags} From c81bf0da00b186c992e4f9752da6a05976e04ec1 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Tue, 23 Feb 2021 21:16:54 +0100 Subject: [PATCH 16/29] Fix telnet server --- src/svc/hasp_telnet.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/svc/hasp_telnet.cpp b/src/svc/hasp_telnet.cpp index 794bfc3d..7f10e7e1 100644 --- a/src/svc/hasp_telnet.cpp +++ b/src/svc/hasp_telnet.cpp @@ -28,8 +28,7 @@ static EthernetServer telnetServer(23); #endif #if HASP_USE_HTTP > 0 -extern char httpUser[32]; -extern char httpPassword[32]; +extern hasp_http_config_t http_config; #endif uint8_t telnetLoginState = TELNET_UNAUTHENTICATED; @@ -84,7 +83,7 @@ void telnetAcceptClient() // telnetClient.print((char)0x1B); #if HASP_USE_HTTP > 0 - if(strlen(httpUser) != 0 || strlen(httpPassword) != 0) { + if(strlen(http_config.user) != 0 || strlen(http_config.password) != 0) { telnetClient.println(F("\r\n" D_USERNAME " ")); telnetLoginState = TELNET_UNAUTHENTICATED; } else @@ -104,13 +103,13 @@ static inline void telnetProcessLine() case TELNET_UNAUTHENTICATED: { telnetClient.printf(PSTR(D_TELNET_PASSWORD" %c%c%c"), 0xFF, 0xFB, 0x01); // Hide characters #if HASP_USE_HTTP > 0 - telnetLoginState = strcmp(telnetInputBuffer, httpUser) == 0 ? TELNET_USERNAME_OK : TELNET_USERNAME_NOK; + telnetLoginState = strcmp(telnetInputBuffer, http_config.user) == 0 ? TELNET_USERNAME_OK : TELNET_USERNAME_NOK; break; } case TELNET_USERNAME_OK: case TELNET_USERNAME_NOK: { telnetClient.printf(PSTR("%c%c%c\n"), 0xFF, 0xFC, 0x01); // Show characters - if(telnetLoginState == TELNET_USERNAME_OK && strcmp(telnetInputBuffer, httpPassword) == 0) { + if(telnetLoginState == TELNET_USERNAME_OK && strcmp(telnetInputBuffer, http_config.password) == 0) { telnetClientLogon(); } else { telnetLoginState = TELNET_UNAUTHENTICATED; @@ -190,13 +189,13 @@ static inline void telnetProcessLine(const char * input) 0x01); // Hide characters telnetClient.print(buffer); #if HASP_USE_HTTP > 0 - telnetLoginState = strcmp(input, httpUser) == 0 ? TELNET_USERNAME_OK : TELNET_USERNAME_NOK; + telnetLoginState = strcmp(input, http_config.user) == 0 ? TELNET_USERNAME_OK : TELNET_USERNAME_NOK; break; } case TELNET_USERNAME_OK: case TELNET_USERNAME_NOK: { telnetClient.printf(PSTR("%c%c%c\n"), 0xFF, 0xFC, 0x01); // Show characters - if(telnetLoginState == TELNET_USERNAME_OK && strcmp(input, httpPassword) == 0) { + if(telnetLoginState == TELNET_USERNAME_OK && strcmp(input, http_config.password) == 0) { telnetClientLogon(); } else { telnetLoginState = TELNET_UNAUTHENTICATED; From 829210f3cf95e48bb7b3c9ecb45f2c6e8d0ff561 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Fri, 26 Feb 2021 20:40:44 +0100 Subject: [PATCH 17/29] Create other_question.md --- .github/ISSUE_TEMPLATE/other_question.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/other_question.md diff --git a/.github/ISSUE_TEMPLATE/other_question.md b/.github/ISSUE_TEMPLATE/other_question.md new file mode 100644 index 00000000..e2e77246 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other_question.md @@ -0,0 +1,7 @@ +## Questions + +We only keep bug reports and active requests being worked on in the issues tracker. + +For general questions we have opened the [discussion forum](https://github.com/fvanroie/hasp-lvgl/discussions) on github and [#hasp-lvgl channel](https://discord.gg/VCWyuhF) on Discord. + +If you are not sure if your question is related to the code development, feel free to ask! From ad98ac595c8b95c4e4327cc4e5fffc033cbdcfb0 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Fri, 26 Feb 2021 20:44:45 +0100 Subject: [PATCH 18/29] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 3 ++- .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 834e4a9b..d3e5f664 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,8 +2,9 @@ name: Bug report about: Create a bug report to help us improve title: '' -labels: 'bug' +labels: bug assignees: '' + ---