# HG changeset patch # User ideenmodellierer # Date 1727368356 -7200 # Node ID f29369fff71ebac0a848df6fa73f1002ba87ab93 # Parent 94535e672583928831820efbd092af85c66d8814 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. diff -r 94535e672583 -r f29369fff71e Common/Inc/configuration.h --- a/Common/Inc/configuration.h Wed Sep 18 14:31:06 2024 +0200 +++ b/Common/Inc/configuration.h Thu Sep 26 18:32:36 2024 +0200 @@ -46,9 +46,12 @@ /* #define ENABLE_ANALYSE_SAMPLES */ /* Enable to have access to the debug view options (turn on / off via menu instead of compile switch) */ -/* #define HAVE_DEBUG_VIEW */ +#define HAVE_DEBUG_VIEW -/* Enable to have event based warnings being displayed as warning messages when the occure */ +/* Enable to have runtime information displayed in t7 debug view */ +#define T7_DEBUG_RUNTIME + +/* Enable to have event based warnings being displayed as warning messages when they occur */ #define HAVE_DEBUG_WARNINGS /* Enable to have access to the motion control selection menu */ diff -r 94535e672583 -r f29369fff71e Discovery/Inc/base.h --- a/Discovery/Inc/base.h Wed Sep 18 14:31:06 2024 +0200 +++ b/Discovery/Inc/base.h Thu Sep 26 18:32:36 2024 +0200 @@ -123,6 +123,12 @@ void StoreButtonAction(uint8_t action); SButtonLock get_ButtonLock(void); +#ifdef T7_DEBUG_RUNTIME +uint32_t getMainLoopTime(); +uint32_t getDecoLoopTime(); +uint32_t getGfxLoopTime(); +#endif + #endif /* BASE_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff -r 94535e672583 -r f29369fff71e Discovery/Src/base.c --- 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/ /* diff -r 94535e672583 -r f29369fff71e Discovery/Src/t7.c --- a/Discovery/Src/t7.c Wed Sep 18 14:31:06 2024 +0200 +++ b/Discovery/Src/t7.c Thu Sep 26 18:32:36 2024 +0200 @@ -3955,6 +3955,12 @@ t7cY0free.WindowY0 = t7cH.WindowY0 - 5 - 2 * t7cY0free.WindowLineSpacing; t7cY0free.WindowNumberOfTextLines = 3; +#ifdef T7_DEBUG_RUNTIME + textpointer += snprintf(&text[textpointer],50,"Main loop %ld\n\r",getMainLoopTime()); + textpointer += snprintf(&text[textpointer],50,"Grafic loop %ld\n\r",getGfxLoopTime()); + textpointer += snprintf(&text[textpointer],50,"Decoloop %ld\n\r",getDecoLoopTime()); + GFX_write_string(&FontT24, &t7cY0free, text, 1); +#else textpointer += snprintf(&text[textpointer],50,"Ambient [bar]\n\r"); textpointer += snprintf(&text[textpointer],50,"Surface [bar] + salt\n\r"); // textpointer += snprintf(&text[textpointer],50,"Difference [mbar]\n\r"); @@ -3972,6 +3978,7 @@ ,settingsGetPointer()->salinity ,stateUsed->lifeData.counterSecondsShallowDepth); GFX_write_string(&FontT42, &t7cY0free, text, 1); +#endif }