#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; } }