blob: 7e1975a9f07e77ed8d86efcf5d484f3cc72fb6ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include "project.h"
static void cmd_dispatch (char *cmd)
{
printf ("Q received cmd %s\r\n", cmd);
if (!strncmp (cmd, "CH=", 3)) {
ot_override_ch = atoi (cmd + 3);
printf ("Q CH override set to %d\r\n", ot_override_ch);
}
if (!strncmp (cmd, "DHW=", 4)) {
ot_override_dhw = atoi (cmd + 4);
printf ("Q DHW override set to %d\r\n", ot_override_dhw);
}
if (!strcmp (cmd, "PIC")) {
ot_override_dhw = atoi (cmd + 4);
printf ("Q Entering PIC mode, reset to leave\r\n");
pic_passthru();
}
}
void cmd_usart_dispatch (void)
{
static char cmd[16];
static unsigned cmd_ptr;
uint8_t c;
if (ring_read_byte (&rx1_ring, &c))
return;
if ((c == '\n') || (c == '\r')) {
if (cmd_ptr)
cmd_dispatch (cmd);
cmd_ptr = 0;
return;
}
if (cmd_ptr < (sizeof (cmd) - 1)) {
cmd[cmd_ptr++] = c;
cmd[cmd_ptr] = 0;
}
}
|