|
|
@ -192,9 +192,9 @@ static void mf_try_autostop() { |
|
|
|
|
|
|
|
static void mf_try_auto_restart() { |
|
|
|
//间歇模式下,设备工作一定时间后,休息一定时间 |
|
|
|
if (systicket_haspassedms(thisDevice.countdonw_start_ticket) / 1000 > // |
|
|
|
(/*设备工作时间:*/thisDevice.countdonw_setting_num * kconst_countdown_step_s + // |
|
|
|
/*设备休息时间*/thisDevice.countdonw_setting_num * kconst_countdown_step_s)) { |
|
|
|
if (systicket_haspassedms(thisDevice.countdonw_start_ticket) / 1000 > // |
|
|
|
(/*设备工作时间:*/ thisDevice.countdonw_setting_num * kconst_countdown_step_s + // |
|
|
|
/*设备休息时间*/ thisDevice.countdonw_setting_num * kconst_countdown_step_s)) { |
|
|
|
mf_set_countdown(thisDevice.countdonw_setting_num); |
|
|
|
startwork(); |
|
|
|
} |
|
|
@ -257,6 +257,19 @@ static void mf_init_all_subdevice_state() { |
|
|
|
port_led_b_set(false); |
|
|
|
} |
|
|
|
|
|
|
|
void WDTInit(void) { |
|
|
|
IWDT_InitStruType x; |
|
|
|
|
|
|
|
x.WDT_Tms = 10000; |
|
|
|
x.WDT_IE = Enable; /* IWDT中断使能 */ |
|
|
|
x.WDT_Rst = Enable; /* IWDT复位使能 */ |
|
|
|
x.WDT_Clock = IWDT_CLOCK_WDT; /* LRC */ |
|
|
|
IWDT_Init(&x); |
|
|
|
|
|
|
|
/* 使能IWDT */ |
|
|
|
IWDT_Enable(); |
|
|
|
} |
|
|
|
|
|
|
|
int main(void) { |
|
|
|
SystemInit(); //配置系统时钟 |
|
|
|
DeviceClockAllEnable(); //打开所有外设时钟 |
|
|
@ -271,6 +284,7 @@ int main(void) { |
|
|
|
printf("= version : %s\n", VERSION); // |
|
|
|
printf("=\n"); // |
|
|
|
|
|
|
|
WDTInit(); |
|
|
|
/*组件初始化*/ |
|
|
|
zkey_init(&key_module); //按键初始化 |
|
|
|
|
|
|
@ -279,6 +293,7 @@ int main(void) { |
|
|
|
* @brief |
|
|
|
* 频率从20k起步,递增50hz,每次等待100ms计算功率 |
|
|
|
*/ |
|
|
|
|
|
|
|
while (true) { |
|
|
|
//按键扫描逻辑 |
|
|
|
DO_IT_EACH_MS(KEY_PERIOD) { zkey_do_loop_in_each_period(NULL); } |
|
|
@ -292,5 +307,8 @@ int main(void) { |
|
|
|
hcis_shcedule(); |
|
|
|
//当前模块逻辑Schedule |
|
|
|
this_module_schedule(); |
|
|
|
|
|
|
|
//喂狗 |
|
|
|
if (0x01 == IWDT_GetFlagStatus()) IWDT_Clear(); |
|
|
|
} |
|
|
|
} |