add WEBSERVER macro to enable or disable webserver functionality

This commit is contained in:
lenvm 2023-11-26 14:52:39 +01:00
parent ce47ffd452
commit e7b1958ff5
3 changed files with 11 additions and 1 deletions

View file

@ -6,7 +6,6 @@
#include "USER_SETTINGS.h" #include "USER_SETTINGS.h"
#include "src/battery/BATTERIES.h" #include "src/battery/BATTERIES.h"
#include "src/devboard/config.h" #include "src/devboard/config.h"
#include "src/devboard/webserver/webserver.h"
#include "src/inverter/INVERTERS.h" #include "src/inverter/INVERTERS.h"
#include "src/lib/adafruit-Adafruit_NeoPixel/Adafruit_NeoPixel.h" #include "src/lib/adafruit-Adafruit_NeoPixel/Adafruit_NeoPixel.h"
#include "src/lib/eModbus-eModbus/Logging.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/CAN_config.h"
#include "src/lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h" #include "src/lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"
#ifdef WEBSERVER
#include "src/devboard/webserver/webserver.h"
#endif
// Interval settings // Interval settings
int intervalUpdateValues = 4800; // Interval at which to update inverter values / Modbus registers int intervalUpdateValues = 4800; // Interval at which to update inverter values / Modbus registers
const int interval10 = 10; // Interval for 10ms tasks const int interval10 = 10; // Interval for 10ms tasks
@ -110,7 +113,9 @@ bool inverterAllowsContactorClosing = true;
void setup() { void setup() {
init_serial(); init_serial();
#ifdef WEBSERVER
init_webserver(); init_webserver();
#endif
init_CAN(); init_CAN();
@ -127,8 +132,10 @@ void setup() {
// Perform main program functions // Perform main program functions
void loop() { void loop() {
#ifdef WEBSERVER
// Over-the-air updates by ElegantOTA // Over-the-air updates by ElegantOTA
ElegantOTA.loop(); ElegantOTA.loop();
#endif
// Input // Input
receive_can(); // Receive CAN messages. Runs as fast as possible receive_can(); // Receive CAN messages. Runs as fast as possible

View file

@ -1,6 +1,8 @@
#include "USER_SETTINGS.h" #include "USER_SETTINGS.h"
#ifdef WEBSERVER
const char* ssid = "REPLACE_WITH_YOUR_SSID"; // maximum of 63 characters; const char* ssid = "REPLACE_WITH_YOUR_SSID"; // maximum of 63 characters;
const char* password = "REPLACE_WITH_YOUR_PASSWORD"; // minimum of 8 characters; const char* password = "REPLACE_WITH_YOUR_PASSWORD"; // minimum of 8 characters;
const char* ssidAP = "Battery Emulator"; // maximum of 63 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 const char* passwordAP = "123456789"; // minimum of 8 characters; set to NULL if you want the access point to be open
#endif

View file

@ -42,5 +42,6 @@
//#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence //#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 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 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 #endif