diff --git a/cmds/cmd_wifi.c b/cmds/cmd_wifi.c index a88c936..a267dba 100644 --- a/cmds/cmd_wifi.c +++ b/cmds/cmd_wifi.c @@ -141,7 +141,7 @@ static void event_handler(void* arg, esp_event_base_t event_base, static void scan_done_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data) { - ESP_LOGI(WIFITAG, "SCAN DONE event"); + //ESP_LOGI(WIFITAG, "SCAN DONE event"); scan_done = 1; } @@ -459,3 +459,13 @@ void register_wifi(void) ESP_ERROR_CHECK( esp_console_cmd_register(&wifi_scan_cmd)); ESP_ERROR_CHECK( esp_console_cmd_register(&wifi_disconnect_cmd)); } + +void do_wifi_cmd(int argc, char **argv) + { + if(!strcmp(argv[0], "wifiscan")) + wifi_scan(argc, argv); + else if(!strcmp(argv[0], "disconnect")) + wifi_disconnect(argc, argv); + else if(!strcmp(argv[0], "connect")) + wifi_connect(argc, argv); + } diff --git a/cmds/cmd_wifi.h b/cmds/cmd_wifi.h index d9a36f5..dbca002 100644 --- a/cmds/cmd_wifi.h +++ b/cmds/cmd_wifi.h @@ -17,5 +17,6 @@ void register_wifi(void); bool isConnected(void); int wifi_connect(int argc, char **argv); bool wifi_join(const char *ssid, const char *pass, int timeout_ms); +void do_wifi_cmd(int argc, char **argv); #endif diff --git a/tcp/mqtt_ctrl.c b/tcp/mqtt_ctrl.c index 588d0b3..b11d474 100644 --- a/tcp/mqtt_ctrl.c +++ b/tcp/mqtt_ctrl.c @@ -30,6 +30,7 @@ #include "external_defs.h" #include "utils.h" #include "cmd_system.h" +#include "cmd_wifi.h" #include "mqtt_ctrl.h" #if ACTIVE_CONTROLLER == PUMP_CONTROLLER #include "adc_op.h" @@ -189,6 +190,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_ strcpy(argv[i], argv[i + 1]); argc--; do_system_cmd(argc, argv); + do_wifi_cmd(argc, argv); } else if(strcmp(topic, DEVICE_TOPIC_Q) == 0) {