Compare commits
6 Commits
897ee0fec2
...
e0faed8d65
| Author | SHA1 | Date | |
|---|---|---|---|
| e0faed8d65 | |||
| 2547be508c | |||
| ca082595d9 | |||
| 60f8299f59 | |||
| 9d7889f52e | |||
|
|
56d568954c |
|
|
@ -238,8 +238,9 @@ typedef struct
|
|||
|
||||
} modbusSettings;
|
||||
|
||||
|
||||
|
||||
cron_timer_t Timers[CONFIG_WEBGUIAPP_CRON_NUMBER];
|
||||
bool bIsCRONEnabled;
|
||||
|
||||
} SYS_CONFIG;
|
||||
|
||||
|
|
|
|||
|
|
@ -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++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
|
||||
#include <CronTimers.h>
|
||||
#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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
src/MQTT.c
10
src/MQTT.c
|
|
@ -196,7 +196,7 @@ mqtt_app_err_t PublicTestMQTT(int idx)
|
|||
{
|
||||
char tmp[10];
|
||||
char resp[256];
|
||||
char JSONMess[1024];
|
||||
char* JSONMess = malloc(1024);
|
||||
struct jWriteControl jwc;
|
||||
jwOpen(&jwc, JSONMess, 1024 - 64, JW_OBJECT, JW_COMPACT);
|
||||
jwObj_object(&jwc, "data");
|
||||
|
|
@ -292,12 +292,16 @@ mqtt_app_err_t PublicTestMQTT(int idx)
|
|||
jwObj_string(&jwc, "signature", (char*) sha_print);
|
||||
}
|
||||
else
|
||||
{
|
||||
free(JSONMess);
|
||||
return ESP_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
jwClose(&jwc);
|
||||
mqtt_app_err_t merr = API_OK;
|
||||
if (SysServiceMQTTSend(JSONMess, strlen(JSONMess), idx) != ESP_OK)
|
||||
merr = API_INTERNAL_ERR;
|
||||
free(JSONMess);
|
||||
return merr;
|
||||
}
|
||||
|
||||
|
|
@ -545,8 +549,8 @@ static void start_mqtt()
|
|||
mqtt_cfg.password = GetSysConf()->mqttStation[i].UserPass;
|
||||
#endif
|
||||
strcpy(tmp, GetSysConf()->mqttStation[i].ClientID);
|
||||
strcat(tmp, "-");
|
||||
strcat(tmp, GetSysConf()->ID);
|
||||
//strcat(tmp, "-");
|
||||
//strcat(tmp, GetSysConf()->ID);
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
mqtt_cfg.credentials.client_id = tmp;
|
||||
mqtt_cfg.network.reconnect_timeout_ms = MQTT_RECONNECT_TIMEOUT * 1000;
|
||||
|
|
|
|||
|
|
@ -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 },
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user