diff --git a/include/user_config_override-template.h b/include/user_config_override-template.h index a9e88937..be117525 100644 --- a/include/user_config_override-template.h +++ b/include/user_config_override-template.h @@ -18,15 +18,21 @@ WiFi Settings **************************************************/ #define WIFI_SSID "" -#define WIFI_PASSW "" +#define WIFI_PASSWORD "" /*************************************************** - MQTT Settings + Http Server Settings **************************************************/ -#define MQTT_HOST "" +#define HTTP_USERNAME "" +#define HTTP_PASSWORD "" + +/*************************************************** + MQTT Client Settings + **************************************************/ +#define MQTT_HOSTNAME "" #define MQTT_PORT 1883 -#define MQTT_USER "" -#define MQTT_PASSW "" +#define MQTT_USERNAME "" +#define MQTT_PASSWORD "" #define MQTT_PREFIX "hasp" #define MQTT_NODENAME "plate01" #define MQTT_GROUPNAME "plates" diff --git a/src/mqtt/hasp_mqtt.h b/src/mqtt/hasp_mqtt.h index 9d6f090a..31d2e07f 100644 --- a/src/mqtt/hasp_mqtt.h +++ b/src/mqtt/hasp_mqtt.h @@ -7,15 +7,6 @@ #include #include "hasplib.h" -// #if defined(WINDOWS) || defined(POSIX) -// #define __FlashStringHelper char -// #endif - -#ifdef ARDUINO -#include "PubSubClient.h" -extern PubSubClient mqttClient; -#endif - typedef enum { MQTT_ERR_OK = 0, MQTT_ERR_DISABLED = -1, @@ -85,20 +76,32 @@ bool mqttSetConfig(const JsonObject& settings); #define MQTT_GROUPNAME "plates"; #endif +#ifndef MQTT_HOSTNAME #ifndef MQTT_HOST -#define MQTT_HOST ""; +#define MQTT_HOSTNAME ""; +#else +#define MQTT_HOSTNAME MQTT_HOST; +#endif #endif #ifndef MQTT_PORT #define MQTT_PORT 1883; #endif +#ifndef MQTT_USERNAME #ifndef MQTT_USER -#define MQTT_USER ""; +#define MQTT_USERNAME ""; +#else +#define MQTT_USERNAME MQTT_USER; +#endif #endif +#ifndef MQTT_PASSWORD #ifndef MQTT_PASSW -#define MQTT_PASSW ""; +#define MQTT_PASSWORD ""; +#else +#define MQTT_PASSWORD MQTT_PASSW; +#endif #endif #endif // HASP_MQTT_H \ No newline at end of file diff --git a/src/mqtt/hasp_mqtt_paho_async.cpp b/src/mqtt/hasp_mqtt_paho_async.cpp index ae697b99..53b41bc3 100644 --- a/src/mqtt/hasp_mqtt_paho_async.cpp +++ b/src/mqtt/hasp_mqtt_paho_async.cpp @@ -66,9 +66,9 @@ bool mqttHAautodiscover = true; std::recursive_mutex dispatch_mtx; std::recursive_mutex publish_mtx; -char mqttServer[MAX_HOSTNAME_LENGTH] = MQTT_HOST; -char mqttUser[MAX_USERNAME_LENGTH] = MQTT_USER; -char mqttPassword[MAX_PASSWORD_LENGTH] = MQTT_PASSW; +char mqttServer[MAX_HOSTNAME_LENGTH] = MQTT_HOSTNAME; +char mqttUser[MAX_USERNAME_LENGTH] = MQTT_USERNAME; +char mqttPassword[MAX_PASSWORD_LENGTH] = MQTT_PASSWORD; // char mqttNodeName[16] = MQTT_NODENAME; char mqttGroupName[16] = MQTT_GROUPNAME; uint16_t mqttPort = MQTT_PORT; diff --git a/src/mqtt/hasp_mqtt_paho_single.cpp b/src/mqtt/hasp_mqtt_paho_single.cpp index a0cb3d0b..fdb37c31 100644 --- a/src/mqtt/hasp_mqtt_paho_single.cpp +++ b/src/mqtt/hasp_mqtt_paho_single.cpp @@ -63,9 +63,9 @@ uint32_t mqttPublishCount; uint32_t mqttReceiveCount; uint32_t mqttFailedCount; -std::string mqttServer = MQTT_HOST; -std::string mqttUser = MQTT_USER; -std::string mqttPassword = MQTT_PASSW; +std::string mqttServer = MQTT_HOSTNAME; +std::string mqttUser = MQTT_USERNAME; +std::string mqttPassword = MQTT_PASSWORD; std::string mqttGroupName = MQTT_GROUPNAME; uint16_t mqttPort = MQTT_PORT; diff --git a/src/mqtt/hasp_mqtt_pubsubclient.cpp b/src/mqtt/hasp_mqtt_pubsubclient.cpp index e046d496..2114da75 100644 --- a/src/mqtt/hasp_mqtt_pubsubclient.cpp +++ b/src/mqtt/hasp_mqtt_pubsubclient.cpp @@ -54,9 +54,9 @@ uint32_t mqttPublishCount; uint32_t mqttReceiveCount; uint32_t mqttFailedCount; -char mqttServer[MAX_HOSTNAME_LENGTH] = MQTT_HOST; -char mqttUsername[MAX_USERNAME_LENGTH] = MQTT_USER; -char mqttPassword[MAX_PASSWORD_LENGTH] = MQTT_PASSW; +char mqttServer[MAX_HOSTNAME_LENGTH] = MQTT_HOSTNAME; +char mqttUsername[MAX_USERNAME_LENGTH] = MQTT_USERNAME; +char mqttPassword[MAX_PASSWORD_LENGTH] = MQTT_PASSWORD; // char mqttNodeName[16] = MQTT_NODENAME; char mqttGroupName[16] = MQTT_GROUPNAME; uint16_t mqttPort = MQTT_PORT; diff --git a/src/sys/net/hasp_wifi.cpp b/src/sys/net/hasp_wifi.cpp index 2f50aa6c..f15631ad 100644 --- a/src/sys/net/hasp_wifi.cpp +++ b/src/sys/net/hasp_wifi.cpp @@ -38,16 +38,8 @@ SPIClass espSPI(ESPSPI_MOSI, ESPSPI_MISO, ESPSPI_SCLK); // SPI port where esp is #endif //#include "DNSserver.h" -#ifndef WIFI_SSID -#define WIFI_SSID "" -#endif - -#ifndef WIFI_PASSW -#define WIFI_PASSW "" -#endif - char wifiSsid[MAX_USERNAME_LENGTH] = WIFI_SSID; -char wifiPassword[MAX_PASSWORD_LENGTH] = WIFI_PASSW; +char wifiPassword[MAX_PASSWORD_LENGTH] = WIFI_PASSWORD; char wifiIpAddress[16] = ""; uint16_t wifiReconnectCounter = 0; bool wifiOnline = false; diff --git a/src/sys/net/hasp_wifi.h b/src/sys/net/hasp_wifi.h index 359240b4..e5d0269d 100644 --- a/src/sys/net/hasp_wifi.h +++ b/src/sys/net/hasp_wifi.h @@ -30,4 +30,16 @@ bool wifiGetConfig(const JsonObject& settings); bool wifiSetConfig(const JsonObject& settings); #endif +#ifndef WIFI_SSID +#define WIFI_SSID "" +#endif + +#ifndef WIFI_PASSWORD +#ifndef WIFI_PASSW +#define WIFI_PASSWORD ""; +#else +#define WIFI_PASSWORD WIFI_PASSW; +#endif +#endif + #endif \ No newline at end of file diff --git a/src/sys/svc/hasp_http.cpp b/src/sys/svc/hasp_http.cpp index 069b2946..84d5ac99 100644 --- a/src/sys/svc/hasp_http.cpp +++ b/src/sys/svc/hasp_http.cpp @@ -32,49 +32,6 @@ // #include "user_config_override.h" // #endif -/* clang-format off */ -//default theme -#ifndef D_HTTP_COLOR_TEXT -#define D_HTTP_COLOR_TEXT "#000" // Global text color - Black -#endif -#ifndef D_HTTP_COLOR_BACKGROUND -#define D_HTTP_COLOR_BACKGROUND "#fff" // Global background color - White -#endif -#ifndef D_HTTP_COLOR_INPUT_TEXT -#define D_HTTP_COLOR_INPUT_TEXT "#000" // Input text color - Black -#endif -#ifndef D_HTTP_COLOR_INPUT -#define D_HTTP_COLOR_INPUT "#fff" // Input background color - White -#endif -#ifndef D_HTTP_COLOR_INPUT_WARNING -#define D_HTTP_COLOR_INPUT_WARNING "#f00" // Input warning border color - Red -#endif -#ifndef D_HTTP_COLOR_BUTTON_TEXT -#define D_HTTP_COLOR_BUTTON_TEXT "#fff" // Button text color - White -#endif -#ifndef D_HTTP_COLOR_BUTTON -#define D_HTTP_COLOR_BUTTON "#1fa3ec" // Button color - Vivid blue -#endif -#ifndef D_HTTP_COLOR_BUTTON_HOVER -#define D_HTTP_COLOR_BUTTON_HOVER "#0083cc" // Button color - Olympic blue -#endif -#ifndef D_HTTP_COLOR_BUTTON_RESET -#define D_HTTP_COLOR_BUTTON_RESET "#f00" // Restart/Reset button color - red -#endif -#ifndef D_HTTP_COLOR_BUTTON_RESET_HOVER -#define D_HTTP_COLOR_BUTTON_RESET_HOVER "#b00" // Restart/Reset button color - Dark red -#endif -#ifndef D_HTTP_COLOR_GROUP_TEXT -#define D_HTTP_COLOR_GROUP_TEXT "#000" // Container text color - Black -#endif -#ifndef D_HTTP_COLOR_GROUP -#define D_HTTP_COLOR_GROUP "#f3f3f3" // Container color - Light gray -#endif -#ifndef D_HTTP_COLOR_FOOTER_TEXT -#define D_HTTP_COLOR_FOOTER_TEXT "#0083cc" // Text color of the page footer -#endif -/* clang-format on */ - #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) File fsUploadFile; #endif diff --git a/src/sys/svc/hasp_http.h b/src/sys/svc/hasp_http.h index 866ae5d0..ab47e066 100644 --- a/src/sys/svc/hasp_http.h +++ b/src/sys/svc/hasp_http.h @@ -6,13 +6,21 @@ #include "hasp_conf.h" +#ifndef HTTP_USERNAME +#define HTTP_USERNAME ""; +#endif + +#ifndef HTTP_PASSWORD +#define HTTP_PASSWORD ""; +#endif + struct hasp_http_config_t { bool enable = true; uint16_t port = 80; - char username[MAX_USERNAME_LENGTH] = ""; - char password[MAX_PASSWORD_LENGTH] = ""; + char username[MAX_USERNAME_LENGTH] = HTTP_USERNAME; + char password[MAX_PASSWORD_LENGTH] = HTTP_PASSWORD; }; void httpSetup(); @@ -28,4 +36,47 @@ bool httpGetConfig(const JsonObject& settings); bool httpSetConfig(const JsonObject& settings); #endif // HASP_USE_CONFIG +/* clang-format off */ +//default theme +#ifndef D_HTTP_COLOR_TEXT +#define D_HTTP_COLOR_TEXT "#000" // Global text color - Black +#endif +#ifndef D_HTTP_COLOR_BACKGROUND +#define D_HTTP_COLOR_BACKGROUND "#fff" // Global background color - White +#endif +#ifndef D_HTTP_COLOR_INPUT_TEXT +#define D_HTTP_COLOR_INPUT_TEXT "#000" // Input text color - Black +#endif +#ifndef D_HTTP_COLOR_INPUT +#define D_HTTP_COLOR_INPUT "#fff" // Input background color - White +#endif +#ifndef D_HTTP_COLOR_INPUT_WARNING +#define D_HTTP_COLOR_INPUT_WARNING "#f00" // Input warning border color - Red +#endif +#ifndef D_HTTP_COLOR_BUTTON_TEXT +#define D_HTTP_COLOR_BUTTON_TEXT "#fff" // Button text color - White +#endif +#ifndef D_HTTP_COLOR_BUTTON +#define D_HTTP_COLOR_BUTTON "#1fa3ec" // Button color - Vivid blue +#endif +#ifndef D_HTTP_COLOR_BUTTON_HOVER +#define D_HTTP_COLOR_BUTTON_HOVER "#0083cc" // Button color - Olympic blue +#endif +#ifndef D_HTTP_COLOR_BUTTON_RESET +#define D_HTTP_COLOR_BUTTON_RESET "#f00" // Restart/Reset button color - red +#endif +#ifndef D_HTTP_COLOR_BUTTON_RESET_HOVER +#define D_HTTP_COLOR_BUTTON_RESET_HOVER "#b00" // Restart/Reset button color - Dark red +#endif +#ifndef D_HTTP_COLOR_GROUP_TEXT +#define D_HTTP_COLOR_GROUP_TEXT "#000" // Container text color - Black +#endif +#ifndef D_HTTP_COLOR_GROUP +#define D_HTTP_COLOR_GROUP "#f3f3f3" // Container color - Light gray +#endif +#ifndef D_HTTP_COLOR_FOOTER_TEXT +#define D_HTTP_COLOR_FOOTER_TEXT "#0083cc" // Text color of the page footer +#endif +/* clang-format on */ + #endif \ No newline at end of file