Browse Source

rename state_volcano_workflow to state_workflow

Thomas Buck 11 months ago
parent
commit
0d40e4adde
12 changed files with 151 additions and 57 deletions
  1. 1
    1
      CMakeLists.txt
  2. 6
    0
      include/models.h
  3. 1
    1
      include/state.h
  4. 8
    8
      include/state_workflow.h
  5. 10
    0
      include/volcano.h
  6. 5
    5
      src/state.c
  7. 7
    7
      src/state_scan.c
  8. 15
    0
      src/state_settings.c
  9. 8
    8
      src/state_workflow.c
  10. 50
    4
      src/volcano.c
  11. 21
    7
      src/workflow.c
  12. 19
    16
      src/workflow_default.c

+ 1
- 1
CMakeLists.txt View File

83
     src/state_scan.c
83
     src/state_scan.c
84
     src/workflow.c
84
     src/workflow.c
85
     src/menu.c
85
     src/menu.c
86
-    src/state_volcano_workflow.c
86
+    src/state_workflow.c
87
     src/state_volcano_run.c
87
     src/state_volcano_run.c
88
     src/crafty.c
88
     src/crafty.c
89
     src/state_crafty.c
89
     src/state_crafty.c

+ 6
- 0
include/models.h View File

27
     DEV_CRAFTY,
27
     DEV_CRAFTY,
28
 };
28
 };
29
 
29
 
30
+enum unit {
31
+    UNIT_C = 0,
32
+    UNIT_F,
33
+    UNIT_INVALID,
34
+};
35
+
30
 enum known_devices models_filter_name(const char *name);
36
 enum known_devices models_filter_name(const char *name);
31
 int8_t models_get_serial(const uint8_t *data, size_t data_len, char *buff, size_t buff_len);
37
 int8_t models_get_serial(const uint8_t *data, size_t data_len, char *buff, size_t buff_len);
32
 
38
 

+ 1
- 1
include/state.h View File

