From f961cc62a0b1318c1431cf82c3b4b371d0cf3d3b Mon Sep 17 00:00:00 2001 From: Erick Ahmed Date: Wed, 10 Dec 2025 23:08:03 +0100 Subject: [PATCH] Move definition to config --- firmware/esp32/include/config.h | 10 ++++++++-- firmware/esp32/main/i2c.cpp | 9 ++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/firmware/esp32/include/config.h b/firmware/esp32/include/config.h index 43de798..8665267 100644 --- a/firmware/esp32/include/config.h +++ b/firmware/esp32/include/config.h @@ -1,8 +1,6 @@ #ifndef CONFIG_H #define CONFIG_H -// TODO: make this a config.h - // WI-FI #define SSID "your_wifi_ssid" #define PASSWORD "your_wifi_password" @@ -14,4 +12,12 @@ #define MQTT_USER "your_username" #define MQTT_PASS "your_password" +// Hardware + +// Change based on how many vases max to manage [1 to ~100] +// larger numberss will require larger arrays stored in memory +// see AVR limitation on TWI addresses +#define SLAVES_NUMBER 8 + + #endif diff --git a/firmware/esp32/main/i2c.cpp b/firmware/esp32/main/i2c.cpp index a2ca680..182d22b 100644 --- a/firmware/esp32/main/i2c.cpp +++ b/firmware/esp32/main/i2c.cpp @@ -1,17 +1,12 @@ #include #include "driver/i2c_master.h" #include "esp_log.h" +#include "config.h" // ESP32-C3 Super Mini, change this ports for other versions #define I2C_MASTER_SCL_IO 9 #define I2C_MASTER_SDA_IO 8 -// TODO: put this in a config.hpp -// Change based on how many vases max to manage [1 to ~100] -// larger number will require larger array -// see limitation on AVR addresses for TWI -#define SLAVES_NUMBER 32 - static const char* TAG = "I2C"; TaskHandle_t i2c_task_handle = NULL; @@ -44,7 +39,7 @@ static void i2c_init(void) { ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_mst_config, &bus_handle)); // Add all vases adresses here: - // TODO: move this to a config.cpp + // TODO: move this to config.h register_slave(0x30); }