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:
@@ -44,7 +44,6 @@ static const int8_t sensorPins[] = {
|
||||
extern volatile bool readSensors;
|
||||
|
||||
void sensorsInit(void);
|
||||
void triggerMoistureRead(void);
|
||||
uint16_t moistureRead(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user