Skip to content

Commit

Permalink
Working with formatting...
Browse files Browse the repository at this point in the history
  • Loading branch information
Cabooman committed Jan 8, 2024
1 parent 600cda9 commit c0a21ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
14 changes: 7 additions & 7 deletions Software/USER_SETTINGS.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <Arduino.h>
#include "USER_SETTINGS.h"
#include <Arduino.h>

#ifdef USE_WIFI

Expand All @@ -8,11 +8,11 @@
#ifdef USE_MQTT
const char* mqtt_user = "REDACTED";
const char* mqtt_password = "REDACTED";
#endif // USE_MQTT
#endif // USE_MQTT

const char* ssid = "REDACTED"; // maximum of 63 characters;
const char* password = "REDACTED"; // 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
const char* ssid = "REDACTED"; // maximum of 63 characters;
const char* password = "REDACTED"; // 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
#endif
27 changes: 14 additions & 13 deletions Software/USER_SETTINGS.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/* Select inverter communication protocol. See Wiki for which to use with your inverter: https://github.com/dalathegreat/BYD-Battery-Emulator-For-Gen24/wiki */
//#define BYD_CAN //Enable this line to emulate a "BYD Battery-Box Premium HVS" over CAN Bus
#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU
#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU
//#define LUNA2000_MODBUS //Enable this line to emulate a "Luna2000 battery" over Modbus RTU
//#define PYLON_CAN //Enable this line to emulate a "Pylontech battery" over CAN bus
//#define SMA_CAN //Enable this line to emulate a "BYD Battery-Box H 8.9kWh, 7 mod" over CAN bus
Expand Down Expand Up @@ -48,31 +48,32 @@
// High level connectivity settings below. See USER_SETTINGS.cpp for detailed settings.

// Enabling any define below enables Wifi functionality. See USER_SETTINGS.cpp for the Wifi settings.
#define USE_WEBSERVER //Enable this line to run the webserver and enable OTA updates.
#define USE_MQTT //Enable this line to enable MQTT functionality. See USER_SETTINGS.cpp for the MQTT settings.
#define USE_WEBSERVER //Enable this line to run the webserver and enable OTA updates.
#define USE_MQTT //Enable this line to enable MQTT functionality. See USER_SETTINGS.cpp for the MQTT settings.

// Various Wifi specific defines, placed here to remove the need for messier code and issues with optimizations/linking.
//#define ENABLE_AP //Enable this line to run Wifi in AP mode (only broadcasting the LilyGO access point SSID).
#define ENABLE_STA //Enable this line to run Wifi in STA mode (connected to your home network).
//#define ENABLE_AP //Enable this line to run Wifi in AP mode (only broadcasting the LilyGO access point SSID).
#define ENABLE_STA //Enable this line to run Wifi in STA mode (connected to your home network).

#define MQTT_SUBSCRIPTIONS {"my/topic/abc", "my/other/topic"}
#define MQTT_SERVER "192.168.xxx.yyy"
#define MQTT_PORT 1883
#define MQTT_SUBSCRIPTIONS \
{"my/topic/abc", "my/other/topic"}
#define MQTT_SERVER "192.168.xxx.yyy"
#define MQTT_PORT 1883

// ---- Derived defines below ----

#if defined(USE_WEBSERVER) || defined(USE_MQTT)
#define USE_WIFI
#define USE_WIFI
#endif

#if defined(ENABLE_AP) && defined(ENABLE_STA)
#define WIFI_MODE WIFI_AP_STA
#define WIFI_MODE WIFI_AP_STA
#elif defined(ENABLE_AP)
#define WIFI_MODE WIFI_AP
#define WIFI_MODE WIFI_AP
#elif defined(ENABLE_STA)
#define WIFI_MODE WIFI_STA
#define WIFI_MODE WIFI_STA
#else
#define WIFI_MODE WIFI_OFF // Just in case
#define WIFI_MODE WIFI_OFF // Just in case
#endif

#endif
2 changes: 1 addition & 1 deletion Software/src/devboard/mqtt/mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ void mqtt_loop(void) {
reconnect(); // Update values heading towards inverter. Prepare for sending on CAN, or write directly to Modbus.
}
}
}
}

0 comments on commit c0a21ac

Please sign in to comment.