changeset 320:117a7ec23385

Merged in janlmulder/ostc4/fix-version (pull request #27) bugfix: correct packed main version number in dive header
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Wed, 19 Jun 2019 13:12:25 +0000
parents bc31d078fb90 (diff) d8e86af78474 (current diff)
children 37ee61f93124 b43fa6a6c85a
files
diffstat 6 files changed, 76 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/gfx_engine.h	Wed Jun 19 14:31:50 2019 +0200
+++ b/Discovery/Inc/gfx_engine.h	Wed Jun 19 13:12:25 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);
--- a/Discovery/Src/gfx_engine.c	Wed Jun 19 14:31:50 2019 +0200
+++ b/Discovery/Src/gfx_engine.c	Wed Jun 19 13:12:25 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;
--- a/Discovery/Src/t7.c	Wed Jun 19 14:31:50 2019 +0200
+++ b/Discovery/Src/t7.c	Wed Jun 19 13:12:25 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);
--- a/Discovery/Src/tComm.c	Wed Jun 19 14:31:50 2019 +0200
+++ b/Discovery/Src/tComm.c	Wed Jun 19 13:12:25 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;
 }
--- a/Discovery/Src/tMenuEditHardware.c	Wed Jun 19 14:31:50 2019 +0200
+++ b/Discovery/Src/tMenuEditHardware.c	Wed Jun 19 13:12:25 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();
--- a/Discovery/Src/tMenuHardware.c	Wed Jun 19 14:31:50 2019 +0200
+++ b/Discovery/Src/tMenuHardware.c	Wed Jun 19 13:12:25 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",