void adl_main(adl_InitType_e initType) { s8 flashHandle = -1; u8 counter = 1; flashHandle = adl_flhSubscribe(PERSISTENT_COUNTER, 1); if (adl_flhExist(PERSISTENT_COUNTER, 0) == 0) { adl_flhWrite(PERSISTENT_COUNTER, 0, sizeof(counter), &counter); } else { adl_flhRead(PERSISTENT_COUNTER, 0, sizeof(counter), &counter); counter++; adl_flhWrite(PERSISTENT_COUNTER, 0, sizeof(counter), &counter); } if (initType == ADL_INIT_REBOOT_FROM_EXCEPTION) { wm_sprintf(ltsc_Temp, "\r\nA Fatal Error Occurred Test is restarting (%d)", counter); adl_atSendResponse(ADL_AT_UNS, ltsc_Temp); } else { wm_sprintf(ltsc_Temp, "\r\nTest modbus starting(%d) in 15s...'%d'", counter, initType); adl_atSendResponse(ADL_AT_UNS, ltsc_Temp); } UART_Init(); // The application will switch the UART to data mode n seconds later, so the user has 15s to enter adl_tmrSubscribe(FALSE, 150, ADL_TMR_TYPE_100MS, MAIN_StartAppTimerHandler); }
/** @brief Calls the adl_flhRead function on the provided handle and number of objects * * @param i_Handle * @param i_Id * @param i_Length * @param o_Data * @return < 0 on failure * @return >= 0 on Success */ s8 FlashRead(char const *const i_Handle, u16 i_Id, u16 i_Length, u8 *const o_Data) { s8 RetCode = 0; RetCode = adl_flhRead((char *)i_Handle, i_Id, i_Length, o_Data); //wm_sprintf(g_traceBuf, "\r\nRetCode from adl_flhRead: %d\r\n", RetCode); //DumpMessage(g_traceBuf); if (RetCode < 0) { DisplayErrorCode("adl_flhRead", __FILE__, __LINE__ - 5, RetCode); } else { TRACE((1, "Successfully read from flash ID: %d", i_Id)); } return RetCode; }