changeset 413:65c7b009136f Improment_NVM

Bugfix Flipdisplay Gauge and Apnoe mode: Changes needed to provide the same look and feel like in standard mode were not applied. Added missinng functions.
author ideenmodellierer
date Tue, 14 Jan 2020 21:10:37 +0100
parents b3ab85121e4d
children 6886aeeca454
files Discovery/Src/t3.c Discovery/Src/t5_gauge.c Discovery/Src/t6_apnea.c
diffstat 3 files changed, 245 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/t3.c	Tue Jan 14 21:08:45 2020 +0100
+++ b/Discovery/Src/t3.c	Tue Jan 14 21:10:37 2020 +0100
@@ -259,13 +259,28 @@
             else
                 depthChangeRate = 200;
         }
-        start.y = tXl1->WindowY0 - 1;
+
+        if(!pSettings->FlipDisplay)
+        {
+        	start.y = tXl1->WindowY0 - 1;
+        }
+        else
+        {
+        	start.y = tXl1->WindowY1 + 1;
+        }
         startZeroLine.y = start.y;
         for(int i = 0; i<5;i++)
         {
             start.y += 40;
             stop.y = start.y;
-            start.x = tXl1->WindowX1 - 1;
+            if(!pSettings->FlipDisplay)
+            {
+            	start.x = tXl1->WindowX1 - 1;
+            }
+            else
+            {
+            	start.x = tXr1->WindowX1 - 1;
+            }
             stop.x = start.x - 17;
 
             if(depthChangeRate <= 6)
@@ -290,7 +305,6 @@
         if((stateUsed->lifeData.ascent_rate_meter_per_min > 4) || (stateUsed->lifeData.ascent_rate_meter_per_min < -4))
         {
             start.y = startZeroLine.y;
-
             if(depthChangeAscent)
             {
                 color = CLUT_EverythingOkayGreen;
@@ -307,7 +321,16 @@
                 if(stop.y <= tXl1->WindowY0)
                     stop.y = tXl1->WindowY0 + 1;
             }
-            stop.x = start.x = tXl1->WindowX1 - 8;
+            if(!pSettings->FlipDisplay)
+            {
+            	start.x = tXl1->WindowX1 - 3 - 5;
+            }
+            else
+            {
+            	start.x = tXr1->WindowX1 - 3 - 5;
+            }
+
+            stop.x = start.x;
             GFX_draw_thick_line(12,tXscreen, start, stop, color);
         }
     }
@@ -501,15 +524,21 @@
 
     // CVIEW_T3_Temperature
     float temperature;
+	SSettings* pSettings;
+	pSettings = settingsGetPointer();
 
     SDivetime TotalDivetime = {0,0,0,0};
     SDivetime LastDivetime = {0,0,0,0};
 
     uint16_t tempWinX0;
+    uint16_t tempWinX1;
     uint16_t tempWinY0;
+    uint16_t tempWinY1;
 
     tempWinX0 = tXc1->WindowX0;
+    tempWinX1 = tXc1->WindowX1;
     tempWinY0 = tXc1->WindowY0;
+    tempWinY1 = tXc1->WindowY1;
 
     tXc1->WindowX0 = 440; // rechte Seite
 
@@ -542,27 +571,54 @@
         LastDivetime.Minutes = LastDivetime.Total / 60;
         LastDivetime.Seconds = LastDivetime.Total - ( LastDivetime.Minutes * 60 );
 
-        tXc1->WindowY0 = 100; // obere Zeile
+   //     tXc1->WindowY0 = 100; // obere Zeile
+        if(!pSettings->FlipDisplay)
+        {
+        	tXc1->WindowY0 = 100;
+        }
+        else
+        {
+        	tXc1->WindowY1 -= 100; /* jump to upper of two lines */
+        }
 
         snprintf(text,TEXTSIZE,"\020\016%u:%02u",LastDivetime.Minutes, LastDivetime.Seconds);
         t3_basics_colorscheme_mod(text);
         GFX_write_string(&FontT105,tXc1,text,0);
 
+        if(pSettings->FlipDisplay)
+        {
+            tXc1->WindowX0 = 0;
+
+        }
         snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaLast);
         GFX_write_string(&FontT42,tXc1,text,0);
 
-        tXc1->WindowY0 = tempWinY0; // wieder unten
+        if(!pSettings->FlipDisplay)
+        {
+        	tXc1->WindowY0 = tempWinY0;
+        }
+        else
+        {
+            tXc1->WindowX1 = tempWinX1;
+        	tXc1->WindowY1 = tempWinY1; /* jump to upper of two lines */
+        }
 
         snprintf(text,TEXTSIZE,"\020\016%u:%02u",TotalDivetime.Minutes, TotalDivetime.Seconds);
         t3_basics_colorscheme_mod(text);
         GFX_write_string(&FontT105,tXc1,text,0);
 
         snprintf(text,TEXTSIZE,"\032\002%c%c",TXT_2BYTE, TXT2BYTE_ApneaTotal);