22
 enum system_state {
22
 enum system_state {
23
     STATE_INIT = 0,
23
     STATE_INIT = 0,
24
     STATE_SCAN,
24
     STATE_SCAN,
25
-    STATE_VOLCANO_WORKFLOW,
25
+    STATE_WORKFLOW,
26
     STATE_VOLCANO_RUN,
26
     STATE_VOLCANO_RUN,
27
     STATE_CRAFTY,
27
     STATE_CRAFTY,
28
     STATE_EDIT_WORKFLOW,
28
     STATE_EDIT_WORKFLOW,

include/state_volcano_workflow.h → include/state_workflow.h View File

1
 /*
1
 /*
2
- * state_volcano_workflow.h
2
+ * state_workflow.h
3
  *
3
  *
4
  * Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
4
  * Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
5
  *
5
  *
16
  * See <http://www.gnu.org/licenses/>.
16
  * See <http://www.gnu.org/licenses/>.
17
  */
17
  */
18
 
18
 
19
-#ifndef __STATE_VOLCANO_WORKFLOW_H__
20
-#define __STATE_VOLCANO_WORKFLOW_H__
19
+#ifndef __STATE_WORKFLOW_H__
20
+#define __STATE_WORKFLOW_H__
21
 
21
 
22
 #include <stdbool.h>
22
 #include <stdbool.h>
23
 
23
 
24
-void state_volcano_wf_edit(bool edit);
24
+void state_wf_edit(bool edit);
25
 
25
 
26
-void state_volcano_wf_enter(void);
27
-void state_volcano_wf_exit(void);
28
-void state_volcano_wf_run(void);
26
+void state_wf_enter(void);
27
+void state_wf_exit(void);
28
+void state_wf_run(void);
29
 
29
 
30
-#endif // __STATE_VOLCANO_WORKFLOW_H__
30
+#endif // __STATE_WORKFLOW_H__

+ 10
- 0
include/volcano.h View File

22
 #include <stdint.h>
22
 #include <stdint.h>
23
 #include <stdbool.h>
23
 #include <stdbool.h>
24
 
24
 
25
+#include "models.h"
26
+
27
+enum volcano_state {
28
+    VOLCANO_STATE_HEATER = (1 << 0),
29
+    VOLCANO_STATE_PUMP = (1 << 1),
30
+};
31
+
25
 // returns < 0 on error
32
 // returns < 0 on error
26
 int8_t volcano_discover_characteristics(void);
33
 int8_t volcano_discover_characteristics(void);
27
 
34
 
36
 int8_t volcano_set_heater_state(bool value);
43
 int8_t volcano_set_heater_state(bool value);
37
 int8_t volcano_set_pump_state(bool value);
44
 int8_t volcano_set_pump_state(bool value);
38
 
45
 
46
+enum unit volcano_get_unit(void);
47
+enum volcano_state volcano_get_state(void);
48
+
39
 #endif // __VOLCANO_H__
49
 #endif // __VOLCANO_H__

+ 5
- 5
src/state.c View File

19
 #include "config.h"
19
 #include "config.h"
20
 #include "log.h"
20
 #include "log.h"
21
 #include "state_scan.h"
21
 #include "state_scan.h"
22
-#include "state_volcano_workflow.h"
22
+#include "state_workflow.h"
23
 #include "state_volcano_run.h"
23
 #include "state_volcano_run.h"
24
 #include "state_crafty.h"
24
 #include "state_crafty.h"
25
 #include "state_edit_workflow.h"
25
 #include "state_edit_workflow.h"
48
         .exit = state_scan_exit,
48
         .exit = state_scan_exit,
49
         .run = state_scan_run,
49
         .run = state_scan_run,
50
     }, {
50
     }, {
51
-        .name = stringify(STATE_VOLCANO_WORKFLOW),
52
-        .enter = state_volcano_wf_enter,
53
-        .exit = state_volcano_wf_exit,
54
-        .run = state_volcano_wf_run,
51
+        .name = stringify(STATE_WORKFLOW),
52
+        .enter = state_wf_enter,
53
+        .exit = state_wf_exit,
54
+        .run = state_wf_run,
55
     }, {
55
     }, {
56
         .name = stringify(STATE_VOLCANO_RUN),
56
         .name = stringify(STATE_VOLCANO_RUN),
57
         .enter = state_volcano_run_enter,
57
         .enter = state_volcano_run_enter,

+ 7
- 7
src/state_scan.c View File

26
 #include "models.h"
26
 #include "models.h"
27
 #include "menu.h"
27
 #include "menu.h"
28
 #include "state.h"
28
 #include "state.h"
29
-#include "state_volcano_workflow.h"
29
+#include "state_workflow.h"
30
 #include "state_volcano_run.h"
30
 #include "state_volcano_run.h"
31
 #include "state_crafty.h"
31
 #include "state_crafty.h"
32
 #include "state_scan.h"
32
 #include "state_scan.h"
50
         if (devs++ == selection) {
50
         if (devs++ == selection) {
51
             if (dev == DEV_VOLCANO) {
51
             if (dev == DEV_VOLCANO) {
52
                 state_volcano_run_target(results[i].addr, results[i].type);
52
                 state_volcano_run_target(results[i].addr, results[i].type);
53
-                state_volcano_wf_edit(false);
54
-                state_switch(STATE_VOLCANO_WORKFLOW);
53
+                state_wf_edit(false);
54
+                state_switch(STATE_WORKFLOW);
55
             } else if (dev == DEV_CRAFTY) {
55
             } else if (dev == DEV_CRAFTY) {
56
                 state_crafty_target(results[i].addr, results[i].type);
56
                 state_crafty_target(results[i].addr, results[i].type);
57
                 state_switch(STATE_CRAFTY);
57
                 state_switch(STATE_CRAFTY);
70
 static void edit_cb(int selection) {
70
 static void edit_cb(int selection) {
71
     UNUSED(selection);
71
     UNUSED(selection);
72
 
72
 
73
-    state_volcano_wf_edit(true);
74
-    state_switch(STATE_VOLCANO_WORKFLOW);
73
+    state_wf_edit(true);
74
+    state_switch(STATE_WORKFLOW);
75
 }
75
 }
76
 
76
 
77
 void state_scan_enter(void) {
77
 void state_scan_enter(void) {
180
         if ((now - auto_connect_time) >= VOLCANO_AUTO_CONNECT_TIMEOUT_MS) {
180
         if ((now - auto_connect_time) >= VOLCANO_AUTO_CONNECT_TIMEOUT_MS) {
181
             state_volcano_run_target(results[auto_connect_idx].addr,
181
             state_volcano_run_target(results[auto_connect_idx].addr,
182
                                      results[auto_connect_idx].type);
182
                                      results[auto_connect_idx].type);
183
-            state_volcano_wf_edit(false);
184
-            state_switch(STATE_VOLCANO_WORKFLOW);
183
+            state_wf_edit(false);
184
+            state_switch(STATE_WORKFLOW);
185
 
185
 
186
             auto_connect_time = 0;
186
             auto_connect_time = 0;
187
         }
187
         }

+ 15
- 0
src/state_settings.c View File

22
 #include "config.h"
22
 #include "config.h"
23
 #include "log.h"
23
 #include "log.h"
24
 #include "menu.h"
24
 #include "menu.h"
25
+#include "mem.h"
25
 #include "state.h"
26
 #include "state.h"
26
 #include "state_settings.h"
27
 #include "state_settings.h"
27
 
28
 
29
     switch (selection) {
30
     switch (selection) {
30
     case 0:
31
     case 0:
31
         // Auto Connect
32
         // Auto Connect
33
+        break;
32
 
34
 
35
+    case 1:
36
+        // Brightness
37
+        break;
38
+
39
+    case 2:
40
+        // Workflows
41
+        break;
42
+
43
+    case 3:
44
+        // Reset
45
+        mem_load_defaults();
46
+        break;
33
     }
47
     }
34
 }
48
 }
35
 
49
 
52
     ADD_STATIC_ELEMENT("Auto Connect");
66
     ADD_STATIC_ELEMENT("Auto Connect");
53
     ADD_STATIC_ELEMENT("Brightness");
67
     ADD_STATIC_ELEMENT("Brightness");
54
     ADD_STATIC_ELEMENT("Workflows");
68
     ADD_STATIC_ELEMENT("Workflows");
69
+    ADD_STATIC_ELEMENT("Reset");
55
 
70
 
56
     if (menu->selection < 0) {
71
     if (menu->selection < 0) {
57
         menu->selection = 0;
72
         menu->selection = 0;

src/state_volcano_workflow.c → src/state_workflow.c View File

1
 /*
1
 /*
2
- * state_volcano_workflow.c
2
+ * state_workflow.c
3
  *
3
  *
4
  * Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
4
  * Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
5
  *
5
  *
27
 #include "state.h"
27
 #include "state.h"
28
 #include "state_volcano_run.h"
28
 #include "state_volcano_run.h"
29
 #include "state_edit_workflow.h"
29
 #include "state_edit_workflow.h"
30
-#include "state_volcano_workflow.h"
30
+#include "state_workflow.h"
31
 
31
 
32
 static bool edit_mode = false;
32
 static bool edit_mode = false;
33
 
33
 
71
     state_switch(STATE_SCAN);
71
     state_switch(STATE_SCAN);
72
 }
72
 }
73
 
73
 
74
-void state_volcano_wf_edit(bool edit) {
74
+void state_wf_edit(bool edit) {
75
     edit_mode = edit;
75
     edit_mode = edit;
76
 }
76
 }
77
 
77
 
78
-void state_volcano_wf_enter(void) {
78
+void state_wf_enter(void) {
79
     if (edit_mode) {
79
     if (edit_mode) {
80
         menu_init(enter_cb, lower_cb, upper_cb, exit_cb);
80
         menu_init(enter_cb, lower_cb, upper_cb, exit_cb);
81
     } else {
81
     } else {
87
 #endif // VOLCANO_AUTO_CONNECT_TIMEOUT_MS
87
 #endif // VOLCANO_AUTO_CONNECT_TIMEOUT_MS
88
 }
88
 }
89
 
89
 
90
-void state_volcano_wf_exit(void) {
90
+void state_wf_exit(void) {
91
     menu_deinit();
91
     menu_deinit();
92
 }
92
 }
93
 
93
 
103
 
103
 
104
         if (i == menu->selection) {
104
         if (i == menu->selection) {
105
 #ifdef VOLCANO_AUTO_CONNECT_TIMEOUT_MS
105
 #ifdef VOLCANO_AUTO_CONNECT_TIMEOUT_MS
106
-            if ((auto_connect_time != 0) && (!menu_got_input)) {
106
+            if ((auto_connect_time != 0) && (!menu_got_input) && (!edit_mode)) {
107
                 uint32_t now = to_ms_since_boot(get_absolute_time());
107
                 uint32_t now = to_ms_since_boot(get_absolute_time());
108
                 uint32_t diff = now - auto_connect_time;
108
                 uint32_t diff = now - auto_connect_time;
109
                 pos += snprintf(menu->buff + pos, MENU_MAX_LEN - pos,
109
                 pos += snprintf(menu->buff + pos, MENU_MAX_LEN - pos,
132
     }
132
     }
133
 }
133
 }
134
 
134
 
135
-void state_volcano_wf_run(void) {
135
+void state_wf_run(void) {
136
     menu_run(draw, false);
136
     menu_run(draw, false);
137
 
137
 
138
 #ifdef VOLCANO_AUTO_CONNECT_TIMEOUT_MS
138
 #ifdef VOLCANO_AUTO_CONNECT_TIMEOUT_MS
139
-    if ((auto_connect_time != 0) && (!menu_got_input)) {
139
+    if ((auto_connect_time != 0) && (!menu_got_input) && (!edit_mode)) {
140
         uint32_t now = to_ms_since_boot(get_absolute_time());
140
         uint32_t now = to_ms_since_boot(get_absolute_time());
141
         if ((now - auto_connect_time) >= VOLCANO_AUTO_CONNECT_TIMEOUT_MS) {
141
         if ((now - auto_connect_time) >= VOLCANO_AUTO_CONNECT_TIMEOUT_MS) {
142
             state_volcano_run_index(0);
142
             state_volcano_run_index(0);

+ 50
- 4
src/volcano.c View File

21
 #include "ble.h"
21
 #include "ble.h"
22
 #include "volcano.h"
22
 #include "volcano.h"
23
 
23
 
24
-// Volcano UUIDs are always the same, except for the 4th byte
24
+#define UUID_SRVC_1       0x10
25
+#define UUID_GET_STATE    0x0C
26
+#define UUID_GET_UNIT     0x0D
27
+
28
+#define UUID_SRVC_2       0x11
25
 #define UUID_WRITE_SRVC   0x00
29
 #define UUID_WRITE_SRVC   0x00
26
 #define UUID_CURRENT_TEMP 0x01
30
 #define UUID_CURRENT_TEMP 0x01
27
 #define UUID_TARGET_TEMP  0x03
31
 #define UUID_TARGET_TEMP  0x03
30
 #define UUID_PUMP_ON      0x13
34
 #define UUID_PUMP_ON      0x13
31
 #define UUID_PUMP_OFF     0x14
35
 #define UUID_PUMP_OFF     0x14
32
 
36
 
33
-// "101100xx-5354-4f52-5a26-4249434b454c"
37
+// "10xx00xx-5354-4f52-5a26-4249434b454c"
34
 static uint8_t uuid_base[16] = {
38
 static uint8_t uuid_base[16] = {
35
-    0x10, 0x11, 0x00, 0xFF, 0x53, 0x54, 0x4f, 0x52,
39
+    0x10, 0xFF, 0x00, 0xFF, 0x53, 0x54, 0x4f, 0x52,
36
     0x5a, 0x26, 0x42, 0x49, 0x43, 0x4b, 0x45, 0x4c,
40
     0x5a, 0x26, 0x42, 0x49, 0x43, 0x4b, 0x45, 0x4c,
37
 };
41
 };
38
 static uint8_t uuid_base2[16] = {
42
 static uint8_t uuid_base2[16] = {
39
-    0x10, 0x11, 0x00, 0xFF, 0x53, 0x54, 0x4f, 0x52,
43
+    0x10, 0xFF, 0x00, 0xFF, 0x53, 0x54, 0x4f, 0x52,
40
     0x5a, 0x26, 0x42, 0x49, 0x43, 0x4b, 0x45, 0x4c,
44
     0x5a, 0x26, 0x42, 0x49, 0x43, 0x4b, 0x45, 0x4c,
41
 };
45
 };
42
 
46
 
43
 int8_t volcano_discover_characteristics(void) {
47
 int8_t volcano_discover_characteristics(void) {
48
+    uuid_base[1] = UUID_SRVC_2;
49
+    uuid_base2[1] = UUID_SRVC_2;
50
+
44
     uuid_base[3] = UUID_WRITE_SRVC;
51
     uuid_base[3] = UUID_WRITE_SRVC;
45
     int8_t r;
52
     int8_t r;
46
 
53
 
78
 }
85
 }
79
 
86
 
80
 int16_t volcano_get_current_temp(void) {
87
 int16_t volcano_get_current_temp(void) {
88
+    uuid_base[1] = UUID_SRVC_2;
81
     uuid_base[3] = UUID_CURRENT_TEMP;
89
     uuid_base[3] = UUID_CURRENT_TEMP;
82
 
90
 
83
     uint8_t buff[4];
91
     uint8_t buff[4];
106
 }
114
 }
107
 
115
 
108
 int8_t volcano_set_target_temp(uint16_t value) {
116
 int8_t volcano_set_target_temp(uint16_t value) {
117
+    uuid_base[1] = UUID_SRVC_2;
118
+    uuid_base2[1] = UUID_SRVC_2;
109
     uuid_base[3] = UUID_WRITE_SRVC;
119
     uuid_base[3] = UUID_WRITE_SRVC;
110
     uuid_base2[3] = UUID_TARGET_TEMP;
120
     uuid_base2[3] = UUID_TARGET_TEMP;
111
 
121
 
121
 }
131
 }
122
 
132
 
123
 int8_t volcano_set_heater_state(bool value) {
133
 int8_t volcano_set_heater_state(bool value) {
134
+    uuid_base[1] = UUID_SRVC_2;
135
+    uuid_base2[1] = UUID_SRVC_2;
124
     uuid_base[3] = UUID_WRITE_SRVC;
136
     uuid_base[3] = UUID_WRITE_SRVC;
125
 
137
 
126
     if (value) {
138
     if (value) {
138
 }
150
 }
139
 
151
 
140
 int8_t volcano_set_pump_state(bool value) {
152
 int8_t volcano_set_pump_state(bool value) {
153
+    uuid_base[1] = UUID_SRVC_2;
154
+    uuid_base2[1] = UUID_SRVC_2;
141
     uuid_base[3] = UUID_WRITE_SRVC;
155
     uuid_base[3] = UUID_WRITE_SRVC;
142
 
156
 
143
     if (value) {
157
     if (value) {
153
     }
167
     }
154
     return r;
168
     return r;
155
 }
169
 }
170
+
171
+enum unit volcano_get_unit(void) {
172
+    uuid_base[1] = UUID_SRVC_1;
173
+    uuid_base[3] = UUID_GET_UNIT;
174
+
175
+    uint8_t buff[4];
176
+    int32_t r = ble_read(uuid_base, buff, sizeof(buff));
177
+    if (r != sizeof(buff)) {
178
+        debug("ble_read unexpected value %ld", r);
179
+        return UNIT_INVALID;
180
+    }
181
+
182
+    uint32_t *v = (uint32_t *)buff;
183
+    return (*v & 0x200) ? UNIT_F : UNIT_C;
184
+}
185
+
186
+enum volcano_state volcano_get_state(void) {
187
+    uuid_base[1] = UUID_SRVC_1;
188
+    uuid_base[3] = UUID_GET_STATE;
189
+
190
+    uint8_t buff[4];
191
+    int32_t r = ble_read(uuid_base, buff, sizeof(buff));
192
+    if (r != sizeof(buff)) {
193
+        debug("ble_read unexpected value %ld", r);
194
+        return 0xFF;
195
+    }
196
+
197
+    uint32_t *v = (uint32_t *)buff;
198
+    uint32_t heater = (*v & 0x0020);
199
+    uint32_t pump = (*v & 0x2000);
200
+    return (heater ? VOLCANO_STATE_HEATER : 0) | (pump ? VOLCANO_STATE_PUMP : 0);
201
+}

+ 21
- 7
src/workflow.c View File

16
  * See <http://www.gnu.org/licenses/>.
16
  * See <http://www.gnu.org/licenses/>.
17
  */
17
  */
18
 
18
 
19
+#define WF_CONFIRM_WRITES
20
+
19
 #include <stdio.h>
21
 #include <stdio.h>
20
 
22
 
21
 #include "config.h"
23
 #include "config.h"
24
 #include "volcano.h"
26
 #include "volcano.h"
25
 #include "workflow.h"
27
 #include "workflow.h"
26
 
28
 
29
+#ifdef WF_CONFIRM_WRITES
30
+#define DO_WHILE(x, y) \
31
+    do {               \
32
+        x;             \
33
+    } while (y)
34
+#else // WF_CONFIRM_WRITES
35
+#define DO_WHILE(x, y) x
36
+#endif // WF_CONFIRM_WRITES
37
+
27
 static enum wf_status status = WF_IDLE;
38
 static enum wf_status status = WF_IDLE;
28
 static uint16_t wf_i = 0;
39
 static uint16_t wf_i = 0;
29
 static uint16_t step = 0;
40
 static uint16_t step = 0;
37
     case OP_WAIT_TEMPERATURE:
48
     case OP_WAIT_TEMPERATURE:
38
         debug("workflow temp %.1f C", mem_data()->wf[wf_i].steps[step].val / 10.0);
49
         debug("workflow temp %.1f C", mem_data()->wf[wf_i].steps[step].val / 10.0);
39
         start_val = volcano_get_current_temp();
50
         start_val = volcano_get_current_temp();
40
-        do {
41
-            volcano_set_target_temp(mem_data()->wf[wf_i].steps[step].val);
42
-        } while (volcano_get_target_temp() != mem_data()->wf[wf_i].steps[step].val);
51
+        DO_WHILE(volcano_set_target_temp(mem_data()->wf[wf_i].steps[step].val),
52
+                 volcano_get_target_temp() != mem_data()->wf[wf_i].steps[step].val);
43
         break;
53
         break;
44
 
54
 
45
     case OP_PUMP_TIME:
55
     case OP_PUMP_TIME:
46
-        volcano_set_pump_state(true);
56
+        DO_WHILE(volcano_set_pump_state(true),
57
+                 !(volcano_get_state() & VOLCANO_STATE_PUMP));
47
         start_t = to_ms_since_boot(get_absolute_time());
58
         start_t = to_ms_since_boot(get_absolute_time());
48
         start_val = 0;
59
         start_val = 0;
49
         debug("workflow pump %.3f s", mem_data()->wf[wf_i].steps[step].val / 1000.0);
60
         debug("workflow pump %.3f s", mem_data()->wf[wf_i].steps[step].val / 1000.0);
204
      * this means we heat for some seconds before changing the setpoint.
215
      * this means we heat for some seconds before changing the setpoint.
205
      * should not be a problem in practice.
216
      * should not be a problem in practice.
206
      */
217
      */
207
-    volcano_set_heater_state(true);
218
+    DO_WHILE(volcano_set_heater_state(true),
219
+             !(volcano_get_state() & VOLCANO_STATE_HEATER));
208
     volcano_discover_characteristics();
220
     volcano_discover_characteristics();
209
 
221
 
210
     do_step();
222
     do_step();
251
 
263
 
252
     if (done) {
264
     if (done) {
253
         if (mem_data()->wf[wf_i].steps[step].op == OP_PUMP_TIME) {
265
         if (mem_data()->wf[wf_i].steps[step].op == OP_PUMP_TIME) {
254
-            volcano_set_pump_state(false);
266
+            DO_WHILE(volcano_set_pump_state(false),
267
+                     volcano_get_state() & VOLCANO_STATE_PUMP);
255
         }
268
         }
256
 
269
 
257
         step++;
270
         step++;
258
         if (step >= mem_data()->wf[wf_i].count) {
271
         if (step >= mem_data()->wf[wf_i].count) {
259
             status = WF_IDLE;
272
             status = WF_IDLE;
260
-            volcano_set_heater_state(false);
273
+            DO_WHILE(volcano_set_heater_state(false),
274
+                     volcano_get_state() & VOLCANO_STATE_HEATER);
261
             debug("workflow finished");
275
             debug("workflow finished");
262
         } else {
276
         } else {
263
             do_step();
277
             do_step();

+ 19
- 16
src/workflow_default.c View File

23
     { .op = OP_WAIT_TIME, .val = 1000 }, \
23
     { .op = OP_WAIT_TIME, .val = 1000 }, \
24
     { .op = OP_PUMP_TIME, .val = 1000 }
24
     { .op = OP_PUMP_TIME, .val = 1000 }
25
 
25
 
26
+#define NOTIFICATIONS NOTIFY, NOTIFY
27
+#define NOTIFICATIONS_LENGTH (2 * 2)
28
+
26
 const uint16_t wf_default_count = 5;
29
 const uint16_t wf_default_count = 5;
27
 
30
 
28
 const struct workflow wf_default_data[] = {
31
 const struct workflow wf_default_data[] = {
29
     {
32
     {
30
-        .name = "XXL",
33
+        .name = "Default",
31
         .author = "xythobuz",
34
         .author = "xythobuz",
32
         .steps = {
35
         .steps = {
33
             { .op = OP_WAIT_TEMPERATURE, .val = 1850 },
36
             { .op = OP_WAIT_TEMPERATURE, .val = 1850 },
34
             { .op = OP_WAIT_TIME, .val = 10000 },
37
             { .op = OP_WAIT_TIME, .val = 10000 },
35
-            { .op = OP_PUMP_TIME, .val = 8000 },
38
+            { .op = OP_PUMP_TIME, .val = 5000 },
36
 
39
 
37
             { .op = OP_WAIT_TEMPERATURE, .val = 1950 },
40
             { .op = OP_WAIT_TEMPERATURE, .val = 1950 },
38
             { .op = OP_WAIT_TIME, .val = 5000 },
41
             { .op = OP_WAIT_TIME, .val = 5000 },
39
-            { .op = OP_PUMP_TIME, .val = 25000 },
42
+            { .op = OP_PUMP_TIME, .val = 20000 },
40
 
43
 
41
             { .op = OP_WAIT_TEMPERATURE, .val = 2050 },
44
             { .op = OP_WAIT_TEMPERATURE, .val = 2050 },
42
             { .op = OP_WAIT_TIME, .val = 5000 },
45
             { .op = OP_WAIT_TIME, .val = 5000 },
43
-            { .op = OP_PUMP_TIME, .val = 25000 },
46
+            { .op = OP_PUMP_TIME, .val = 20000 },
44
 
47
 
45
-            NOTIFY, NOTIFY, NOTIFY, NOTIFY,
48
+            NOTIFICATIONS,
46
 
49
 
47
             { .op = OP_SET_TEMPERATURE, .val = 1900 },
50
             { .op = OP_SET_TEMPERATURE, .val = 1900 },
48
         },
51
         },
49
-        .count = 18,
52
+        .count = 10 + NOTIFICATIONS_LENGTH,
50
     }, {
53
     }, {
51
-        .name = "Default",
54
+        .name = "XXL",
52
         .author = "xythobuz",
55
         .author = "xythobuz",
53
         .steps = {
56
         .steps = {
54
             { .op = OP_WAIT_TEMPERATURE, .val = 1850 },
57
             { .op = OP_WAIT_TEMPERATURE, .val = 1850 },
55
             { .op = OP_WAIT_TIME, .val = 10000 },
58
             { .op = OP_WAIT_TIME, .val = 10000 },
56
-            { .op = OP_PUMP_TIME, .val = 5000 },
59
+            { .op = OP_PUMP_TIME, .val = 8000 },
57
 
60
 
58
             { .op = OP_WAIT_TEMPERATURE, .val = 1950 },
61
             { .op = OP_WAIT_TEMPERATURE, .val = 1950 },
59
             { .op = OP_WAIT_TIME, .val = 5000 },
62
             { .op = OP_WAIT_TIME, .val = 5000 },
60
-            { .op = OP_PUMP_TIME, .val = 20000 },
63
+            { .op = OP_PUMP_TIME, .val = 25000 },
61
 
64
 
62
             { .op = OP_WAIT_TEMPERATURE, .val = 2050 },
65
             { .op = OP_WAIT_TEMPERATURE, .val = 2050 },
63
             { .op = OP_WAIT_TIME, .val = 5000 },
66
             { .op = OP_WAIT_TIME, .val = 5000 },
64
-            { .op = OP_PUMP_TIME, .val = 20000 },
67
+            { .op = OP_PUMP_TIME, .val = 25000 },
65
 
68
 
66
-            NOTIFY, NOTIFY, NOTIFY, NOTIFY,
69
+            NOTIFICATIONS,
67
 
70
 
68
             { .op = OP_SET_TEMPERATURE, .val = 1900 },
71
             { .op = OP_SET_TEMPERATURE, .val = 1900 },
69
         },
72
         },
70
-        .count = 18,
73
+        .count = 10 + NOTIFICATIONS_LENGTH,
71
     }, {
74
     }, {
72
         .name = "Vorbi",
75
         .name = "Vorbi",
73
         .author = "Rinor",
76
         .author = "Rinor",
105
             { .op = OP_WAIT_TIME, .val = 5000 },
108
             { .op = OP_WAIT_TIME, .val = 5000 },
106
             { .op = OP_PUMP_TIME, .val = 20000 },
109
             { .op = OP_PUMP_TIME, .val = 20000 },
107
 
110
 
108
-            NOTIFY, NOTIFY, NOTIFY, NOTIFY,
111
+            NOTIFICATIONS,
109
 
112
 
110
             { .op = OP_SET_TEMPERATURE, .val = 1900 },
113
             { .op = OP_SET_TEMPERATURE, .val = 1900 },
111
         },
114
         },
112
-        .count = 18,
115
+        .count = 10 + NOTIFICATIONS_LENGTH,
113
     }, {
116
     }, {
114
         .name = "Hotty",
117
         .name = "Hotty",
115
         .author = "xythobuz",
118
         .author = "xythobuz",
126
             { .op = OP_WAIT_TIME, .val = 5000 },
129
             { .op = OP_WAIT_TIME, .val = 5000 },
127
             { .op = OP_PUMP_TIME, .val = 20000 },
130
             { .op = OP_PUMP_TIME, .val = 20000 },
128
 
131
 
129
-            NOTIFY, NOTIFY, NOTIFY, NOTIFY,
132
+            NOTIFICATIONS,
130
 
133
 
131
             { .op = OP_SET_TEMPERATURE, .val = 1900 },
134
             { .op = OP_SET_TEMPERATURE, .val = 1900 },
132
         },
135
         },
133
-        .count = 18,
136
+        .count = 10 + NOTIFICATIONS_LENGTH,
134
     },
137
     },
135
 };
138
 };

Loading…
Cancel
Save