添加重复执行指定任务的任务

This commit is contained in:
ranchuan
2023-11-20 18:06:03 +08:00
parent be3c644d23
commit fa2509c5af
8 changed files with 112 additions and 4 deletions

View File

@@ -29,6 +29,17 @@
#define PLAN_MAX_TASK 64
#define TASK_PAR_BACK_LEN 10
typedef struct{
CheckerTask_Info_st task_par;
int par_count;
int ret_count;
int rtv_index;// 返回值下标
uint16_t params[10];
}task_par_back;
typedef struct{
CheckerTask_Info_st* task_info_array[PLAN_MAX_TASK];//方案参数结构体指针
@@ -41,6 +52,8 @@ typedef struct{
int task_num;
int scheme_inited;
array_def *data;
task_par_back *task_back_table[TASK_PAR_BACK_LEN];
int task_back_index;
}self_def;
@@ -423,6 +436,48 @@ int elec_check_load_task_param(uint8_t task_index)
memcpy(checker_runcfg.params,checker_runcfg.task_info.params,checker_runcfg.param_count*2);
return 0;
}
// 备份任务运行环境,0成功
int elec_task_env_back(void)
{
self_def *s=&g_self;
task_par_back *b=0;
if(s->task_back_index>=TASK_PAR_BACK_LEN){
return 1;
}
s->task_back_table[s->task_back_index]=calloc(1,sizeof(task_par_back));
b=s->task_back_table[s->task_back_index];
if(b==0){
return 2;
}
b->par_count=checker_runcfg.param_count;
b->ret_count=checker_runcfg.rtv_count;
b->rtv_index=checker_runcfg.rtv_index;
memcpy(&b->task_par, &checker_runcfg.task_info,sizeof(CheckerTask_Info_st));
memcpy(b->params,checker_runcfg.params,checker_runcfg.param_count*2);
s->task_back_index++;
return 0;
}
// 恢复任务运行环境,0成功
int elec_task_env_restore(void)
{
self_def *s=&g_self;
task_par_back *b=0;
if(s->task_back_index<=0){
return 1;
}
b=s->task_back_table[s->task_back_index-1];
checker_runcfg.param_count=b->par_count;
checker_runcfg.rtv_count=b->ret_count;
checker_runcfg.rtv_index=b->rtv_index;
memcpy(&checker_runcfg.task_info,&b->task_par, sizeof(CheckerTask_Info_st));
memcpy(checker_runcfg.params,b->params,checker_runcfg.param_count*2);
free(b);
s->task_back_index--;
return 0;
}
// 根据任务id获取检测函数
CheckerTask elec_get_task_fun(CheckerTask *tasks_fun_table[],uint8_t chip_type,uint8_t taskid)
{