+        if(pSettings->FlipDisplay)
+        {
+            tXc1->WindowX0 = 0;
+
+        }
         GFX_write_string(&FontT42,tXc1,text,0);
         break;
     }
 
     tXc1->WindowX0 = tempWinX0;
+    tXc1->WindowX1 = tempWinX1;
     tXc1->WindowY0 = tempWinY0;
 
 }
@@ -609,30 +665,61 @@
     uint16_t tempWinY0;
     uint16_t tempWinY1;
     uint16_t tempWinC2X0;
+    uint16_t tempWinC2Y0;
+    uint16_t tempWinC2X1;
+    uint16_t tempWinC2Y1;
     uint16_t tempWinC2Tab;
 
     tempWinX0 = tXc1->WindowX0;
     tempWinY0 = tXc1->WindowY0;
+
     tempWinC2X0  = tXc2->WindowX0;
+    tempWinC2Y0 = tXc2->WindowY0;
+    tempWinC2X1  = tXc2->WindowX1;
+    tempWinC2Y1 = tXc2->WindowY1;
     tempWinC2Tab = tXc2->WindowTab;
 
     switch(tX_selection_customview)
     {
     case CVIEW_T3_ApnoeSurfaceInfo:
         snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
-        GFX_write_string(&FontT42,tXc1,text,0);
 
-        tXc1->WindowY0 = 100; // obere Zeile
+        if(!pSettings->FlipDisplay)
+        {
+	        GFX_write_string(&FontT42,tXc1,text,0);
+        	tXc1->WindowY0 = 100;
+        }
+        else
+        {
+	        GFX_write_string(&FontT42,tXc2,text,0);
+        	tXc2->WindowY1 -= 100; /* jump to upper of two lines */
+        }
 
         snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_last_max_depth_meter));
         t3_basics_colorscheme_mod(text);
-        GFX_write_string(&FontT105,tXc1,text,0);
+        
+        if(!pSettings->FlipDisplay)
+        {
+	        GFX_write_string(&FontT105,tXc1,text,0);
+        	tXc1->WindowY0 = tempWinY0;
+        }
+        else
+        {
+	        GFX_write_string(&FontT105,tXc2,text,0);
+        	tXc2->WindowY1 = tempWinC2Y1; /* jump to upper of two lines */
+        }
 
-        tXc1->WindowY0 = tempWinY0; // wieder unten
 
         snprintf(text,TEXTSIZE,"\020\016%01.1f",unit_depth_float(stateUsed->lifeData.apnea_total_max_depth_meter));
         t3_basics_colorscheme_mod(text);
-        GFX_write_string(&FontT105,tXc1,text,0);
+        if(!pSettings->FlipDisplay)
+        {
+		    GFX_write_string(&FontT105,tXc1,text,0);
+        }
+        else
+        {
+	        GFX_write_string(&FontT105,tXc2,text,0);
+        }
         break;
 
     case CVIEW_T3_StopWatch:
@@ -695,10 +782,14 @@
         textpointer = 0;
         tempWinC2X0 = tXc2->WindowX0;
         tempWinC2Tab = tXc2->WindowTab;
-
         tXc2->WindowX0 = 0;
         tXc2->WindowTab = 800/2;
 
+        if(pSettings->FlipDisplay)
+        {
+        	tXc2->WindowY1 = 0;
+        }
+
         pGasLine = settingsGetPointer()->gas;
         if(actualLeftMaxDepth(stateUsed))
             fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100;
@@ -839,10 +930,38 @@
 
     case CVIEW_T3_MaxDepth:
         snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
-        GFX_write_string(&FontT42,tXc1,text,0);
+        if(pSettings->FlipDisplay)
+        {
+        	if(mode == DIVEMODE_Apnea)
+        	{
+        		GFX_write_string(&FontT42,tXc2,text,0);
+        	}
+        	else
+        	{
+        		GFX_write_string(&FontT42,tXc1,text,0);
+        	}
+        }
+        else
+        {
+        	GFX_write_string(&FontT42,tXc1,text,0);
+        }
         snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter));
         t3_basics_colorscheme_mod(text);
