# HG changeset patch # User heinrichsweikamp # Date 1560949921 0 # Node ID bc31d078fb9006f90423db8c65d18dce751cd7f8 # Parent 49f5db6139d5695979cadb75259d8c371aff4a3d# Parent 5e8ad1cd353f6b30431a2c48bbf509e32fb8e846 Merged in Ideenmodellierer/ostc4/Bugfix_Flip_FirmwareUpdate (pull request #26) Bugfix Flip FirmwareUpdate diff -r 49f5db6139d5 -r bc31d078fb90 Discovery/Inc/gfx_engine.h --- a/Discovery/Inc/gfx_engine.h Sat Jun 01 10:12:15 2019 +0200 +++ b/Discovery/Inc/gfx_engine.h Wed Jun 19 13:12:01 2019 +0000 @@ -182,6 +182,9 @@ void gfx_write_page_number(GFX_DrawCfgScreen *tMscreen, uint8_t page, uint8_t total, uint8_t color); void GFX_draw_image_monochrome(GFX_DrawCfgScreen *hgfx, SWindowGimpStyle window, const tImage *image, uint8_t color); +void GFX_build_logo_frame(void); +void GFX_build_hw_background_frame(void); + void GFX_logoAutoOff(void); uint8_t GFX_logoStatus(void); void GFX_hwBackgroundOn(void); diff -r 49f5db6139d5 -r bc31d078fb90 Discovery/Src/gfx_engine.c --- a/Discovery/Src/gfx_engine.c Sat Jun 01 10:12:15 2019 +0200 +++ b/Discovery/Src/gfx_engine.c Wed Jun 19 13:12:01 2019 +0000 @@ -250,7 +250,7 @@ } -static void GFX_build_hw_background_frame(void) +void GFX_build_hw_background_frame(void) { GFX_DrawCfgScreen tLogoTemp; SWindowGimpStyle windowGimp; @@ -284,7 +284,7 @@ } -static void GFX_build_logo_frame(void) +void GFX_build_logo_frame(void) { GFX_DrawCfgScreen tLogoTemp; SWindowGimpStyle windowGimp; diff -r 49f5db6139d5 -r bc31d078fb90 Discovery/Src/t7.c --- a/Discovery/Src/t7.c Sat Jun 01 10:12:15 2019 +0200 +++ b/Discovery/Src/t7.c Wed Jun 19 13:12:01 2019 +0000 @@ -1834,7 +1834,15 @@ t7cC.WindowLineSpacing = 95; t7cC.WindowNumberOfTextLines = 3; text[textpointer] = 0; + if(pSettings->FlipDisplay) + { + t7cC.WindowY1 -= 40; + } GFX_write_string(&FontT105,&t7cC,text,1); + if(pSettings->FlipDisplay) + { + t7cC.WindowY1 += 40; + } break; case CVIEW_sensors_mV: @@ -1864,7 +1872,15 @@ t7cC.WindowLineSpacing = 95; t7cC.WindowNumberOfTextLines = 3; text[textpointer] = 0; + if(pSettings->FlipDisplay) + { + t7cC.WindowY1 -= 40; + } GFX_write_string(&FontT48,&t7cC,text,1); + if(pSettings->FlipDisplay) + { + t7cC.WindowY1 += 40; + } break; case CVIEW_Compass: @@ -3055,6 +3071,11 @@ fCNS = 999; t7cY0free.WindowY0 = t7cC.WindowY0 - 10; + if(settingsGetPointer()->FlipDisplay) + { + t7cY0free.WindowY1 = 400; + } + t7cY0free.WindowLineSpacing = 48; t7cY0free.WindowNumberOfTextLines = 6; t7cY0free.WindowTab = 420; @@ -3079,12 +3100,23 @@ text[textpointer++] = TXT_FutureTTS; text[textpointer++] = '\017'; text[textpointer++] = 0; - t7cY0free.WindowX0 += 10; - t7cY0free.WindowY0 += 10; - GFX_write_string(&FontT24, &t7cY0free, text, 1); - t7cY0free.WindowX0 -= 10; - t7cY0free.WindowY0 -= 10; - + + if(!settingsGetPointer()->FlipDisplay) + { + t7cY0free.WindowX0 += 10; + t7cY0free.WindowY0 += 10; + GFX_write_string(&FontT24, &t7cY0free, text, 1); + t7cY0free.WindowX0 -= 10; + t7cY0free.WindowY0 -= 10; + } + else + { + t7cY0free.WindowY1 -= 10; + t7cY0free.WindowX1 -= 10; + GFX_write_string(&FontT24, &t7cY0free, text, 1); + t7cY0free.WindowY1 += 10; + t7cY0free.WindowX1 += 10; + } textpointer = 0; text[textpointer++] = '\t'; textpointer += snprintf(&text[textpointer],10,"\020%01.2f", stateUsed->lifeData.ppO2); diff -r 49f5db6139d5 -r bc31d078fb90 Discovery/Src/tComm.c --- a/Discovery/Src/tComm.c Sat Jun 01 10:12:15 2019 +0200 +++ b/Discovery/Src/tComm.c Wed Jun 19 13:12:01 2019 +0000 @@ -103,10 +103,11 @@ uint8_t updateSettingsAndMenuOnExit = 0; /* Private types -------------------------------------------------------------*/ -#define BYTE_DOWNLOAD_MODE (0xBB) -#define BYTE_SERVICE_MODE (0xAA) +#define BYTE_DOWNLOAD_MODE (0xBB) +#define BYTE_SERVICE_MODE (0xAA) -#define UART_TIMEOUT_SECONDS (120u) /* Timeout for keeping connection open and waiting for data */ +#define UART_TIMEOUT_SECONDS (120u) /* Timeout for keeping connection open and waiting for data */ +#define UART_TIMEOUT_LARGE_BLOCK (6000u) /* Timeout (ms) for receiption of an 16K data block (typical RX time ~4,5seconds) */ const uint8_t id_Region1_firmware = 0xFF; const uint8_t id_RTE = 0xFE; @@ -147,8 +148,18 @@ tCwindow.WindowTab = 400; tCwindow.WindowX0 = 20; tCwindow.WindowX1 = 779; - tCwindow.WindowY0 = 0; - tCwindow.WindowY1 = 799; + + + if(!settingsGetPointer()->FlipDisplay) + { + tCwindow.WindowY0 = 0; + tCwindow.WindowY1 = 479; + } + else + { + tCwindow.WindowY0 = 479 - 390; + tCwindow.WindowY1 = 479 - 25; + } StartListeningToUART = 1; @@ -225,7 +236,7 @@ } else if(display_text[255]) { - display_text[display_text[255]] = 0; + display_text[(uint8_t)display_text[255]] = 0; releaseFrame(18,tCscreen.FBStartAdress); tCscreen.FBStartAdress = getFrame(18); write_content_simple(&tCscreen, 0, 800, 480-24, &FontT24,"Exit",CLUT_ButtonSurfaceScreen); @@ -1194,28 +1205,29 @@ HAL_StatusTypeDef receive_uart_large_size(UART_HandleTypeDef *huart, uint8_t *pData, uint32_t Size) { - uint16_t length_16_blocks; - uint16_t length_16_remainder; + uint16_t length_16k_blocks; + uint16_t length_16k_remainder; uint32_t temp; HAL_StatusTypeDef result = HAL_OK; uint32_t pDataLocal; - length_16_blocks = (uint16_t) (Size / 0xFFFF); - temp = length_16_blocks; - temp *= 0xFFFF; - length_16_remainder = (uint16_t) ( Size - temp); + length_16k_blocks = (uint16_t) (Size / 0x3FFF); + temp = length_16k_blocks; + temp *= 0x3FFF; + length_16k_remainder = (uint16_t) ( Size - temp); pDataLocal = (uint32_t)pData; - while((result == HAL_OK) && length_16_blocks) + + while((result == HAL_OK) && length_16k_blocks) { - result = HAL_UART_Receive(&UartHandle, (uint8_t *)pDataLocal, 0xFFFF , 60000); - pDataLocal += 0xFFFF; - length_16_blocks--; + result = HAL_UART_Receive(&UartHandle, (uint8_t *)pDataLocal, 0x3FFF , UART_TIMEOUT_LARGE_BLOCK); + pDataLocal += 0x3FFF; + length_16k_blocks--; } - if((result == HAL_OK) && length_16_remainder) + if((result == HAL_OK) && length_16k_remainder) { - result = HAL_UART_Receive(&UartHandle, (uint8_t *)pDataLocal, length_16_remainder , 60000); + result = HAL_UART_Receive(&UartHandle, (uint8_t *)pDataLocal, length_16k_remainder , UART_TIMEOUT_LARGE_BLOCK); } return result; } diff -r 49f5db6139d5 -r bc31d078fb90 Discovery/Src/tMenuEditHardware.c --- a/Discovery/Src/tMenuEditHardware.c Sat Jun 01 10:12:15 2019 +0200 +++ b/Discovery/Src/tMenuEditHardware.c Wed Jun 19 13:12:01 2019 +0000 @@ -134,7 +134,8 @@ tMenuEdit_init(); tInfoLog_init(); tM_build_pages(); - + GFX_build_logo_frame(); + GFX_build_hw_background_frame(); exitEditWithUpdate(); exitMenuEdit_to_Home(); diff -r 49f5db6139d5 -r bc31d078fb90 Discovery/Src/tMenuHardware.c --- a/Discovery/Src/tMenuHardware.c Sat Jun 01 10:12:15 2019 +0200 +++ b/Discovery/Src/tMenuHardware.c Wed Jun 19 13:12:01 2019 +0000 @@ -153,7 +153,7 @@ } // textPointer += snprintf(&text[textPointer],25,"%i %i %i",button[0],button[1],button[2]); textPointer += snprintf(&text[textPointer],25, - "%i" + "%li" "\016\016" " %%" "\017",