|
@@ -39,6 +39,22 @@
|
39
|
39
|
#define CNSL_BUFF_SIZE 1024
|
40
|
40
|
#define CNSL_REPEAT_MS 500
|
41
|
41
|
|
|
42
|
+//#define TEST_VOLCANO_AUTO_CONNECT "xx:xx:xx:xx:xx:xx 1"
|
|
43
|
+
|
|
44
|
+#define VOLCANO_AUTO_CONNECT { \
|
|
45
|
+ ble_scan(BLE_SCAN_OFF); \
|
|
46
|
+ bd_addr_t addr; \
|
|
47
|
+ bd_addr_type_t type; \
|
|
48
|
+ const char *foo = TEST_VOLCANO_AUTO_CONNECT; \
|
|
49
|
+ sscanf(foo, "%02hhX:%02hhX:%02hhX:%02hhX:%02hhX:%02hhX %hhu", \
|
|
50
|
+ &addr[0], &addr[1], &addr[2], &addr[3], \
|
|
51
|
+ &addr[4], &addr[5], &type); \
|
|
52
|
+ ble_connect(addr, type); \
|
|
53
|
+ while (!ble_is_connected()) { \
|
|
54
|
+ sleep_ms(1); \
|
|
55
|
+ } \
|
|
56
|
+}
|
|
57
|
+
|
42
|
58
|
static char cnsl_line_buff[CNSL_BUFF_SIZE + 1];
|
43
|
59
|
static uint32_t cnsl_buff_pos = 0;
|
44
|
60
|
|
|
@@ -197,11 +213,27 @@ static void cnsl_interpret(const char *line) {
|
197
|
213
|
} else if (strcmp(line, "bat") == 0) {
|
198
|
214
|
draw_battery_indicator();
|
199
|
215
|
} else if (strcmp(line, "vrct") == 0) {
|
|
216
|
+#ifdef TEST_VOLCANO_AUTO_CONNECT
|
|
217
|
+ VOLCANO_AUTO_CONNECT
|
|
218
|
+#endif // TEST_VOLCANO_AUTO_CONNECT
|
|
219
|
+
|
200
|
220
|
int16_t r = volcano_get_current_temp();
|
201
|
221
|
println("volcano current temp: %.1f", r / 10.0);
|
|
222
|
+
|
|
223
|
+#ifdef TEST_VOLCANO_AUTO_CONNECT
|
|
224
|
+ ble_disconnect();
|
|
225
|
+#endif // TEST_VOLCANO_AUTO_CONNECT
|
202
|
226
|
} else if (strcmp(line, "vrtt") == 0) {
|
|
227
|
+#ifdef TEST_VOLCANO_AUTO_CONNECT
|
|
228
|
+ VOLCANO_AUTO_CONNECT
|
|
229
|
+#endif // TEST_VOLCANO_AUTO_CONNECT
|
|
230
|
+
|
203
|
231
|
int16_t r = volcano_get_target_temp();
|
204
|
232
|
println("volcano target temp: %.1f", r / 10.0);
|
|
233
|
+
|
|
234
|
+#ifdef TEST_VOLCANO_AUTO_CONNECT
|
|
235
|
+ ble_disconnect();
|
|
236
|
+#endif // TEST_VOLCANO_AUTO_CONNECT
|
205
|
237
|
} else {
|
206
|
238
|
println("unknown command \"%s\"", line);
|
207
|
239
|
}
|