-        GFX_write_string(&FontT105,tXc1,text,1);
+        if(pSettings->FlipDisplay)
+        {
+        	if(mode == DIVEMODE_Apnea)
+        	{
+        		GFX_write_string(&FontT105,tXc2,text,0);
+        	}
+        	else
+        	{
+        		GFX_write_string(&FontT105,tXc1,text,0);
+        	}
+        }
+        else
+        {
+        	GFX_write_string(&FontT105,tXc1,text,1);
+        }
         break;
 
     case CVIEW_T3_TTS:
@@ -881,7 +1000,11 @@
     }
     tXc1->WindowX0 = tempWinX0;
     tXc1->WindowY0 = tempWinY0;
+
     tXc2->WindowX0 = tempWinC2X0;
+    tXc2->WindowY0 = tempWinC2Y0;
+    tXc2->WindowX1 = tempWinC2X1;
+    tXc2->WindowY1 = tempWinC2Y1;
     tXc2->WindowTab = tempWinC2Tab;
 }
 
--- a/Discovery/Src/t5_gauge.c	Tue Jan 14 21:08:45 2020 +0100
+++ b/Discovery/Src/t5_gauge.c	Tue Jan 14 21:10:37 2020 +0100
@@ -95,6 +95,9 @@
 
 void t5_init(void)
 {
+	SSettings* pSettings;
+	pSettings = settingsGetPointer();
+
     t5_selection_customview = t5_customviewsStandard[0];
 
     t5screen.FBStartAdress = 0;
@@ -105,18 +108,36 @@
     t5l1.Image = &t5screen;
     t5l1.WindowNumberOfTextLines = 2;
     t5l1.WindowLineSpacing = 19; // Abstand von Y0
-    t5l1.WindowTab = 100;
-    t5l1.WindowX0 = 0;
-    t5l1.WindowX1 = BigFontSeperationLeftRight - 5;
-    t5l1.WindowY0 = BigFontSeperationTopBottom + 5;
-    t5l1.WindowY1 = 479;
+	t5l1.WindowTab = 100;
+    if(!pSettings->FlipDisplay)
+    {
+		t5l1.WindowX0 = 0;
+		t5l1.WindowX1 = BigFontSeperationLeftRight - 5;
+		t5l1.WindowY0 = BigFontSeperationTopBottom + 5;
+		t5l1.WindowY1 = 479;
+    }
+    else
+    {
+		t5l1.WindowX0 = 800 - BigFontSeperationLeftRight + 5;
+		t5l1.WindowX1 = 799;
+		t5l1.WindowY0 = 0;
+		t5l1.WindowY1 = 479 - BigFontSeperationTopBottom + 5 ;
+    }
 
     t5r1.Image = &t5screen;
     t5r1.WindowNumberOfTextLines = t5l1.WindowNumberOfTextLines;
     t5r1.WindowLineSpacing = t5l1.WindowLineSpacing;
     t5r1.WindowTab = t5l1.WindowTab;
-    t5r1.WindowX0 = BigFontSeperationLeftRight + 5;
-    t5r1.WindowX1 = 799;
+    if(!pSettings->FlipDisplay)
+    {
+		t5r1.WindowX0 = BigFontSeperationLeftRight + 5;
+		t5r1.WindowX1 = 799;
+    }
+    else
+    {
+		t5r1.WindowX0 = 0;
+		t5r1.WindowX1 = BigFontSeperationLeftRight - 5;
+    }
     t5r1.WindowY0 = t5l1.WindowY0;
     t5r1.WindowY1 = t5l1.WindowY1;
 
@@ -125,8 +146,16 @@
     t5c1.WindowLineSpacing = t5l1.WindowLineSpacing;
     t5c1.WindowX0 = 0;
     t5c1.WindowX1 = 799;
-    t5c1.WindowY0 = 0;
-    t5c1.WindowY1 = BigFontSeperationTopBottom - 5;
+    if(!pSettings->FlipDisplay)
+    {
+    	t5c1.WindowY0 = 0;
+    	t5c1.WindowY1 = BigFontSeperationTopBottom - 5;
+    }
+	else
+	{
+		t5c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5;
+		t5c1.WindowY1 = 479;
+	}
 
     t5c2.Image = &t5screen;
     t5c2.WindowNumberOfTextLines = 3;
@@ -143,8 +172,16 @@
     t5c3.WindowTab = 100;
     t5c3.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
     t5c3.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
-    t5c3.WindowY0 = 0;
-    t5c3.WindowY1 = 69;
+    if(!pSettings->FlipDisplay)
+    {
+    	t5c3.WindowY0 = 0;
+    	t5c3.WindowY1 = 69;
+    }
+    else
+    {
+    	t5c3.WindowY0 = 480 - 69;
+    	t5c3.WindowY1 = 479;
+    }
 }
 
 
