diff --git a/Software/Software.cpp b/Software/Software.cpp index 70fd5609..dde1c9f3 100644 --- a/Software/Software.cpp +++ b/Software/Software.cpp @@ -52,8 +52,12 @@ TaskHandle_t mqtt_loop_task; Logging logging; -static std::list transmitters; +std::string mqtt_user; //TODO, move? +std::string mqtt_password; //TODO, move? +std::string http_username; //TODO, move? +std::string http_password; //TODO, move? +static std::list transmitters; void register_transmitter(Transmitter* transmitter) { transmitters.push_back(transmitter); DEBUG_PRINTF("transmitter registered, total: %d\n", transmitters.size()); diff --git a/Software/USER_SETTINGS.cpp b/Software/USER_SETTINGS.cpp index 48cf2c9b..d79a90ae 100644 --- a/Software/USER_SETTINGS.cpp +++ b/Software/USER_SETTINGS.cpp @@ -20,23 +20,21 @@ volatile CAN_Configuration can_config = { .shunt = CAN_NATIVE // (OPTIONAL) Which CAN is your shunt connected to? }; -std::string ssid; -std::string password; -std::string passwordAP; - -const uint8_t wifi_channel = 0; // Set to 0 for automatic channel selection - -std::string http_username; -std::string http_password; // Set your Static IP address. Only used incase WIFICONFIG is set in USER_SETTINGS.h IPAddress local_IP(192, 168, 10, 150); IPAddress gateway(192, 168, 10, 1); IPAddress subnet(255, 255, 255, 0); +std::string ssid; +std::string password; +std::string passwordAP; + +const uint8_t wifi_channel = 0; // Set to 0 for automatic channel selection + + // MQTT -std::string mqtt_user; -std::string mqtt_password; + const char* mqtt_topic_name = "BE"; // Custom MQTT topic name. Previously, the name was automatically set to "battery-emulator_esp32-XXXXXX" diff --git a/Software/USER_SETTINGS.h b/Software/USER_SETTINGS.h index 6b199614..30e2a80a 100644 --- a/Software/USER_SETTINGS.h +++ b/Software/USER_SETTINGS.h @@ -4,14 +4,6 @@ #include #include "src/devboard/utils/types.h" -/* This file is being transitioned towards COMMON_IMAGE. Use v8.16 if you are taking this software into use! */ - -/* Select hardware used for Battery-Emulator */ -//#define HW_LILYGO -//#define HW_STARK -//#define HW_3LB -//#define HW_DEVKIT - /* Shunt/Contactor settings (Optional) */ //#define BMW_SBOX // SBOX relay control & battery current/voltage measurement @@ -22,10 +14,6 @@ /* Connectivity options */ //#define WIFICONFIG //Enable this line to set a static IP address / gateway /subnet mask for the device. see USER_SETTINGS.cpp for the settings -#define MQTT_QOS 0 // MQTT Quality of Service (0, 1, or 2) -#define MQTT_PUBLISH_CELL_VOLTAGES // Enable this line to publish cell voltages to MQTT -#define MQTT_TIMEOUT 2000 // MQTT timeout in milliseconds - /* Do not change any code below this line */ /* Only change battery specific settings above and in "USER_SETTINGS.cpp" */ typedef struct { diff --git a/Software/src/devboard/mqtt/mqtt.cpp b/Software/src/devboard/mqtt/mqtt.cpp index a031f1a5..525df501 100644 --- a/Software/src/devboard/mqtt/mqtt.cpp +++ b/Software/src/devboard/mqtt/mqtt.cpp @@ -24,11 +24,16 @@ int mqtt_port = mqtt_port_default; std::string mqtt_server = mqtt_server_default; bool mqtt_manual_topic_object_name = - true; //TODO, should this be configurable from webserver? Or legacy option removed? + true; //TODO: should this be configurable from webserver? Or legacy option removed? // If this is not true, the previous default naming format 'battery-emulator_esp32-XXXXXX' (based on hardware ID) will be used. // This naming convention was in place until version 7.5.0. Users should check the version from which they are updating, as this change // may break compatibility with previous versions of MQTT naming +#define MQTT_PUBLISH_CELL_VOLTAGES // Enable this line to publish cell voltages to MQTT +#define MQTT_QOS 0 // MQTT Quality of Service (0, 1, or 2) +#define MQTT_TIMEOUT 2000 // MQTT timeout in milliseconds + //TODO: Should all these defines be a configurable option? + esp_mqtt_client_config_t mqtt_cfg; esp_mqtt_client_handle_t client; char mqtt_msg[MQTT_MSG_BUFFER_SIZE];