diff Discovery/Src/t7.c @ 200:7116c0ffb862

Merged in janlmulder/ostc4/div-fixes-cleaup-2 (pull request #8) 2 (simple) bugfixes and again some cleanup
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Fri, 22 Mar 2019 08:15:30 +0000
parents 878dc9e0dbc5
children b2a9e9b02df0
line wrap: on
line diff
--- a/Discovery/Src/t7.c	Tue Mar 19 15:43:38 2019 +0000
+++ b/Discovery/Src/t7.c	Fri Mar 22 08:15:30 2019 +0000
@@ -58,7 +58,7 @@
 void t7_miniLiveLogProfile(void);
 //void t7_clock(void);
 void t7_logo_OSTC(void);
-void t7_colorscheme_mod(char *text);
+static void t7_colorscheme_mod(char *text);
 
 uint8_t t7_test_customview_warnings(void);
 void t7_show_customview_warnings(void);
@@ -1207,7 +1207,7 @@
     uint32_t color;
 //	uint8_t gasIdFirst;
     SSettings* pSettings = settingsGetPointer();
-    extern SDataExchangeSlaveToMaster dataIn;
+    SDataExchangeSlaveToMaster *dataIn = get_dataInPointer();
 
     SWindowGimpStyle windowGimp;
 
@@ -1221,7 +1221,7 @@
     if(stateUsed->data_old__lost_connection_to_slave)
     {
         Gfx_write_label_var(&t7screen,  500,800,  0,&FontT42,CLUT_DiveMainLabel,"old");
-        snprintf(TextL1,TEXTSIZE,"%X %X %X %X",dataIn.header.checkCode[0],dataIn.header.checkCode[1],dataIn.header.checkCode[2],dataIn.header.checkCode[3]);
+        snprintf(TextL1,TEXTSIZE,"%X %X %X %X",dataIn->header.checkCode[0],dataIn->header.checkCode[1],dataIn->header.checkCode[2],dataIn->header.checkCode[3]);
         Gfx_write_label_var(&t7screen,  500,800, 45,&FontT48,CLUT_Font020,TextL1);
     }
     else
@@ -1261,7 +1261,7 @@
     Gfx_write_label_var(&t7screen,  0,400,355,&FontT48,CLUT_Font020,TextL1);
 
 //	gasIdFirst = stateUsed->lifeData.actualGas.GasIdInSettings;
-    snprintf(TextL1,TEXTSIZE,"%u.%u",dataIn.RTE_VERSION_high,dataIn.RTE_VERSION_low);
+    snprintf(TextL1,TEXTSIZE,"%u.%u",dataIn->RTE_VERSION_high,dataIn->RTE_VERSION_low);
     Gfx_write_label_var(&t7screen,  320,500,100,&FontT42,CLUT_DiveMainLabel,"RTE");
     Gfx_write_label_var(&t7screen,  320,500,145,&FontT48,CLUT_Font020,TextL1);
 
@@ -2639,14 +2639,13 @@
     return lineCount;
 }
 
-/* could be extended to search for \020 inside
- */
-void t7_colorscheme_mod(char *text)
-{
-    if((text[0] == '\020') && !GFX_is_colorschemeDiveStandard())
-    {
-        text[0] = '\027';
-    }
+static void t7_colorscheme_mod(char *text) {
+	char *p = text;
+	while (*p) {
+		if ((*p == '\020') && !GFX_is_colorschemeDiveStandard())
+			*p = '\027';
+		p++;
+	}
 }
 
 
@@ -3106,6 +3105,7 @@
     text[textpointer++] = '\t';
     textpointer += snprintf(&text[textpointer],10,"\020%i'",		pDecoinfoFuture->output_time_to_surface_seconds / 60);
     text[textpointer++] = 0;
+    t7_colorscheme_mod(text);
     GFX_write_string(&FontT42, &t7cY0free, text, 1);
 }