diff --git a/include/SysConfiguration.h b/include/SysConfiguration.h index 4e87ae1..b54f048 100644 --- a/include/SysConfiguration.h +++ b/include/SysConfiguration.h @@ -238,8 +238,9 @@ typedef struct } modbusSettings; - + cron_timer_t Timers[CONFIG_WEBGUIAPP_CRON_NUMBER]; + bool bIsCRONEnabled; } SYS_CONFIG; diff --git a/src/CommandProcSys.c b/src/CommandProcSys.c index fa67f1d..eca09bd 100644 --- a/src/CommandProcSys.c +++ b/src/CommandProcSys.c @@ -34,7 +34,8 @@ const char *exec_errors[] = { "param COMMAND not found", "object not exists", "command not exists", - "handler not set" + "handler not set", + "param ARGUMENT not found", }; @@ -158,6 +159,8 @@ static int ExecCommandParse(char *cmd) return 2; //ERROR_OBJECT_NOT_PARSED if (!com) return 3; //ERROR_ACTION_NOT_PARSED + if (!arg) + return 7; //ERROR_ACTION_NOT_PARSED for (int idx = 0; idx < CONFIG_WEBGUIAPP_MAX_OBJECTS_NUM; idx++) { diff --git a/src/CronTimers.c b/src/CronTimers.c index a1a05d7..8950342 100644 --- a/src/CronTimers.c +++ b/src/CronTimers.c @@ -20,6 +20,7 @@ */ #include +#include "SysConfiguration.h" #include "esp_log.h" #include "webguiapp.h" #include "string.h" @@ -42,7 +43,8 @@ char* GetCronError() void custom_cron_job_callback(cron_job *job) { - ExecCommand(((cron_timer_t*) job->data)->exec); + if (GetSysConf()->bIsCRONEnabled) + ExecCommand(((cron_timer_t*) job->data)->exec); } const char* check_expr(const char *expr) @@ -96,7 +98,8 @@ static void ExecuteLastAction(obj_struct_t *objarr) if (minimal != -1) { ESP_LOGI(TAG, "Run previous CRON \"%s\" with delta %d", GetSysConf()->Timers[minimal].exec, (int )delta); - ExecCommand(GetSysConf()->Timers[minimal].exec); + if (GetSysConf()->bIsCRONEnabled) + ExecCommand(GetSysConf()->Timers[minimal].exec); } } diff --git a/src/RestApiHandler.c b/src/RestApiHandler.c index deec7df..302e025 100644 --- a/src/RestApiHandler.c +++ b/src/RestApiHandler.c @@ -449,7 +449,9 @@ const rest_var_t SystemVariables[] = { 0, "lat", &funct_lat, VAR_FUNCT, RW, 0, 0 }, { 0, "lon", &funct_lon, VAR_FUNCT, RW, 0, 0 }, - + + { 0, "cronrecs_enab", &SysConfig.bIsCRONEnabled, VAR_BOOL, RW, 0, 1 }, + #if CONFIG_WEBGUIAPP_MQTT_ENABLE { 0, "mqtt_1_enab", &SysConfig.mqttStation[0].Flags1.bIsGlobalEnabled, VAR_BOOL, RW, 0, 1 }, { 0, "mqtt_1_serv", &SysConfig.mqttStation[0].ServerAddr, VAR_STRING, RW, 3, 63 }, diff --git a/src/SysConfiguration.c b/src/SysConfiguration.c index 0533fef..bcfcf74 100644 --- a/src/SysConfiguration.c +++ b/src/SysConfiguration.c @@ -452,6 +452,7 @@ esp_netif_str_to_ip4(CONFIG_WEBGUIAPP_DNS3_ADDRESS_DEFAULT, (esp_ip4_addr_t*) &C strcpy(Conf->Timers[i].exec, "OBJECT,ACTION,ARGUMENTS"); } + Conf->bIsCRONEnabled = true; #ifdef CONFIG_WEBGUIAPP_ASTRO_ENABLE diff --git a/src/WiFiTransport.c b/src/WiFiTransport.c index f10fa73..382162c 100644 --- a/src/WiFiTransport.c +++ b/src/WiFiTransport.c @@ -307,6 +307,8 @@ static void wifi_init_sta(void *pvParameter) memcpy(wifi_config.sta.password, GetSysConf()->wifiSettings.InfSecurityKey, strlen(GetSysConf()->wifiSettings.InfSecurityKey)); + esp_netif_set_hostname(sta_netif, GetSysConf()->NetBIOSName); + ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_start()); @@ -458,6 +460,12 @@ static void wifi_init_apsta(void *pvParameter) strlen(GetSysConf()->wifiSettings.InfSecurityKey)); //END STA MODE CONFIGURATION + ESP_ERROR_CHECK(esp_netif_set_hostname(sta_netif, "test_TEST")); + ESP_ERROR_CHECK(esp_netif_set_hostname(ap_netif, GetSysConf()->NetBIOSName)); + char name[32]; + esp_netif_get_hostname(sta_netif, &name); + ESP_LOGW(TAG, "Net bios name set to %s", name); + ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA)); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &ap_wifi_config)); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &sta_wifi_config));