Commit 4fc025e7 authored by 957dd's avatar 957dd

Merge branch 'feature/self_control' into 'master'

优化了一些bug See merge request !77
parents cfddd0e7 338b64fe
#include "main.h" #include "main.h"
int main(){ int main(){
if(mylog_init()!=0){ if(mylog_init()!=0){
my_zlog_error("日志初始化失败,错误代码:%d",mylog_init()); my_zlog_error("日志初始化失败,错误代码:%d",mylog_init());
return -1; return -1;
......
No preview for this file type
...@@ -110,14 +110,14 @@ void self_device_control_task(){ ...@@ -110,14 +110,14 @@ void self_device_control_task(){
} }
static bool g_selfcontrol_task_index_s=true;
/* /*
* @brief 自控线程 * @brief 自控线程
*/ */
void self_device_control_task_function(){ void self_device_control_task_function(){
my_zlog_info("自控线程池循环开始"); my_zlog_info("自控线程池循环开始");
static int s_status =0; static int s_status =0;
while(1){ while(g_selfcontrol_task_index_s){
if(g_self_device_control_switch_index==true){ if(g_self_device_control_switch_index==true){
self_device_control_task(); self_device_control_task();
s_status=1; s_status=1;
...@@ -129,6 +129,7 @@ void self_device_control_task_function(){ ...@@ -129,6 +129,7 @@ void self_device_control_task_function(){
delay_ms(100); delay_ms(100);
} }
} }
free_device_tasks_memory();
my_zlog_info("自控线程池循环终止"); my_zlog_info("自控线程池循环终止");
return ; return ;
} }
...@@ -164,8 +165,9 @@ bool get_self_control_index(){ ...@@ -164,8 +165,9 @@ bool get_self_control_index(){
void self_control_thread_close(){ void self_control_thread_close(){
if(get_self_control_index()==true){ if(get_self_control_index()==true){
my_zlog_info("Destroy the thread of the automatic control device"); my_zlog_info("Destroy the thread of the automatic control device");
free_device_tasks_memory(); g_selfcontrol_task_index_s=false;
thread_pool_destroy(g_self_devicecontrol_task_t); thread_pool_destroy(g_self_devicecontrol_task_t);
return ;
} }
my_zlog_info("The thread of the automatic control device is not opened"); my_zlog_info("The thread of the automatic control device is not opened");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment