Add delay to let actuator pump water

This commit is contained in:
2025-05-17 14:07:45 +02:00
parent c7abf18736
commit c03e60e56f
+4 -2
View File
@@ -1,6 +1,7 @@
#include <stdint.h> #include <stdint.h>
#include <avr/io.h> #include <avr/io.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <util/delay.h>
#include "pump.h" #include "pump.h"
#include "config.h" #include "config.h"
@@ -10,14 +11,15 @@ void pumpsInit(void) {
actuatorMask |= (1 << actuatorPins[i]); actuatorMask |= (1 << actuatorPins[i]);
} }
DDRD |= actuatorMask; DDRD |= actuatorMask;
//PORTD &= ~(1 << actuatorMask);
} }
void triggerPump(uint8_t pump_pin) { void triggerPump(uint8_t pump_pin) {
// Turn on pump // Turn on pump
PORTD |= (1 << pump_pin); PORTD |= (1 << pump_pin);
// timer for a fixed n milliseconds _delay_ms(500);
// hardcoded for now // Here there could be the issue of the AVR hanging when pump is on
// Turn off pump // Turn off pump
PORTD &= ~(1 << pump_pin); PORTD &= ~(1 << pump_pin);