/*! ********************************************************************** * Function: main(void) * * \brief Program entry point * * Include: Local to newmain.c * * Description: stores the current system state and manages all transitions * * Arguments: None * * Returns: None *************************************************************************/ void main() { systemState state = {INIT, UNDEF}; TrackingData target; // configureSerial(); // configureRange(); //configureAD(); initialiseMenu(&state); for (;;) { serviceMenu(); switch (state.current) { case INIT: initialization(&state); break; case SRCH: search(&state); dispSearching(); break; case TRCK: target = track(&state); dispTrack(target); break; case MENU: break; case RAW_RANGE_STATE: range(); dispRawRange(); Delay10KTCYx(255); break; default: //Any other undefined state NEXT_STATE(INIT, state); //Set the next state to be Initialize break; } } }
dword My_IdleHandler(void) { dword currentTickTime = 0; static byte oldMin = 100, oldSec = 0; static byte schIdleHandlerSV = SCH_IDLE_HANDLER_INITIALISE; switch(schIdleHandlerSV) { /*--------------------------------------------------*/ case SCH_IDLE_HANDLER_INITIALISE: FindTapDir(); schMainDetermineChangeDirType(); schFileCreateSettingsFolder(); LoadConfiguration(); LoadLanguage(); CacheLogos(); schMainInitLcnToSvcNumMap(); schDispWindowInitialise(); schEditWindowInitialise(); initialiseMenu(); InitialiseConfigRoutines(); schShowWindowInitialise(); logInitialise(); schMainAlreadyRecordedInitialise(); schMainApiMoveAvailable = FALSE; schMainDebugMoveAvailable = FALSE; #ifndef WIN32 if( FirmwareCallsEnabled == TRUE ) { schMainApiMoveAvailable = fcCheckApiMoveAvailability(); if(schMainApiMoveAvailable == FALSE) { StartTAPExtensions(); schMainDebugMoveAvailable = fcCheckDebugMoveAvailability(); } } #else schMainApiMoveAvailable = TRUE; #endif schIdleHandlerSV = SCH_IDLE_HANDLER_SERVICE; break; /*--------------------------------------------------*/ case SCH_IDLE_HANDLER_SERVICE: currentTickTime = TAP_GetTick(); // only get the current tick time once if ( keyboardWindowShowing ) KeyboardCursorBlink( currentTickTime ); schObtainCurrentTime(); if ( (creditsShowing == FALSE) && (menuShowing == FALSE) && (schEditWindowShowing == FALSE) && (schDispWindowShowing == FALSE) && (schShowWindowShowing == FALSE) ) { schMainService(); if ( (FirmwareCallsEnabled == TRUE) && ( (schMainApiMoveAvailable == TRUE) || (schMainDebugMoveAvailable == TRUE) ) ) { schMoveService(); schKeepService(); } oldMin = 100; } else { if(schShowWindowShowing == TRUE) { schShowService(); } if ( schTimeMin != oldMin ) { oldMin = schTimeMin; if ( ( menuShowing == FALSE ) && ( creditsShowing == FALSE ) ) { UpdateListClock(); } } } if ( ( schTimeSec != oldSec ) && ( schStartUpCounter < 0xFF ) ) { oldSec = schTimeSec; schStartUpCounter++; } break; /*--------------------------------------------------*/ } }