Merge remote-tracking branch 'gitlab/main' into main
This commit is contained in:
commit
e0faed8d65
|
|
@ -240,6 +240,7 @@ typedef struct
|
||||||
|
|
||||||
|
|
||||||
cron_timer_t Timers[CONFIG_WEBGUIAPP_CRON_NUMBER];
|
cron_timer_t Timers[CONFIG_WEBGUIAPP_CRON_NUMBER];
|
||||||
|
bool bIsCRONEnabled;
|
||||||
|
|
||||||
} SYS_CONFIG;
|
} SYS_CONFIG;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ const char *exec_errors[] = {
|
||||||
"param COMMAND not found",
|
"param COMMAND not found",
|
||||||
"object not exists",
|
"object not exists",
|
||||||
"command 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
|
return 2; //ERROR_OBJECT_NOT_PARSED
|
||||||
if (!com)
|
if (!com)
|
||||||
return 3; //ERROR_ACTION_NOT_PARSED
|
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++)
|
for (int idx = 0; idx < CONFIG_WEBGUIAPP_MAX_OBJECTS_NUM; idx++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <CronTimers.h>
|
#include <CronTimers.h>
|
||||||
|
#include "SysConfiguration.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "webguiapp.h"
|
#include "webguiapp.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
@ -42,6 +43,7 @@ char* GetCronError()
|
||||||
|
|
||||||
void custom_cron_job_callback(cron_job *job)
|
void custom_cron_job_callback(cron_job *job)
|
||||||
{
|
{
|
||||||
|
if (GetSysConf()->bIsCRONEnabled)
|
||||||
ExecCommand(((cron_timer_t*) job->data)->exec);
|
ExecCommand(((cron_timer_t*) job->data)->exec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,6 +98,7 @@ static void ExecuteLastAction(obj_struct_t *objarr)
|
||||||
if (minimal != -1)
|
if (minimal != -1)
|
||||||
{
|
{
|
||||||
ESP_LOGI(TAG, "Run previous CRON \"%s\" with delta %d", GetSysConf()->Timers[minimal].exec, (int )delta);
|
ESP_LOGI(TAG, "Run previous CRON \"%s\" with delta %d", GetSysConf()->Timers[minimal].exec, (int )delta);
|
||||||
|
if (GetSysConf()->bIsCRONEnabled)
|
||||||
ExecCommand(GetSysConf()->Timers[minimal].exec);
|
ExecCommand(GetSysConf()->Timers[minimal].exec);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -450,6 +450,8 @@ const rest_var_t SystemVariables[] =
|
||||||
{ 0, "lat", &funct_lat, VAR_FUNCT, RW, 0, 0 },
|
{ 0, "lat", &funct_lat, VAR_FUNCT, RW, 0, 0 },
|
||||||
{ 0, "lon", &funct_lon, 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
|
#if CONFIG_WEBGUIAPP_MQTT_ENABLE
|
||||||
{ 0, "mqtt_1_enab", &SysConfig.mqttStation[0].Flags1.bIsGlobalEnabled, VAR_BOOL, RW, 0, 1 },
|
{ 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 },
|
{ 0, "mqtt_1_serv", &SysConfig.mqttStation[0].ServerAddr, VAR_STRING, RW, 3, 63 },
|
||||||
|
|
|
||||||
|
|
@ -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");
|
strcpy(Conf->Timers[i].exec, "OBJECT,ACTION,ARGUMENTS");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Conf->bIsCRONEnabled = true;
|
||||||
|
|
||||||
#ifdef CONFIG_WEBGUIAPP_ASTRO_ENABLE
|
#ifdef CONFIG_WEBGUIAPP_ASTRO_ENABLE
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,8 @@ static void wifi_init_sta(void *pvParameter)
|
||||||
memcpy(wifi_config.sta.password, GetSysConf()->wifiSettings.InfSecurityKey,
|
memcpy(wifi_config.sta.password, GetSysConf()->wifiSettings.InfSecurityKey,
|
||||||
strlen(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_mode(WIFI_MODE_STA));
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
|
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
|
||||||
ESP_ERROR_CHECK(esp_wifi_start());
|
ESP_ERROR_CHECK(esp_wifi_start());
|
||||||
|
|
@ -458,6 +460,12 @@ static void wifi_init_apsta(void *pvParameter)
|
||||||
strlen(GetSysConf()->wifiSettings.InfSecurityKey));
|
strlen(GetSysConf()->wifiSettings.InfSecurityKey));
|
||||||
//END STA MODE CONFIGURATION
|
//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_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_AP, &ap_wifi_config));
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &sta_wifi_config));
|
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &sta_wifi_config));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user