Procházet zdrojové kódy

differing runtimes per pump

Thomas Buck před 2 roky
rodič
revize
b4660ef453
3 změnil soubory, kde provedl 10 přidání a 2 odebrání
  1. 0
    1
      include/config.h
  2. 6
    0
      include/config_pins.h
  3. 4
    1
      src/Statemachine.cpp

+ 0
- 1
include/config.h Zobrazit soubor

@@ -31,7 +31,6 @@
31 31
 
32 32
 // in seconds
33 33
 #define MAX_TANK_FILL_TIME (80)
34
-#define AUTO_PUMP_RUNTIME 4
35 34
 #define AUTO_STIRR_RUNTIME 60
36 35
 #define MAX_AUTO_PLANT_RUNTIME (35 * 60)
37 36
 #define MAX_PUMP_RUNTIME 30

+ 6
- 0
include/config_pins.h Zobrazit soubor

@@ -65,6 +65,9 @@
65 65
 #define PUMP_COUNT 3
66 66
 #define PUMP_PINS 16, 17, 18
67 67
 
68
+// ensure a default for each PUMP_COUNT
69
+#define AUTO_PUMP_RUNTIME { 20, 5, 5 }
70
+
68 71
 // bottom, top
69 72
 #define SWITCH_COUNT 2
70 73
 #define SWITCH_PINS 19, 20
@@ -139,6 +142,9 @@
139 142
 #define PUMP_COUNT 3
140 143
 #define PUMP_PINS 2, 0, 4
141 144
 
145
+// ensure a default for each PUMP_COUNT
146
+#define AUTO_PUMP_RUNTIME { 20, 5, 5 }
147
+
142 148
 // stirrer, locks
143 149
 #define STIRRER_COUNT 1
144 150
 #define LOCK_COUNT 2

+ 4
- 1
src/Statemachine.cpp Zobrazit soubor

@@ -115,6 +115,8 @@ static const char *state_names[] = {
115 115
     stringify(error)
116 116
 };
117 117
 
118
+static int auto_pump_runtime[PUMP_COUNT] = AUTO_PUMP_RUNTIME;
119
+
118 120
 const char *Statemachine::getStateName(void) {
119 121
     return state_names[state];
120 122
 }
@@ -290,12 +292,13 @@ void Statemachine::input(int n) {
290 292
             switch_to((state == auto_mode_a) ? auto_mode_b : auto_mode_a);
291 293
         }
292 294
     } else if ((state == auto_fert_a) || (state == auto_fert_b)) {
295
+        // TODO fertilizer number currently "hardcoded" to 3 in UI
293 296
         if ((n >= 1) && (n <= 3)) {
294 297
             auto wl = plants.getWaterlevel();
295 298
             if ((wl != Plants::full) && (wl != Plants::invalid)) {
296 299
                 plants.startFertilizer(n - 1);
297 300
                 selected_id = n;
298
-                selected_time = AUTO_PUMP_RUNTIME;
301
+                selected_time = auto_pump_runtime[n - 1];
299 302
                 start_time = millis();
300 303
                 switch_to(auto_fert_run);
301 304
             } else if (wl == Plants::full) {

Loading…
Zrušit
Uložit