Mercurial > public > ostc4
changeset 1035:5b913cdaa9dc Puls_Integration
Degub message logger:
Added functionality to handle logger view (in case it is enabled via compile switch) like a normal t7 custom view.
| author | Ideenmodellierer |
|---|---|
| date | Sat, 09 Aug 2025 16:55:20 +0200 |
| parents | 195bfbdf961d |
| children | 5865f0aeb438 |
| files | Discovery/Inc/tHome.h Discovery/Inc/tInfo.h Discovery/Inc/tStructure.h Discovery/Inc/text_multilanguage.h Discovery/Src/base.c Discovery/Src/cv_heartbeat.c Discovery/Src/tDebug.c Discovery/Src/tHome.c Discovery/Src/tInfo.c Discovery/Src/tInfoLogger.c Discovery/Src/tMenuEditCustom.c Discovery/Src/text_multilanguage.c |
| diffstat | 12 files changed, 68 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Inc/tHome.h Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Inc/tHome.h Sat Aug 09 16:55:20 2025 +0200 @@ -81,7 +81,10 @@ CVIEW_CcrSummary, CVIEW_Timer, CVIEW_Position, - CVIEW_END /* The ID is used in shift operation => 31 is the max number of supported views */ +#ifdef ENABLE_LOGGER_WINDOW + CVIEW_Logger = 25, /* keep development views at the end of the list to avoid id problems in official releases */ +#endif + CVIEW_END = 32 /* The ID is used in shift operation => 31 is the max number of supported views */ }; enum CUSTOMVIEWS_BF
--- a/Discovery/Inc/tInfo.h Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Inc/tInfo.h Sat Aug 09 16:55:20 2025 +0200 @@ -69,5 +69,6 @@ void tInfo_set_on_off(uint32_t editID, uint8_t int1); void exitInfo(void); void exitInfoToBack(void); +void exitInfoSilent(void); #endif /* TINFO_H */
--- a/Discovery/Inc/tStructure.h Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Inc/tStructure.h Sat Aug 09 16:55:20 2025 +0200 @@ -66,6 +66,7 @@ #define InfoPageCompass 6 #define InfoPageSensor 8 #define InfoPagePreDive 9 +#define InfoPageLogger 10 #define StI _MB(0,1,0,0,0) #define StILOGLIST _MB(0,2,0,0,0)
--- a/Discovery/Inc/text_multilanguage.h Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Inc/text_multilanguage.h Sat Aug 09 16:55:20 2025 +0200 @@ -396,6 +396,7 @@ TXT2BYTE_BUZZER, TXT2BYTE_Pulse, + TXT2BYTE_Logger, TXT2BYTE_END, };
--- a/Discovery/Src/base.c Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Src/base.c Sat Aug 09 16:55:20 2025 +0200 @@ -737,11 +737,13 @@ SStateList status; get_globalStateList(&status); - if((status.base != 0) && (InfoLogger_isUpdated())) +#ifdef ENABLE_LOGGER_WINDOW + if((status.base != 0) && (get_globalState() != StILOGGER) && (InfoLogger_isUpdated())) { openInfo_Logger(); get_globalStateList(&status); } +#endif switch(status.base) { @@ -935,6 +937,8 @@ break; case InfoPagePreDive: sendActionToInfoPreDive(action); break; + case InfoPageLogger: exitInfo(); + break; default: sendActionToInfo(action); break; }
--- a/Discovery/Src/cv_heartbeat.c Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Src/cv_heartbeat.c Sat Aug 09 16:55:20 2025 +0200 @@ -60,7 +60,7 @@ static void parsePulseMeasurement(uint8_t* pData, uint8_t length) { uint8_t rawData[10]; - char text[40]; + char* enptr; uint8_t flags = 0; uint16_t rr = 0; @@ -265,7 +265,6 @@ static readDataType_t readType = BT_READ_NOTHING; - char text[40]; uint8_t data = 0; data = UART_getChar(); @@ -490,8 +489,6 @@ void openEdit_Heartbeat(void) { - SSettings *settings = settingsGetPointer(); - char text[32]; snprintf(text, 32, "\001%c%c", TXT_2BYTE, TXT2BYTE_Pulse); write_topline(text);
--- a/Discovery/Src/tDebug.c Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Src/tDebug.c Sat Aug 09 16:55:20 2025 +0200 @@ -58,9 +58,12 @@ void exitDebugMode(void) { - MX_Bluetooth_PowerOff(); - settingsGetPointer()->debugModeOnStart = 0; - tD_debugModeActive = 0; + if(tD_debugModeActive) + { + MX_Bluetooth_PowerOff(); + settingsGetPointer()->debugModeOnStart = 0; + tD_debugModeActive = 0; + } }
--- a/Discovery/Src/tHome.c Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Src/tHome.c Sat Aug 09 16:55:20 2025 +0200 @@ -59,7 +59,13 @@ static uint16_t tHome_tick_count_field; static uint16_t tHome_tick_count_o2sens; -const uint8_t cv_changelist[] = {CVIEW_Compass, CVIEW_SummaryOfLeftCorner, CVIEW_Tissues, CVIEW_Profile, CVIEW_EADTime, CVIEW_Gaslist, CVIEW_noneOrDebug, CVIEW_Decolist, CVIEW_sensors,CVIEW_sensors_mV, CVIEW_Timer, CVIEW_END}; +const uint8_t cv_changelist[] = {CVIEW_Compass, CVIEW_SummaryOfLeftCorner, CVIEW_Tissues, + CVIEW_Profile, CVIEW_EADTime, CVIEW_Gaslist, CVIEW_noneOrDebug, + CVIEW_Decolist, CVIEW_sensors,CVIEW_sensors_mV, CVIEW_Timer, +#ifdef ENABLE_LOGGER_WINDOW + CVIEW_Logger, +#endif + CVIEW_END}; const uint8_t cv_changelist_BS[] = {CVIEW_T3_Decostop, CVIEW_sensors, CVIEW_Compass, CVIEW_T3_MaxDepth,CVIEW_T3_StopWatch, CVIEW_T3_TTS, CVIEW_T3_GasList, CVIEW_T3_ppO2andGas, CVIEW_noneOrDebug, CVIEW_T3_Navigation, CVIEW_T3_DepthData, CVIEW_T3_DecoTTS, #ifdef ENABLE_T3_PROFILE_VIEW
--- a/Discovery/Src/tInfo.c Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Src/tInfo.c Sat Aug 09 16:55:20 2025 +0200 @@ -228,10 +228,12 @@ infoColor = CLUT_MenuPageGasCC; refreshInfo_PreDive(tIscreen); break; +#ifdef ENABLE_LOGGER_WINDOW case StILOGGER: tIscreen.FBStartAdress = getFrame(14); infoColor = CLUT_MenuPageCvOption; refreshInfo_Logger(tIscreen); break; +#endif default: break; @@ -261,6 +263,11 @@ exitMenuEdit_to_BackMenu(); } +void exitInfoSilent(void) /* no changes were done on info screen => just free buffer */ +{ + releaseFrame(14,tIscreen.FBStartAdress); + updateMenu(); +} void sendActionToInfo(uint8_t sendAction) {
--- a/Discovery/Src/tInfoLogger.c Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Src/tInfoLogger.c Sat Aug 09 16:55:20 2025 +0200 @@ -35,6 +35,7 @@ #include "tInfoLogger.h" #include "tMenuEdit.h" #include "data_exchange_main.h" +#include "t7.h"" #include <string.h> #include <inttypes.h> @@ -54,24 +55,29 @@ void InfoLogger_writeLine(uint8_t* pLine,uint8_t lineLength,uint8_t direction) { +#ifdef ENABLE_LOGGER_WINDOW uint8_t LogIndex = 0; - if(lineLength <= MAX_CHAR_PER_LINE) + if(!t7_customview_disabled(CVIEW_Logger)) { - memset(&lines[lineWriteIndex][0],0, (MAX_CHAR_PER_LINE + LINE_HEADER_BYTES)); - if(direction == LOG_TX_LINE) + if(lineLength <= MAX_CHAR_PER_LINE) { - lines[lineWriteIndex][LogIndex] = '\002'; /* align right */ - LogIndex++; + memset(&lines[lineWriteIndex][0],0, (MAX_CHAR_PER_LINE + LINE_HEADER_BYTES)); + if(direction == LOG_TX_LINE) + { + lines[lineWriteIndex][LogIndex] = '\002'; /* align right */ + LogIndex++; + } + memcpy(&lines[lineWriteIndex][LogIndex],pLine,lineLength); + lineWriteIndex++; + if(lineWriteIndex == MAX_LOGGER_LINES) + { + lineWriteIndex = 0; + } + receivedLinesCount++; } - memcpy(&lines[lineWriteIndex][LogIndex],pLine,lineLength); - lineWriteIndex++; - if(lineWriteIndex == MAX_LOGGER_LINES) - { - lineWriteIndex = 0; - } - receivedLinesCount++; } +#endif } uint8_t InfoLogger_isUpdated() @@ -90,10 +96,6 @@ set_globalState(StILOGGER); loggerUpdateTime = HAL_GetTick(); - - // lineWriteIndex = 0; - // receivedLinesCount = 0; - // memset(lines,0,sizeof(lines)); } void refreshInfo_Logger(GFX_DrawCfgScreen s) @@ -103,11 +105,9 @@ uint8_t displayLine = 0; uint8_t color = CLUT_Font020; - text[0] = '\001'; - text[1] = TXT_PreDive; - text[2] = 0; + sprintf(text,"\001%c%c", TXT_2BYTE, TXT2BYTE_Logger); - tInfo_write_content_simple( 30, 770, ME_Y_LINE_BASE, &FontT48, text, CLUT_MenuPageHardware); + tInfo_write_content_simple( 30, 770, ME_Y_LINE_BASE, &FontT48, text, CLUT_InfoSurface); if(InfoLogger_isUpdated()) @@ -154,31 +154,17 @@ } index++; } - if((time_elapsed_ms(loggerUpdateTime, HAL_GetTick()) > 20000)) + if((time_elapsed_ms(loggerUpdateTime, HAL_GetTick()) > 10000)) { set_globalState(previousGlobalState); /* restore state which was active before log data was received */ + exitInfo(); } } void sendActionToInfoLogger(uint8_t sendAction) { - switch(sendAction) - { - case ACTION_BUTTON_BACK: - // exitInfo(); - exitMenuEdit_to_Menu_with_Menu_Update(); - break; - - case ACTION_BUTTON_ENTER: - break; - case ACTION_BUTTON_NEXT: - break; - case ACTION_TIMEOUT: - case ACTION_MODE_CHANGE: - case ACTION_IDLE_TICK: - case ACTION_IDLE_SECOND: - default: - break; - } +/* TODO: at the moment a generic return to home is used because the logger window could be opened from everywhere => implement context based return from view */ + set_globalState(previousGlobalState); /* restore state which was active before log data was received */ + exitInfoSilent(); }
--- a/Discovery/Src/tMenuEditCustom.c Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Src/tMenuEditCustom.c Sat Aug 09 16:55:20 2025 +0200 @@ -528,6 +528,10 @@ case CVIEW_noneOrDebug: text = TXT2BYTE_DispNoneDbg; break; +#ifdef ENABLE_LOGGER_WINDOW + case CVIEW_Logger: text = TXT2BYTE_Logger; + break; +#endif default: break; }
--- a/Discovery/Src/text_multilanguage.c Thu Aug 07 20:18:52 2025 +0200 +++ b/Discovery/Src/text_multilanguage.c Sat Aug 09 16:55:20 2025 +0200 @@ -2011,7 +2011,11 @@ static uint8_t text_IT_Pulse[] = ""; static uint8_t text_ES_Pulse[] = ""; - +static uint8_t text_EN_Logger[] = "Debug Messages"; +static uint8_t text_DE_Logger[] = "Logger"; +static uint8_t text_FR_Logger[] = ""; +static uint8_t text_IT_Logger[] = ""; +static uint8_t text_ES_Logger[] = ""; /* Lookup Table -------------------------------------------------------------*/ @@ -2328,6 +2332,7 @@ {(uint8_t)TXT2BYTE_Reverse, {text_EN_Reverse, text_DE_Reverse, text_FR_Reverse, text_IT_Reverse, text_ES_Reverse}}, {(uint8_t)TXT2BYTE_Pulse, {text_EN_Pulse, text_DE_Pulse, text_FR_Pulse, text_IT_Pulse, text_ES_Pulse}}, + {(uint8_t)TXT2BYTE_Logger, {text_EN_Logger, text_DE_Logger, text_FR_Logger, text_IT_Logger, text_ES_Logger}}, };
