for bob
Dependencies: mbed-STM32F103C8T6_new
Diff: main.cpp
- Revision:
- 10:1dbe0c851c2e
- Parent:
- 9:98b398a0e357
- Child:
- 11:9b630cb10423
--- a/main.cpp Tue May 19 10:15:36 2020 +0000 +++ b/main.cpp Tue May 19 10:44:33 2020 +0000 @@ -569,12 +569,20 @@ debug_uart.write("restore wifi module\r\n",21); wifi_uart.write("restore\r\n", 9); } -#if 0 +#if 1 if(!open_flag&&!close_flag){ if(sensor_cnt>(pre_sensor_cnt+5)){ - if(cur_cnt<5){open_flag = 1;tar_cnt = 90;}else{ + if(cur_cnt<5) + { + cur_cnt = cur_cnt + (sensor_cnt - pre_sensor_cnt); + tar_cnt = 60; + open_flag = 1; + } + else + { + cur_cnt = cur_cnt - (sensor_cnt - pre_sensor_cnt); + tar_cnt = 0; close_flag = 1; - tar_cnt = 0; } } sprintf(len, "main_thread: sensor_cnt = %d. \r\n", sensor_cnt); @@ -584,7 +592,7 @@ pre_sensor_cnt = sensor_cnt; } #endif - wait(3); + wait(1.5); sprintf(len, "main_thread: current cur_cnt is %d\r\n", cur_cnt); debug_uart.write(len, sizeof(len));