Mercurial > public > ostc4
diff Discovery/Src/base.c @ 896:f29369fff71e Evo_2_23
Development Feature Runtime in Debugview:
Added a compile switch which allows to show the deco, grafix and main loop runtimes in the T7 debug view.
author | ideenmodellierer |
---|---|
date | Thu, 26 Sep 2024 18:32:36 +0200 |
parents | 8d3f3a635397 |
children |
line wrap: on
line diff
--- a/Discovery/Src/base.c Wed Sep 18 14:31:06 2024 +0200 +++ b/Discovery/Src/base.c Thu Sep 26 18:32:36 2024 +0200 @@ -298,6 +298,14 @@ static uint8_t DoHousekeeping = 0; /* trigger to cleanup the frame buffers */ static SButtonLock ButtonLockState = LOCK_OFF; /* Used for button unlock sequence */ +#ifdef T7_DEBUG_RUNTIME +static uint32_t startTimeMainLoop = 0; +static uint32_t startTimeDecoLoop = 0; +static uint32_t startTimeGfxLoop = 0; +static uint32_t timeMainLoop = 0; +static uint32_t timeDecoLoop = 0; +static uint32_t timeGfxLoop = 0; +#endif /* Private function prototypes -----------------------------------------------*/ static void SystemClock_Config(void); @@ -487,6 +495,9 @@ */ while( 1 ) { +#ifdef T7_DEBUG_RUNTIME + startTimeMainLoop = HAL_GetTick(); +#endif if( bootToBootloader ) resetToFirmwareUpdate(); @@ -531,8 +542,13 @@ } check_warning(); updateMiniLiveLogbook(1); - +#ifdef T7_DEBUG_RUNTIME + startTimeGfxLoop = HAL_GetTick(); +#endif RefreshDisplay(); +#ifdef T7_DEBUG_RUNTIME + timeGfxLoop = time_elapsed_ms(startTimeGfxLoop, HAL_GetTick()); +#endif TimeoutControl(); /* exit menus if needed */ #ifdef ENABLE_MOTION_CONTROL @@ -557,6 +573,9 @@ if(stateUsed == stateRealGetPointer()) /* Handle log entries while in dive mode*/ logbook_InitAndWrite(stateUsed); } +#ifdef T7_DEBUG_RUNTIME + timeMainLoop = time_elapsed_ms(startTimeMainLoop, HAL_GetTick()); +#endif } } @@ -1722,7 +1741,13 @@ switch(what) { case CALC_VPM: +#ifdef T7_DEBUG_RUNTIME + startTimeDecoLoop = HAL_GetTick(); +#endif vpm_calc(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.vpm,&stateDeco.decolistVPM, DECOSTOPS); +#ifdef T7_DEBUG_RUNTIME + timeDecoLoop = time_elapsed_ms(startTimeDecoLoop, HAL_GetTick()); +#endif decoLock = DECO_CALC_FINSHED_vpm; return; case CALC_VPM_FUTURE: @@ -1916,6 +1941,21 @@ } RequestModeChange = 0; } + +#ifdef T7_DEBUG_RUNTIME +uint32_t getMainLoopTime() +{ + return timeMainLoop; +} +uint32_t getDecoLoopTime() +{ + return timeDecoLoop; +} +uint32_t getGfxLoopTime() +{ + return timeGfxLoop; +} +#endif // debugging by https://blog.feabhas.com/2013/02/developing-a-generic-hard-fault-handler-for-arm-cortex-m3cortex-m4/ /*