From e7b1958ff57d9fbb5f6455ffa26f1225f299a374 Mon Sep 17 00:00:00 2001 From: lenvm Date: Sun, 26 Nov 2023 14:52:39 +0100 Subject: [PATCH] add WEBSERVER macro to enable or disable webserver functionality --- Software/Software.ino | 9 ++++++++- Software/USER_SETTINGS.cpp | 2 ++ Software/USER_SETTINGS.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Software/Software.ino b/Software/Software.ino index 510a5aad..240618b2 100644 --- a/Software/Software.ino +++ b/Software/Software.ino @@ -6,7 +6,6 @@ #include "USER_SETTINGS.h" #include "src/battery/BATTERIES.h" #include "src/devboard/config.h" -#include "src/devboard/webserver/webserver.h" #include "src/inverter/INVERTERS.h" #include "src/lib/adafruit-Adafruit_NeoPixel/Adafruit_NeoPixel.h" #include "src/lib/eModbus-eModbus/Logging.h" @@ -15,6 +14,10 @@ #include "src/lib/miwagner-ESP32-Arduino-CAN/CAN_config.h" #include "src/lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h" +#ifdef WEBSERVER +#include "src/devboard/webserver/webserver.h" +#endif + // Interval settings int intervalUpdateValues = 4800; // Interval at which to update inverter values / Modbus registers const int interval10 = 10; // Interval for 10ms tasks @@ -110,7 +113,9 @@ bool inverterAllowsContactorClosing = true; void setup() { init_serial(); +#ifdef WEBSERVER init_webserver(); +#endif init_CAN(); @@ -127,8 +132,10 @@ void setup() { // Perform main program functions void loop() { +#ifdef WEBSERVER // Over-the-air updates by ElegantOTA ElegantOTA.loop(); +#endif // Input receive_can(); // Receive CAN messages. Runs as fast as possible diff --git a/Software/USER_SETTINGS.cpp b/Software/USER_SETTINGS.cpp index be47298a..5f760710 100644 --- a/Software/USER_SETTINGS.cpp +++ b/Software/USER_SETTINGS.cpp @@ -1,6 +1,8 @@ #include "USER_SETTINGS.h" +#ifdef WEBSERVER const char* ssid = "REPLACE_WITH_YOUR_SSID"; // maximum of 63 characters; const char* password = "REPLACE_WITH_YOUR_PASSWORD"; // minimum of 8 characters; const char* ssidAP = "Battery Emulator"; // maximum of 63 characters; const char* passwordAP = "123456789"; // minimum of 8 characters; set to NULL if you want the access point to be open +#endif diff --git a/Software/USER_SETTINGS.h b/Software/USER_SETTINGS.h index c05068c6..98dd45ae 100644 --- a/Software/USER_SETTINGS.h +++ b/Software/USER_SETTINGS.h @@ -42,5 +42,6 @@ //#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence //#define PWM_CONTACTOR_CONTROL //Enable this line to use PWM logic for contactors, which lower power consumption and heat generation //#define DUAL_CAN //Enable this line to activate an isolated secondary CAN Bus using add-on MCP2515 controller (Needed for FoxESS inverters) +#define WEBSERVER //Enable this line to enable WiFi, and to run the webserver #endif