|
@@ -7,6 +7,7 @@
|
|
|
#include "string.h"
|
|
|
#include "math.h"
|
|
|
#include "cfg.h"
|
|
|
+#include "IAP.h"
|
|
|
|
|
|
|
|
|
uint16_t g_blinkLedTime; /*RUN LED闪烁频率控制时间*/
|
|
@@ -112,23 +113,35 @@ void timer_callback(void)
|
|
|
g_alg_context.valveclose_delay--;
|
|
|
}
|
|
|
|
|
|
- //read acc data
|
|
|
- if(0 == ADXL312_ReadAcc(&accx, &accy, &accz)){
|
|
|
- cbuffer_pushdata(accx, accy, accz);
|
|
|
- g_readaccfailed_count = 0;
|
|
|
- }else{
|
|
|
- g_readaccfailed_count++;
|
|
|
- if(g_readaccfailed_count > 300){
|
|
|
- //重启,尝度恢复加速度读取
|
|
|
- NVIC_SystemReset();
|
|
|
-
|
|
|
- }else if(g_readaccfailed_count > 3){
|
|
|
- //运行指示灯,闪烁加快
|
|
|
- g_blinkLedTgtTime = BLINK_LED_MINT;
|
|
|
+ //在进行IAP升级时不再读取 加速度数据。
|
|
|
+ if(0 == g_iap_start){
|
|
|
+
|
|
|
+ //read acc data
|
|
|
+ if(0 == ADXL312_ReadAcc(&accx, &accy, &accz)){
|
|
|
+ cbuffer_pushdata(accx, accy, accz);
|
|
|
+ g_readaccfailed_count = 0;
|
|
|
+ //if(BLINK_LED_DFTT != g_blinkLedTgtTime){
|
|
|
+ // g_blinkLedTgtTime = BLINK_LED_DFTT;
|
|
|
+ //}
|
|
|
+ }else{
|
|
|
+ g_readaccfailed_count++;
|
|
|
+ if(g_readaccfailed_count > 300){
|
|
|
+ //重启,尝度恢复加速度读取
|
|
|
+ NVIC_SystemReset();
|
|
|
+ //重置一下传感器
|
|
|
+ //ADXL312_Init();
|
|
|
+
|
|
|
+ }else if(g_readaccfailed_count > 3){
|
|
|
+ //运行指示灯,闪烁加快
|
|
|
+ g_blinkLedTgtTime = BLINK_LED_MINT;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void Process_Init(void)
|