Ver código fonte

small safety update

Thomas Buck 3 anos atrás
pai
commit
deaee1ec3f
2 arquivos alterados com 12 adições e 7 exclusões
  1. 6
    3
      include/config.h
  2. 6
    4
      src/Statemachine.cpp

+ 6
- 3
include/config.h Ver arquivo

@@ -29,9 +29,11 @@
29 29
 #define DISPLAY_BACKLIGHT_TIMEOUT (5UL * 60UL * 1000UL)
30 30
 
31 31
 // in seconds
32
-#define MAX_TANK_FILL_TIME 10
32
+#define MAX_TANK_FILL_TIME 30
33 33
 #define AUTO_PUMP_RUNTIME 5
34
-#define MAX_AUTO_PLANT_RUNTIME 15
34
+#define MAX_AUTO_PLANT_RUNTIME (10 * 60)
35
+#define MAX_PUMP_RUNTIME 30
36
+#define MAX_VALVE_RUNTIME (10 * 60)
35 37
 
36 38
 // Sketch version
37 39
 #define FIRMWARE_VERSION "0.2"
@@ -47,7 +49,8 @@
47 49
 #define INVERT_SENSOR_BOTTOM
48 50
 //#define INVERT_SENSOR_TOP
49 51
 
50
-//#define CHECK_SENSORS_VALVE_PUMP_MENU
52
+#define CHECK_SENSORS_VALVE_PUMP_MENU_FULL // be careful when uncommenting this!
53
+//#define CHECK_SENSORS_VALVE_PUMP_MENU_EMPTY
51 54
 
52 55
 #define OWN_I2C_ADDRESS 0x42
53 56
 #define I2C_BUS_SPEED 400000

+ 6
- 4
src/Statemachine.cpp Ver arquivo

@@ -272,7 +272,7 @@ void Statemachine::input(int n) {
272 272
             
273 273
             selected_time = number_input();
274 274
             
275
-            if ((selected_time <= 0) || (selected_time > 120)) {
275
+            if ((selected_time <= 0) || (selected_time > MAX_PUMP_RUNTIME)) {
276 276
                 error_condition = "Invalid time range!";
277 277
                 switch_to(error);
278 278
             } else {
@@ -354,7 +354,7 @@ void Statemachine::input(int n) {
354 354
             
355 355
             selected_time = number_input();
356 356
             
357
-            if ((selected_time <= 0) || (selected_time > 120)) {
357
+            if ((selected_time <= 0) || (selected_time > MAX_VALVE_RUNTIME)) {
358 358
                 error_condition = "Invalid time range!";
359 359
                 switch_to(error);
360 360
             } else {
@@ -436,7 +436,7 @@ void Statemachine::act(void) {
436 436
         }
437 437
     }
438 438
     
439
-#ifdef CHECK_SENSORS_VALVE_PUMP_MENU
439
+#ifdef CHECK_SENSORS_VALVE_PUMP_MENU_FULL
440 440
     if ((state == menu_pumps_run) || ((state == menu_valves_run) && (selected_id == (plants.countPlants() + 1)))) {
441 441
         // check water level state
442 442
         auto wl = plants.getWaterlevel();
@@ -451,7 +451,9 @@ void Statemachine::act(void) {
451 451
             switch_to(error);
452 452
         }
453 453
     }
454
+#endif // CHECK_SENSORS_VALVE_PUMP_MENU_FULL
454 455
     
456
+#ifdef CHECK_SENSORS_VALVE_PUMP_MENU_EMPTY
455 457
     if ((state == menu_valves_run) && (selected_id <= plants.countPlants())) {
456 458
         // check water level state
457 459
         auto wl = plants.getWaterlevel();
@@ -466,7 +468,7 @@ void Statemachine::act(void) {
466 468
             switch_to(error);
467 469
         }
468 470
     }
469
-#endif
471
+#endif // CHECK_SENSORS_VALVE_PUMP_MENU_EMPTY
470 472
     
471 473
     if ((state == auto_fert_run) || (state == auto_tank_run)) {
472 474
         unsigned long runtime = millis() - start_time;

Carregando…
Cancelar
Salvar