Remove triggerMoistureRead() call in ISR and it's trigger variable

- This was done at the very beginning when i thought to develop this
part of the program in a different way. It is unnecessary with how I
actually ended up to structure the program. - WDT should manage TWI
only, as per current developement
This commit is contained in:
2025-10-29 13:51:04 +01:00
parent 2a36d1356c
commit 1721be5e66
3 changed files with 3 additions and 14 deletions
-1
View File
@@ -44,7 +44,6 @@ static const int8_t sensorPins[] = {
extern volatile bool readSensors;
void sensorsInit(void);
void triggerMoistureRead(void);
uint16_t moistureRead(void);
#endif
+3 -9
View File
@@ -13,10 +13,6 @@ volatile uint16_t lastMoistureVal = 0;
volatile uint16_t *pLastMoistureVal = &lastMoistureVal;
extern bool respondFlag;
ISR(WDT_vect) {
triggerMoistureRead();
}
ISR(TWI_vect) {
twiListen();
}
@@ -50,11 +46,9 @@ int main(void) {
pLastMoistureVal = &lastMoistureVal;
while(true) {
if (readSensors) {
*pLastMoistureVal = moistureRead();
// nested if: (result outside range (see config.h)) {waterPlant()}
readSensors = false;
}
*pLastMoistureVal = moistureRead();
// nested if: (result outside range (see config.h)) {waterPlant()}
if(respondFlag) {
twiRespond();
-4
View File
@@ -17,10 +17,6 @@ void sensorsInit(void) {
PORTC &= ~sensorMask;
}
void triggerMoistureRead(void) {
readSensors = true;
}
static uint16_t moistureAverage(uint8_t sensorPin) {
uint16_t sum = 0;
for (uint8_t i = 0; i < SENSOR_READINGS; i++) {