From 3022da7fe4acb730d367f93c51cba61675385b1e Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 21 Jun 2025 13:58:28 -0600 Subject: [PATCH] Cleanup --- .gitignore | 1 + firmware/firmware.ino | 16 +++++----------- firmware/secrets.h.example | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 4d1146e..2c9abeb 100644 --- a/.gitignore +++ b/.gitignore @@ -150,3 +150,4 @@ out.* *.csv *.txt *.json +.aider* diff --git a/firmware/firmware.ino b/firmware/firmware.ino index 7b335f1..efc2ed7 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -12,15 +12,9 @@ MqttClient mqttClient(wc); ESP8266WebServer server(80); String deviceName; - -#define OUTPUT_PIN 4 - - -// Broker IP and port are now defined in secrets.h -// const char broker[] = "192.168.69.106"; -// int port = 1883; -String topic; // Changed from const char[] +String topic; #define QOS_2 2 +#define OUTPUT_PIN 4 void (* resetFunc) (void) = 0; @@ -104,9 +98,9 @@ void setup() { mqttClient.setId(deviceName.c_str()); Serial.print("[MQTT] Attempting to connect to the MQTT broker: "); - Serial.println(SECRET_MQTT_BROKER_IP); + Serial.println(MQTT_BROKER_IP); - if (!mqttClient.connect(SECRET_MQTT_BROKER_IP, SECRET_MQTT_PORT)) { + if (!mqttClient.connect(MQTT_BROKER_IP, MQTT_PORT)) { Serial.print("MQTT connection failed! Error code = "); Serial.println(mqttClient.connectError()); Serial.println("Reseting..."); @@ -138,7 +132,7 @@ void loop() { Serial.print("[MQTT] Not connected! Error code = "); Serial.println(mqttClient.connectError()); Serial.println("[MQTT] Reconnecting..."); - mqttClient.connect(SECRET_MQTT_BROKER_IP, SECRET_MQTT_PORT); + mqttClient.connect(MQTT_BROKER_IP, MQTT_PORT); delay(5000); Serial.print("[MQTT] Subscribing to topic: "); diff --git a/firmware/secrets.h.example b/firmware/secrets.h.example index d1936da..d0c42ef 100644 --- a/firmware/secrets.h.example +++ b/firmware/secrets.h.example @@ -1,5 +1,5 @@ #define SECRET_SSID "" #define SECRET_PASS "" -#define SECRET_MQTT_BROKER_IP "192.168.69.106" -#define SECRET_MQTT_PORT 1883 +#define MQTT_BROKER_IP "" +#define MQTT_PORT 1883