clean cron configuration structure
This commit is contained in:
parent
712a6121fc
commit
28d21b8a13
|
|
@ -210,9 +210,7 @@ typedef struct
|
|||
} modbusSettings;
|
||||
|
||||
|
||||
cron_timer_t Timers[16];
|
||||
cron_obj_t CronObjects[16];
|
||||
|
||||
cron_timer_t Timers[CONFIG_WEBGUIAPP_CRON_NUMBER];
|
||||
|
||||
} SYS_CONFIG;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,60 +36,8 @@
|
|||
|
||||
#define TAG "CRON_TIMER"
|
||||
|
||||
extern obj_struct_t app_com_obj_arr[];
|
||||
extern obj_struct_t com_obj_arr[];
|
||||
|
||||
const char *cron_actions[] = { "ON", "REBOOT", "TOGGLE", "OFF", "VERYLONG_OPERATION" };
|
||||
const char *cron_objects[] = {
|
||||
"RELAY1",
|
||||
"RELAY2",
|
||||
"RELAY3",
|
||||
"RELAY4",
|
||||
"RELAY5",
|
||||
"RELAY6",
|
||||
"RELAY7",
|
||||
"RELAY8",
|
||||
"SYSTEM" };
|
||||
const char *cron_act_avail[] = {
|
||||
"[0,2,3]",
|
||||
"[0,2,3]",
|
||||
"[0,2,3]",
|
||||
"[0,2,3]",
|
||||
"[0,2,3]",
|
||||
"[0,2,3]",
|
||||
"[0,2,3]",
|
||||
"[0,2,3]",
|
||||
"[1,4]" };
|
||||
|
||||
char* GetCronObjectNameDef(int idx)
|
||||
{
|
||||
if (idx < 0 || idx >= sizeof(cron_objects) / sizeof(char*))
|
||||
return "";
|
||||
return (char*) cron_objects[idx];
|
||||
}
|
||||
|
||||
char* GetCronObjectName(int idx)
|
||||
{
|
||||
if (idx < 0 || idx >= sizeof(cron_objects) / sizeof(char*))
|
||||
return "";
|
||||
return GetSysConf()->CronObjects[idx].objname;
|
||||
}
|
||||
|
||||
char* GetCronActionName(int idx)
|
||||
{
|
||||
if (idx < 0 || idx >= sizeof(cron_actions) / sizeof(char*))
|
||||
return "";
|
||||
return (char*) cron_actions[idx];
|
||||
}
|
||||
|
||||
char* GetCronActAvail(int idx)
|
||||
{
|
||||
if (idx < 0 || idx >= sizeof(cron_act_avail) / sizeof(char*))
|
||||
return "[]";
|
||||
return (char*) cron_act_avail[idx];
|
||||
}
|
||||
|
||||
static cron_job *JobsList[CRON_TIMERS_NUMBER];
|
||||
static cron_job *JobsList[CONFIG_WEBGUIAPP_CRON_NUMBER];
|
||||
static char cron_express_error[CRON_EXPRESS_MAX_LENGTH];
|
||||
|
||||
char* GetCronError()
|
||||
|
|
@ -97,16 +45,6 @@ char* GetCronError()
|
|||
return cron_express_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Handle all actions under all objects
|
||||
* \param obj Index of the object
|
||||
* \param act Index of the action
|
||||
*/
|
||||
void custom_cron_execute(int obj, int act)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void custom_cron_job_callback(cron_job *job)
|
||||
{
|
||||
ExecCommand(((cron_timer_t*) job->data)->exec);
|
||||
|
|
|
|||
|
|
@ -402,19 +402,11 @@ esp_netif_str_to_ip4(CONFIG_WEBGUIAPP_DNS3_ADDRESS_DEFAULT, (esp_ip4_addr_t*) &C
|
|||
Conf->Timers[i].del = true;
|
||||
Conf->Timers[i].enab = false;
|
||||
Conf->Timers[i].prev = false;
|
||||
Conf->Timers[i].obj = 0;
|
||||
Conf->Timers[i].act = 0;
|
||||
strcpy(Conf->Timers[i].name, "Timer Name");
|
||||
strcpy(Conf->Timers[i].cron, "* * * * * *");
|
||||
strcpy(Conf->Timers[i].exec, "OBJECT,ACTION,ARGUMENTS");
|
||||
|
||||
}
|
||||
for (int i = 0; i < 16; i++ )
|
||||
{
|
||||
strcpy(Conf->CronObjects[i].objname, GetCronObjectNameDef(i));
|
||||
Conf->CronObjects[i].idx = i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
esp_err_t ReadNVSSysConfig(SYS_CONFIG *SysConf)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user