1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- /*********************************************************************
- * INCLUDES
- */
- #include "ble_comm.h"
- #include "app_flash.h"
- #include "hal_ble_client.h"
- #include "app_safe.h"
- #include "app_flash.h"
- static void app_safe_Process(void)
- {
- static uint8_t cnt =0;
- if(mBackup.ErrorStartFlag >0){
- cnt++;
- if(cnt >=6){//一分钟后清空标志位
- mBackup.ErrorStartFlag =0;
- if(Flash_SaveBackup() != ZONE_OP_SUCCESS)Except_TxError(EXCEPT_Power,"save backup fail");
- DEBUG_LOG("clear mBackup.ErrorStartFlag\n");
- }
- }
-
- static uint8_t Restcnt =0;
- Restcnt++;
- if(slave_isconnect() && mFlash.RestartCnt > 1 && Restcnt>=2){Restcnt =0;
- char buff[40]={0};
- memset(buff,0,sizeof(buff));
- if(1 == mFlash.isHost){
- sprintf(buff,"left shoes restart:%d",mFlash.RestartCnt);
- }else{
- sprintf(buff,"right shoes restart:%d",mFlash.RestartCnt);
- }
- Except_TxError(EXCEPT_Power,(const char*)buff);
- }
- }
- void app_safe_Init(void)
- {
- mFlash.RestartCnt++;
- Process_Start(10000,"app_safe_Process",app_safe_Process);
- }
-
|