--- a/Discovery/Src/t6_apnea.c	Tue Jan 14 21:08:45 2020 +0100
+++ b/Discovery/Src/t6_apnea.c	Tue Jan 14 21:10:37 2020 +0100
@@ -88,6 +88,8 @@
 
 void t6_init(void)
 {
+	SSettings* pSettings;
+	pSettings = settingsGetPointer();
     t6_selection_customview = t6_customviewsStandard[0];
 
     t6screen.FBStartAdress = 0;
@@ -99,17 +101,35 @@
     t6l1.WindowNumberOfTextLines = 2;
     t6l1.WindowLineSpacing = 19; // Abstand von Y0
     t6l1.WindowTab = 100;
-    t6l1.WindowX0 = 0;
-    t6l1.WindowX1 = BigFontSeperationLeftRight - 5;
-    t6l1.WindowY0 = BigFontSeperationTopBottom + 5;
-    t6l1.WindowY1 = 479;
+    if(!pSettings->FlipDisplay)
+    {
+    	t6l1.WindowX0 = 0;
+    	t6l1.WindowX1 = BigFontSeperationLeftRight - 5;
+    	t6l1.WindowY0 = BigFontSeperationTopBottom + 5;
+    	t6l1.WindowY1 = 479;
+    }
+    else
+    {
+    	t6l1.WindowX0 = 800 - BigFontSeperationLeftRight + 5;
+    	t6l1.WindowX1 = 799;
+    	t6l1.WindowY0 = 0;
+    	t6l1.WindowY1 = 479 - BigFontSeperationTopBottom + 5 ;
+    }
 
     t6r1.Image = &t6screen;
     t6r1.WindowNumberOfTextLines = t6l1.WindowNumberOfTextLines;
     t6r1.WindowLineSpacing = t6l1.WindowLineSpacing;
     t6r1.WindowTab = t6l1.WindowTab;
-    t6r1.WindowX0 = BigFontSeperationLeftRight + 5;
-    t6r1.WindowX1 = 799;
+    if(!pSettings->FlipDisplay)
+    {
+    	t6r1.WindowX0 = BigFontSeperationLeftRight + 5;
+    	t6r1.WindowX1 = 799;
+    }
+    else
+    {
+    	t6r1.WindowX0 = 0;
+    	t6r1.WindowX1 = BigFontSeperationLeftRight - 5;
+    }
     t6r1.WindowY0 = t6l1.WindowY0;
     t6r1.WindowY1 = t6l1.WindowY1;
 
@@ -118,16 +138,36 @@
     t6c1.WindowLineSpacing = t6l1.WindowLineSpacing;
     t6c1.WindowX0 = 0;
     t6c1.WindowX1 = 799;
-    t6c1.WindowY0 = 0;
-    t6c1.WindowY1 = BigFontSeperationTopBottom - 5;
+    if(!pSettings->FlipDisplay)
+    {
+    	t6c1.WindowY0 = 0;
+    	t6c1.WindowY1 = BigFontSeperationTopBottom - 5;
+    }
+	else
+	{
+		t6c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5;
+		t6c1.WindowY1 = 479;
+	   	t6c1.WindowX0 = 0;
+	    t6c1.WindowX1 = BigFontSeperationLeftRight - 5;
+	}
 
     t6c2.Image = &t6screen;
     t6c2.WindowNumberOfTextLines = 3;
     t6c2.WindowLineSpacing = 58;
     t6c2.WindowX0 = 370;
     t6c2.WindowX1 = 799;
-    t6c2.WindowY0 = 0;
-    t6c2.WindowY1 = BigFontSeperationTopBottom - 5;
+
+    if(!pSettings->FlipDisplay)
+    {
+    	t6c2.WindowY0 = 0;
+    	t6c2.WindowY1 = BigFontSeperationTopBottom - 5;
+    }
+	else
+	{
+		t6c2.WindowY0 = 480 - BigFontSeperationTopBottom + 5;
+		t6c2.WindowY1 = 479;
+	}
+
     t6c2.WindowTab = 600;
 
     t6c3.Image = &t6screen;
@@ -136,8 +176,16 @@
     t6c3.WindowTab = 100;
     t6c3.WindowX0 = CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET;
     t6c3.WindowX1 = CUSTOMBOX_LINE_RIGHT - CUSTOMBOX_INSIDE_OFFSET;
-    t6c3.WindowY0 = 0;
-    t6c3.WindowY1 = 69;
+    if(!pSettings->FlipDisplay)
+    {
+    	t6c3.WindowY0 = 0;
+    	t6c3.WindowY1 = 69;
+    }
+    else
+    {
+    	t6c3.WindowY0 = 480 - 69;
+    	t6c3.WindowY1 = 479;
+    }
 }