# HG changeset patch # User heinrichsweikamp # Date 1552232395 0 # Node ID 4b5b7a40e594eccf2687f7dc37667697dd872508 # Parent e9cce686fe417d8eb3e0484d691f9a2608fad235# Parent 5ca88855da8782080dc3e854fd19e652134f32b9 Merged in janlmulder/ostc4/cleanup-1 (pull request #2) Bugfix: highlight the menu underline correctly on selected state (and trivial cleanup) diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Inc/tMenu.h --- a/Discovery/Inc/tMenu.h Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Inc/tMenu.h Sun Mar 10 15:39:55 2019 +0000 @@ -71,7 +71,6 @@ void updateMenu(void); void updateSpecificMenu(uint32_t id); void sendActionToMenu(uint8_t sendAction); -void timeoutTestMenu(uint32_t seconds_since_last_button_press); void exitMenu(void); void tM_check_content(void); diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/gfx_fonts.c diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/show_logbook.c --- a/Discovery/Src/show_logbook.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/show_logbook.c Sun Mar 10 15:39:55 2019 +0000 @@ -232,7 +232,7 @@ colortemp[i] = CLUT_NiceGreen; } } - GFX_graph_print(hgfx,&wintemp,saveTop,1,0,datamax, decostopdata,dataLength, NULL, colortemp); + GFX_graph_print(hgfx,&wintemp,saveTop,1,0,datamax, decostopdata,dataLength, 0, colortemp); } else GFX_graph_print(hgfx,&wintemp,saveTop,1,0,datamax, decostopdata,dataLength, CLUT_NiceGreen, NULL); diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/t3.c --- a/Discovery/Src/t3.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/t3.c Sun Mar 10 15:39:55 2019 +0000 @@ -181,7 +181,7 @@ t3screen.FBStartAdress = getFrame(24); t3_refresh_divemode(); - GFX_SetFramesTopBottom(t3screen.FBStartAdress, NULL,480); + GFX_SetFramesTopBottom(t3screen.FBStartAdress, 0,480); releaseAllFramesExcept(24,t3screen.FBStartAdress); } diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/t4_tetris.c --- a/Discovery/Src/t4_tetris.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/t4_tetris.c Sun Mar 10 15:39:55 2019 +0000 @@ -120,7 +120,7 @@ t4screen.FBStartAdress = getFrame(25); t4_refresh_divemode(); - GFX_SetFramesTopBottom(t4screen.FBStartAdress, NULL,480); + GFX_SetFramesTopBottom(t4screen.FBStartAdress, 0,480); releaseAllFramesExcept(25,t4screen.FBStartAdress); } diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/t5_gauge.c --- a/Discovery/Src/t5_gauge.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/t5_gauge.c Sun Mar 10 15:39:55 2019 +0000 @@ -187,7 +187,7 @@ set_globalState(StD); t5_refresh_divemode(); - GFX_SetFramesTopBottom(t5screen.FBStartAdress, NULL,480); + GFX_SetFramesTopBottom(t5screen.FBStartAdress, 0,480); releaseAllFramesExcept(24,t5screen.FBStartAdress); } diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/t6_apnea.c --- a/Discovery/Src/t6_apnea.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/t6_apnea.c Sun Mar 10 15:39:55 2019 +0000 @@ -183,7 +183,7 @@ set_globalState(StD); t6_refresh_divemode(); - GFX_SetFramesTopBottom(t6screen.FBStartAdress, NULL,480); + GFX_SetFramesTopBottom(t6screen.FBStartAdress, 0,480); releaseAllFramesExcept(24,t6screen.FBStartAdress); } diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/t7.c --- a/Discovery/Src/t7.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/t7.c Sun Mar 10 15:39:55 2019 +0000 @@ -109,7 +109,7 @@ SBackground background = { - .pointer = NULL, + .pointer = 0, }; @@ -544,7 +544,7 @@ if(get_globalState() == StStop) { - GFX_SetFramesTopBottom(t7screen.FBStartAdress, NULL,480); + GFX_SetFramesTopBottom(t7screen.FBStartAdress, 0,480); } releaseFrame(22,oldScreen); } @@ -624,7 +624,7 @@ GFX_SetFrameBottom(background.pointer,background.x0 , background.y0, background.width, background.height); } else - GFX_SetFramesTopBottom(t7screen.FBStartAdress, NULL,480); + GFX_SetFramesTopBottom(t7screen.FBStartAdress, 0,480); } releaseAllFramesExcept(22,t7screen.FBStartAdress); @@ -2444,7 +2444,7 @@ if(stateUsed->warnings.numWarnings) customview_warnings = t7_test_customview_warnings(); - background.pointer = NULL; + background.pointer = 0; if(customview_warnings && warning_count_high_time) t7_show_customview_warnings(); else diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/tComm.c --- a/Discovery/Src/tComm.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/tComm.c Sun Mar 10 15:39:55 2019 +0000 @@ -123,7 +123,6 @@ uint8_t receive_update_data_mainCPU_firmware_subrotuine(uint8_t region, uint8_t* pBuffer1, uint8_t* pBuffer2); HAL_StatusTypeDef receive_uart_large_size(UART_HandleTypeDef *huart, uint8_t *pData, uint32_t Size); static uint8_t openComm(uint8_t aRxByte); -uint8_t tComm_Set_Bluetooth_Name_sub(uint16_t serial); uint8_t HW_Set_Bluetooth_Name(uint16_t serial, uint8_t withEscapeSequence); uint8_t prompt4D4C(uint8_t mode); @@ -219,7 +218,7 @@ GFX_write_string(&FontT48, &tCwindow, "Service mode enabled",2); else GFX_write_string(&FontT48, &tCwindow, "Download mode enabled",2); - GFX_SetFramesTopBottom(tCscreen.FBStartAdress, NULL,480); + GFX_SetFramesTopBottom(tCscreen.FBStartAdress, 0,480); display_text[0] = 0; display_text[255] = 0; } diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/tInfo.c --- a/Discovery/Src/tInfo.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/tInfo.c Sun Mar 10 15:39:55 2019 +0000 @@ -148,7 +148,7 @@ tIscreen.FBStartAdress = getFrame(14); // GFX_SetFramesTopBottom(tIscreen.FBStartAdress, tIcursor.FBStartAdress,480); - GFX_SetFramesTopBottom(tIscreen.FBStartAdress, NULL,480); + GFX_SetFramesTopBottom(tIscreen.FBStartAdress, 0,480); infoColor = CLUT_InfoSurface; if(modeToStart == StIDEBUG) @@ -218,7 +218,7 @@ refreshInfo_Compass(); if(inDebugMode() || (get_globalState() == StICOMPASS)) /* could be timeout and exitInfo */ - GFX_SetFramesTopBottom(tIscreen.FBStartAdress, NULL,480); + GFX_SetFramesTopBottom(tIscreen.FBStartAdress, 0,480); if(oldIscreen) releaseFrame(14,oldIscreen); @@ -534,7 +534,7 @@ change_CLUT_entry((CLUT_InfoField0 + TIid), CLUT_InfoButtonColor1); - if(editID == NULL) + if(editID == 0) tInfo_write_content_without_Id(); else { @@ -571,7 +571,7 @@ change_CLUT_entry((CLUT_InfoField0 + TIid), CLUT_InfoButtonColor1); - if(editID == NULL) + if(editID == 0) tInfo_write_content_without_Id(); else { @@ -607,7 +607,7 @@ else change_CLUT_entry((CLUT_InfoField0 + TIid), CLUT_InfoInActive); - if(editID == NULL) + if(editID == 0) tInfo_write_content_without_Id(); else { diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/tMenu.c --- a/Discovery/Src/tMenu.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/tMenu.c Sun Mar 10 15:39:55 2019 +0000 @@ -71,36 +71,30 @@ /* Exported variables --------------------------------------------------------*/ /* Announced Private variables -----------------------------------------------*/ -GFX_DrawCfgScreen tMdesignSolo; -GFX_DrawCfgScreen tMdesignCursor; +static GFX_DrawCfgScreen tMdesignSolo; +static GFX_DrawCfgScreen tMdesignCursor; /* Private variables ---------------------------------------------------------*/ -GFX_DrawCfgWindow tMwindow; -GFX_DrawCfgScreen tMscreen; +static GFX_DrawCfgWindow tMwindow; +static GFX_DrawCfgScreen tMscreen; -uint32_t FramebufferStartAddressForPage[10]; - -SMenuMemory menu; - -uint32_t callerID; +static SMenuMemory menu; uint8_t actual_menu_content = MENU_UNDEFINED; -/* TEM HAS TO MOVE TO GLOBAL--------------------------------------------------*/ - /* Private function prototypes -----------------------------------------------*/ -void draw_tMheader(uint8_t page); -void draw_tMcursorDesign(void); +static void draw_tMheader(uint8_t page); +static void draw_tMcursorDesign(void); -void draw_tMdesignSubUnselected(uint32_t *ppDestination); -void draw_tMdesignSubSelected(uint32_t *ppDestination); -void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination); -void tMenu_write(uint8_t page, char *text, char *subtext); +static void draw_tMdesignSubUnselected(uint32_t *ppDestination); +static void draw_tMdesignSubSelected(uint32_t *ppDestination); +static void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination); +static void tMenu_write(uint8_t page, char *text, char *subtext); -void clean_line_actual_page(void); +static void clean_line_actual_page(void); void tM_build_pages(void); -void gotoMenuEdit(void); +static void gotoMenuEdit(void); /* Exported functions --------------------------------------------------------*/ @@ -234,7 +228,7 @@ } -void clean_line_actual_page(void) +static void clean_line_actual_page(void) { uint8_t line, page; @@ -249,7 +243,7 @@ } -void update_content_actual_page(char *text, uint16_t tab, char *subtext) +static void update_content_actual_page(char *text, uint16_t tab, char *subtext) { uint8_t page; @@ -265,13 +259,7 @@ } -void clean_line(uint8_t page, uint8_t line) -{ - tMscreen.FBStartAdress = menu.StartAddressForPage[page]; - GFX_clean_line(&tMwindow, line); -} - -void update_content_with_new_frame(uint8_t page, char *text, uint16_t tab, char *subtext) +static void update_content_with_new_frame(uint8_t page, char *text, uint16_t tab, char *subtext) { char localtext[32]; @@ -311,19 +299,8 @@ releaseFrame(5,rememberPage); } -void update_content(uint8_t page, char *text, uint16_t tab, char *subtext) -{ - tMscreen.FBStartAdress = menu.StartAddressForPage[page]; - if(tab == 0) - tMwindow.WindowTab = 400; - else - tMwindow.WindowTab = tab; - tMenu_write(page, text, subtext); -} - - -void tM_create_pagenumbering(void) +static void tM_create_pagenumbering(void) { menu.pageCountTotal = 0; @@ -338,7 +315,7 @@ } -void tM_build_page(uint32_t id, char *text, uint16_t tab, char *subtext) +static void tM_build_page(uint32_t id, char *text, uint16_t tab, char *subtext) { uint8_t linesFound; uint16_t i; @@ -437,7 +414,7 @@ } */ -void findValidPosition(uint8_t *pageOuput, uint8_t *lineOutput) +static void findValidPosition(uint8_t *pageOuput, uint8_t *lineOutput) { uint8_t page = 0; uint8_t line = 0; @@ -488,48 +465,8 @@ *lineOutput = line; } -/* -void tM_insert_page_numbers(void) -{ - uint8_t page, line, pageMemoryBackup, pageFirst, total; - GFX_DrawCfgScreen tTscreen; - tTscreen.FBStartAdress = 0; - tTscreen.ImageHeight = 480; - tTscreen.ImageWidth = 800; - tTscreen.LayerIndex = 1; - - pageMemoryBackup = menu.pageMemoryForNavigation; - - menu.pageMemoryForNavigation = 1; - findValidPosition(&page, &line); - pageFirst = page; - total = 0; - - do - { - total++; - menu.pageMemoryForNavigation += 1; - findValidPosition(&page, &line); - } - while((pageFirst != page) && (total < MAXPAGES)); - - menu.pageCountTotal = total; - menu.pageMemoryForNavigation = 0; - for(int i = 1; i<= total; i++) - { - menu.pageMemoryForNavigation += 1; - findValidPosition(&page, &line); - tTscreen.FBStartAdress = menu.StartAddressForPage[page]; - menu.pageCountNumber[page] = i; - gfx_write_page_number(&tTscreen ,i,total,0); - } - - menu.pageMemoryForNavigation = pageMemoryBackup; -} -*/ - -void tM_add(uint32_t id) +static void tM_add(uint32_t id) { SStateList idList; uint8_t page; @@ -803,8 +740,6 @@ SSettings* pSettings; pSettings = settingsGetPointer(); - callerID = get_globalState(); - findValidPosition(&page, &line); if((page == 0) || (line == 0)) return; @@ -858,7 +793,7 @@ } -void block_diluent_handler(_Bool Unblock) +static void block_diluent_handler(_Bool Unblock) { SStateList list; static uint8_t linesAvailableForPageDiluent = 0; @@ -887,7 +822,7 @@ } -void nextPage(void) +static void nextPage(void) { uint8_t page, line; @@ -922,7 +857,7 @@ } -void nextLine(void) +static void nextLine(void) { uint8_t page, line; SSettings* pSettings; @@ -947,7 +882,7 @@ } -void stepBackMenu(void) +static void stepBackMenu(void) { if(menu.modeFlipPages == 0) { @@ -975,7 +910,7 @@ } -void stepForwardMenu(void) +static void stepForwardMenu(void) { if(menu.modeFlipPages == 1) { @@ -985,7 +920,7 @@ gotoMenuEdit(); } -void gotoMenuEdit(void) +static void gotoMenuEdit(void) { uint8_t line; @@ -1054,11 +989,7 @@ /* tMC_OC_Gas(StMOG1, pSettings); */ } -void timeoutTestMenu(uint32_t seconds_since_last_button_press) -{ -} - -void tMenu_write(uint8_t page, char *text, char *subtext) +static void tMenu_write(uint8_t page, char *text, char *subtext) { if(page > MAXPAGES) return; @@ -1076,7 +1007,7 @@ /* Private functions ---------------------------------------------------------*/ -void draw_tMdesignSubUnselected(uint32_t *ppDestination) +static void draw_tMdesignSubUnselected(uint32_t *ppDestination) { union al88_u { @@ -1111,7 +1042,7 @@ } -void draw_tMdesignSubSelected(uint32_t *ppDestination) +static void draw_tMdesignSubSelected(uint32_t *ppDestination) { union al88_u { @@ -1147,7 +1078,7 @@ } -void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination) +static void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination) { union al88_u { @@ -1170,7 +1101,7 @@ } -void draw_tMcursorDesign(void) +static void draw_tMcursorDesign(void) { int i,j; uint32_t pDestination; @@ -1202,7 +1133,7 @@ } -void draw_tMheader(uint8_t page) +static void draw_tMheader(uint8_t page) { union al88_u { @@ -1267,7 +1198,7 @@ k4text = k-1; color_top.al8[0] = CLUT_MenuPageGasOC + k - 1; - if(k4text == page) + if (k == page) { color_top.al8[1] = 0xFF; } diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/tMenuEdit.c --- a/Discovery/Src/tMenuEdit.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/tMenuEdit.c Sun Mar 10 15:39:55 2019 +0000 @@ -1252,7 +1252,7 @@ create_newText_for_actual_Id(); - if(editID == NULL) + if(editID == 0) write_content_without_Id(); else { @@ -1334,7 +1334,7 @@ create_newText_for_actual_Id(); - if(editID == NULL) + if(editID == 0) write_content_without_Id(); else { @@ -1366,7 +1366,7 @@ change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditButtonColor1); - if(editID == NULL) + if(editID == 0) write_content_without_Id(); else { @@ -1404,7 +1404,7 @@ change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditButtonColor1); - if(editID == NULL) + if(editID == 0) write_content_without_Id(); else { @@ -1463,7 +1463,7 @@ else change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditInfo); - if(editID == NULL) + if(editID == 0) write_content_without_Id(); else { @@ -1496,7 +1496,7 @@ change_CLUT_entry((CLUT_MenuEditField0 + id), CLUT_MenuEditFieldRegular); - if(editID == NULL) + if(editID == 0) write_content_without_Id(); else { diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/tMenuEditPlanner.c --- a/Discovery/Src/tMenuEditPlanner.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/tMenuEditPlanner.c Sun Mar 10 15:39:55 2019 +0000 @@ -517,7 +517,8 @@ void refresh_PlanResult(void) { - char text[256], textpointer; + char text[256]; + uint8_t textpointer; uint16_t y_line; uint8_t oxygen_percentage; int now; diff -r e9cce686fe41 -r 4b5b7a40e594 Discovery/Src/tMenuEditSetpoint.c --- a/Discovery/Src/tMenuEditSetpoint.c Fri Mar 08 10:31:32 2019 +0100 +++ b/Discovery/Src/tMenuEditSetpoint.c Sun Mar 10 15:39:55 2019 +0000 @@ -180,7 +180,8 @@ /* surface mode */ uint8_t spId, setpoint_cbar, sp_high, depthDeco, first; // uint8_t active, - char text[70], textPointer; + char text[70]; + uint8_t textPointer; uint16_t y_line; set_globalState_Menu_Line(line);