|
|
@ -19,8 +19,7 @@ |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
static uint32_t CMD_Null(CmdPacket *cmd); |
|
|
|
static uint32_t CMD_Null(CmdPacket *cmd); |
|
|
|
static uint32_t CMD_IsReady(CmdPacket *cmd); |
|
|
|
//static uint32_t CMD_Reset(CmdPacket *cmd);
|
|
|
|
static uint32_t CMD_Reset(CmdPacket *cmd); |
|
|
|
|
|
|
|
static uint32_t CMD_WifiConnect(CmdPacket *cmd); |
|
|
|
static uint32_t CMD_WifiConnect(CmdPacket *cmd); |
|
|
|
static uint32_t CMD_AddCallback(CmdPacket *cmd); |
|
|
|
static uint32_t CMD_AddCallback(CmdPacket *cmd); |
|
|
|
|
|
|
|
|
|
|
@ -30,9 +29,9 @@ static bool wifiCbAdded = false; |
|
|
|
|
|
|
|
|
|
|
|
// Command dispatch table for serial -> ESP commands
|
|
|
|
// Command dispatch table for serial -> ESP commands
|
|
|
|
const CmdList commands[] = { |
|
|
|
const CmdList commands[] = { |
|
|
|
{CMD_NULL, CMD_Null}, |
|
|
|
{CMD_NULL, CMD_Null}, // no-op
|
|
|
|
{CMD_RESET, CMD_Reset}, |
|
|
|
//{CMD_SYNC, CMD_Sync}, // synchronize
|
|
|
|
{CMD_IS_READY, CMD_IsReady}, |
|
|
|
//{CMD_IS_READY, CMD_IsReady},
|
|
|
|
{CMD_WIFI_CONNECT, CMD_WifiConnect}, |
|
|
|
{CMD_WIFI_CONNECT, CMD_WifiConnect}, |
|
|
|
#ifdef MQTT |
|
|
|
#ifdef MQTT |
|
|
|
{CMD_MQTT_SETUP, MQTTCMD_Setup}, |
|
|
|
{CMD_MQTT_SETUP, MQTTCMD_Setup}, |
|
|
@ -55,18 +54,13 @@ const CmdList commands[] = { |
|
|
|
#define MAX_CALLBACKS 12 |
|
|
|
#define MAX_CALLBACKS 12 |
|
|
|
cmdCallback callbacks[MAX_CALLBACKS]; // cleared in CMD_Reset
|
|
|
|
cmdCallback callbacks[MAX_CALLBACKS]; // cleared in CMD_Reset
|
|
|
|
|
|
|
|
|
|
|
|
// Command handler for IsReady (healthcheck) command
|
|
|
|
|
|
|
|
static uint32_t ICACHE_FLASH_ATTR |
|
|
|
|
|
|
|
CMD_IsReady(CmdPacket *cmd) { |
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Command handler for Null command
|
|
|
|
// Command handler for Null command
|
|
|
|
static uint32_t ICACHE_FLASH_ATTR |
|
|
|
static uint32_t ICACHE_FLASH_ATTR |
|
|
|
CMD_Null(CmdPacket *cmd) { |
|
|
|
CMD_Null(CmdPacket *cmd) { |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
// Command handler for Reset command, this was originally to reset the ESP but we don't want to
|
|
|
|
// Command handler for Reset command, this was originally to reset the ESP but we don't want to
|
|
|
|
// do that in esp-link. It is still good to clear any information the ESP has about the attached
|
|
|
|
// do that in esp-link. It is still good to clear any information the ESP has about the attached
|
|
|
|
// uC.
|
|
|
|
// uC.
|
|
|
@ -76,6 +70,7 @@ CMD_Reset(CmdPacket *cmd) { |
|
|
|
os_memset(callbacks, 0, sizeof(callbacks)); |
|
|
|
os_memset(callbacks, 0, sizeof(callbacks)); |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
static uint32_t ICACHE_FLASH_ATTR |
|
|
|
static uint32_t ICACHE_FLASH_ATTR |
|
|
|
CMD_AddCb(char* name, uint32_t cb) { |
|
|
|
CMD_AddCb(char* name, uint32_t cb) { |
|
|
|