stop run cmd
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
|
||||
#include "chrg_led.h"
|
||||
#include "chrg_thread.h"
|
||||
#include "chrg_roll_sou.h"
|
||||
#include "chrg_eload.h"
|
||||
@@ -10,6 +11,7 @@
|
||||
#define LOG_TAG "chrg.rollsou"
|
||||
#include <rtdbg.h>
|
||||
|
||||
rt_uint8_t sou_run = 1;
|
||||
rt_uint8_t sou_ch = IDX_SOU_CH1;
|
||||
rt_uint8_t sou_pt = MB_R_PART1;
|
||||
|
||||
@@ -37,6 +39,11 @@ void chrg_roll_sou_thread_entry (void *data)
|
||||
chrg_eload_refresh(ID_ELOAD, sou_pt);
|
||||
|
||||
} else { // 轮巡4个通道,每个通道3条读取命令
|
||||
if (0 == sou_run) {
|
||||
rt_thread_mdelay(1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
part = index%(TOTAL_SOU_CHS*TOTAL_MB_R); // [0, 11]
|
||||
idx = part/TOTAL_MB_R; // [0, 3]
|
||||
pt = part%TOTAL_MB_R;
|
||||
@@ -47,6 +54,7 @@ void chrg_roll_sou_thread_entry (void *data)
|
||||
rt_thread_mdelay(10);
|
||||
continue;
|
||||
} else {
|
||||
chrg_led_flashing(IDX_LED3, TIMES_ONE, PULSE_TIME*2, PULSE_TIME*2);
|
||||
if (idx != (rt_uint8_t)pSOU->idx) {
|
||||
pSOU->idx = (eIDX_SOU_CH)idx;
|
||||
chrg_south_switch(pSOU->idx);
|
||||
@@ -83,7 +91,7 @@ void chrg_roll_sou_thread_entry (void *data)
|
||||
}
|
||||
|
||||
rt_thread_mdelay(50); // 间隔 50ms
|
||||
} else if (RT_ETIMEOUT == ret) {
|
||||
} else {
|
||||
rt_mutex_take(pTHR->mutex, RT_WAITING_FOREVER);
|
||||
pSOU->manual = 0;
|
||||
rt_mutex_release(pTHR->mutex);
|
||||
@@ -125,6 +133,27 @@ static int south_send(rt_uint8_t argc, char **argv)
|
||||
|
||||
MSH_CMD_EXPORT(south_send, south send test);
|
||||
|
||||
static int south_run (int argc, char **argv)
|
||||
{
|
||||
if (2 != argc) {
|
||||
rt_kprintf("help : %s start|stop\r\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rt_strcmp(argv[1], "start") == 0) {
|
||||
sou_run = 1;
|
||||
} else if (rt_strcmp(argv[1], "stop") == 0) {
|
||||
sou_run = 0;
|
||||
} else {
|
||||
rt_kprintf("help : %s start|stop\r\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
MSH_CMD_EXPORT(south_run, south auto run);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user