diff --git a/firmware/atmega/include/config.h b/firmware/atmega/include/config.h index df086ea..45701a0 100644 --- a/firmware/atmega/include/config.h +++ b/firmware/atmega/include/config.h @@ -14,7 +14,8 @@ //#define MOISTURE_SENSOR_A6 PC6 //#define MOISTURE_SENSOR_A7 PC7 -// You may connect only the number of pumps that actually are needed in the vase +// You may just connect the pumps that actually are needed in the vase +// or define exactly the connected pumps on your system #define PUMP_D3 PD3 #define PUMP_D4 PD4 #define PUMP_D5 PD5 diff --git a/firmware/atmega/include/pump.h b/firmware/atmega/include/pump.h index 74e2dee..05eef60 100644 --- a/firmware/atmega/include/pump.h +++ b/firmware/atmega/include/pump.h @@ -6,3 +6,4 @@ void pumpsInit(void); void pumpsTrigger(uint8_t digital_pins, int16_t milliseconds); +void waterPlant(void); diff --git a/firmware/atmega/source/main.c b/firmware/atmega/source/main.c index a7065e4..8de0e21 100644 --- a/firmware/atmega/source/main.c +++ b/firmware/atmega/source/main.c @@ -7,8 +7,6 @@ #include "moisture.h" #include "pump.h" - - ISR(WDT_vect) { triggerRead(); } @@ -43,7 +41,7 @@ int main(void) { int16_t result = moistureRead(); //espSend(VASE_NUM, result) } - // if(espGet("ask if i need to water plants") == true) {trigger()} + // if(espGet("ask if i need to water plants") == true) {waterPlant()} enterSleep(); } return 0; diff --git a/firmware/atmega/source/pump.c b/firmware/atmega/source/pump.c index 356b5f8..2a9d01c 100644 --- a/firmware/atmega/source/pump.c +++ b/firmware/atmega/source/pump.c @@ -1,6 +1,7 @@ #include #include #include +#include "config.h" void pumpsInit(void) { // Set as input @@ -22,3 +23,8 @@ void triggerPump(int8_t pump_pin, int16_t milliseconds) { // Turn off pump PORTD &= ~(1 << pump_pin); } + +void waterPlant(void) { + //for each pump --> turn em on + //better to have it here as function instead of doing it in main +}