Fix TWI address reading error

This commit is contained in:
2025-11-27 15:55:29 +01:00
parent 71106c2542
commit 3a91791180
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -27,6 +27,7 @@
inline void eeprom_init() { inline void eeprom_init() {
#define DICT_SIZE 4 #define DICT_SIZE 4
// EEPROM addresses
#define TWI_ADDR 0x22 #define TWI_ADDR 0x22
#define SENSOR_READINGS 0x23 #define SENSOR_READINGS 0x23
#define MOISTURE_MIN 0x24 #define MOISTURE_MIN 0x24
@@ -39,8 +40,9 @@ inline void eeprom_init() {
MOISTURE_MAX MOISTURE_MAX
}; };
// actual values
uint16_t values[DICT_SIZE] = { uint16_t values[DICT_SIZE] = {
0x20, 0x30,
5, 5,
400, 400,
200 200
+1 -1
View File
@@ -17,7 +17,7 @@ static inline void twiReset(void) {
} }
void twiInit(void) { void twiInit(void) {
TWAR = (TWI_ADDR << 1); //address definition found in config.h TWAR = ((eepromRead(TWI_ADDR)) << 1); //address definition found in config.h
twiReset(); twiReset();
} }