comparison Discovery/Src/t3.c @ 110:cc8e24374b83 FlipDisplay

Added option to handled mirrored display to existing functions
author Ideenmodellierer
date Tue, 01 Jan 2019 21:02:17 +0100
parents 5f11787b4f42
children cc9c18075e00
comparison
equal deleted inserted replaced
109:65a6e352ce08 110:cc8e24374b83
101 101
102 /* Exported functions --------------------------------------------------------*/ 102 /* Exported functions --------------------------------------------------------*/
103 103
104 void t3_init(void) 104 void t3_init(void)
105 { 105 {
106 SSettings* pSettings;
107 pSettings = settingsGetPointer();
108
106 if(getLicence() == LICENCEBONEX) 109 if(getLicence() == LICENCEBONEX)
107 { 110 {
108 t3_customviews = t3_customviewsScooter; 111 t3_customviews = t3_customviewsScooter;
109 } 112 }
110 113
117 120
118 t3l1.Image = &t3screen; 121 t3l1.Image = &t3screen;
119 t3l1.WindowNumberOfTextLines = 2; 122 t3l1.WindowNumberOfTextLines = 2;
120 t3l1.WindowLineSpacing = 19; // Abstand von Y0 123 t3l1.WindowLineSpacing = 19; // Abstand von Y0
121 t3l1.WindowTab = 100; 124 t3l1.WindowTab = 100;
122 t3l1.WindowX0 = 0; 125
123 t3l1.WindowX1 = BigFontSeperationLeftRight - 5; 126 if(!pSettings->FlipDisplay)
124 t3l1.WindowY0 = BigFontSeperationTopBottom + 5; 127 {
125 t3l1.WindowY1 = 479; 128 t3l1.WindowX0 = 0;
129 t3l1.WindowX1 = BigFontSeperationLeftRight - 5;
130 t3l1.WindowY0 = BigFontSeperationTopBottom + 5;
131 t3l1.WindowY1 = 479;
132 }
133 else
134 {
135 t3l1.WindowX0 = 800 - BigFontSeperationLeftRight + 5;
136 t3l1.WindowX1 = 799;
137 t3l1.WindowY0 = 0;
138 t3l1.WindowY1 = 479 - BigFontSeperationTopBottom + 5 ;
139 }
126 140
127 t3r1.Image = &t3screen; 141 t3r1.Image = &t3screen;
128 t3r1.WindowNumberOfTextLines = t3l1.WindowNumberOfTextLines; 142 t3r1.WindowNumberOfTextLines = t3l1.WindowNumberOfTextLines;
129 t3r1.WindowLineSpacing = t3l1.WindowLineSpacing; 143 t3r1.WindowLineSpacing = t3l1.WindowLineSpacing;
130 t3r1.WindowTab = t3l1.WindowTab; 144 t3r1.WindowTab = t3l1.WindowTab;
131 t3r1.WindowX0 = BigFontSeperationLeftRight + 5; 145 if(!pSettings->FlipDisplay)
132 t3r1.WindowX1 = 799; 146 {
147 t3r1.WindowX0 = BigFontSeperationLeftRight + 5;
148 t3r1.WindowX1 = 799;
149 }
150 else
151 {
152 t3r1.WindowX0 = 0;
153 t3r1.WindowX1 = BigFontSeperationLeftRight - 5;
154 }
155
133 t3r1.WindowY0 = t3l1.WindowY0; 156 t3r1.WindowY0 = t3l1.WindowY0;
134 t3r1.WindowY1 = t3l1.WindowY1; 157 t3r1.WindowY1 = t3l1.WindowY1;
135 158
136 t3c1.Image = &t3screen; 159 t3c1.Image = &t3screen;
137 t3c1.WindowNumberOfTextLines = 2; 160 t3c1.WindowNumberOfTextLines = 2;
138 t3c1.WindowLineSpacing = t3l1.WindowLineSpacing; 161 t3c1.WindowLineSpacing = t3l1.WindowLineSpacing;
139 t3c1.WindowX0 = 0; 162 t3c1.WindowX0 = 0;
140 t3c1.WindowX1 = 799; 163 t3c1.WindowX1 = 799;
141 t3c1.WindowY0 = 0; 164 if(!pSettings->FlipDisplay)
142 t3c1.WindowY1 = BigFontSeperationTopBottom - 5; 165 {
166 t3c1.WindowY0 = 0;
167 t3c1.WindowY1 = BigFontSeperationTopBottom - 5;
168 }
169 else
170 {
171 t3c1.WindowY0 = 480 - BigFontSeperationTopBottom + 5;
172 t3c1.WindowY1 = 479;
173 }
143 174
144 t3c2.Image = &t3screen; 175 t3c2.Image = &t3screen;
145 t3c2.WindowNumberOfTextLines = 3; 176 t3c2.WindowNumberOfTextLines = 3;
146 t3c2.WindowLineSpacing = 58; 177 t3c2.WindowLineSpacing = 58;
147 t3c2.WindowX0 = 370; 178 t3c2.WindowX0 = 370;
148 t3c2.WindowX1 = 799; 179 t3c2.WindowX1 = 799;
149 t3c2.WindowY0 = 0; 180 t3c2.WindowY0 = t3c1.WindowY0;
150 t3c2.WindowY1 = BigFontSeperationTopBottom - 5; 181 t3c2.WindowY1 = t3c1.WindowY1;
151 t3c2.WindowTab = 600; 182 t3c2.WindowTab = 600;
152 } 183 }
153 184
154 185
155 void t3_refresh(void) 186 void t3_refresh(void)
181 uint8_t color; 212 uint8_t color;
182 uint8_t depthChangeRate; 213 uint8_t depthChangeRate;
183 uint8_t depthChangeAscent; 214 uint8_t depthChangeAscent;
184 point_t start, stop, startZeroLine; 215 point_t start, stop, startZeroLine;
185 216
217 SSettings* pSettings;
218 pSettings = settingsGetPointer();
219
186 start.x = 0; 220 start.x = 0;
187 stop.x = 799; 221 stop.x = 799;
188 stop.y = start.y = BigFontSeperationTopBottom; 222 stop.y = start.y = BigFontSeperationTopBottom;
189 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); 223 GFX_draw_line(tXscreen, start, stop, CLUT_Font020);
190 224
191 start.y = BigFontSeperationTopBottom; 225 start.y = BigFontSeperationTopBottom;
192 stop.y = 479; 226 stop.y = 479;
227
193 stop.x = start.x = BigFontSeperationLeftRight; 228 stop.x = start.x = BigFontSeperationLeftRight;
194 GFX_draw_line(tXscreen, start, stop, CLUT_Font020); 229 GFX_draw_line(tXscreen, start, stop, CLUT_Font020);
195 230
196 231
197 /* depth */ 232 /* depth */
320 else 355 else
321 { 356 {
322 /* ascentrate graph -standard mode */ 357 /* ascentrate graph -standard mode */
323 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0) 358 if(stateUsed->lifeData.ascent_rate_meter_per_min > 0)
324 { 359 {
325 start.y = tXl1->WindowY0 - 1; 360 if(!pSettings->FlipDisplay)
361 {
362 start.y = tXl1->WindowY0 - 1;
363 }
364 else
365 {
366 start.y = tXl1->WindowY1 + 1;
367 }
368
326 for(int i = 0; i<4;i++) 369 for(int i = 0; i<4;i++)
327 { 370 {
328 start.y += 5*8; 371 start.y += 5*8;
329 stop.y = start.y; 372 stop.y = start.y;
330 start.x = tXl1->WindowX1 - 1; 373 if(!pSettings->FlipDisplay)
374 {
375 start.x = tXl1->WindowX1 - 1;
376 }
377 else
378 {
379 start.x = tXr1->WindowX1 - 1;
380 }
331 stop.x = start.x - 17; 381 stop.x = start.x - 17;
332 GFX_draw_line(tXscreen, start, stop, 0); 382 GFX_draw_line(tXscreen, start, stop, 0);
333 } 383 }
334 // new thick bar design Sept. 2015 384 // new thick bar design Sept. 2015
335 start.x = tXl1->WindowX1 - 3 - 5; 385 if(!pSettings->FlipDisplay)
386 {
387 start.x = tXl1->WindowX1 - 3 - 5;
388 }
389 else
390 {
391 start.x = tXr1->WindowX1 - 3 - 5;
392 }
393
336 stop.x = start.x; 394 stop.x = start.x;
337 start.y = tXl1->WindowY0 - 1; 395 if(!pSettings->FlipDisplay)
396 {
397 start.y = tXl1->WindowY0 - 1;
398 }
399 else
400 {
401 start.y = tXl1->WindowY1 + 1;
402 }
403
338 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8); 404 stop.y = start.y + (uint16_t)(stateUsed->lifeData.ascent_rate_meter_per_min * 8);
339 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9 405 stop.y -= 3; // wegen der Liniendicke von 12 anstelle von 9
340 if(stop.y >= 470) 406 if(stop.y >= 470)
341 stop.y = 470; 407 stop.y = 470;
342 start.y += 7; // starte etwas weiter oben 408 start.y += 7; // starte etwas weiter oben
598 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode) 664 void t3_basics_refresh_customview(float depth, uint8_t tX_selection_customview, GFX_DrawCfgScreen *tXscreen, GFX_DrawCfgWindow* tXc1, GFX_DrawCfgWindow* tXc2, uint8_t mode)
599 { 665 {
600 char text[512]; 666 char text[512];
601 uint16_t textpointer = 0; 667 uint16_t textpointer = 0;
602 668
669 SSettings* pSettings;
670 pSettings = settingsGetPointer();
671
603 // CVIEW_T3_Decostop and CVIEW_T3_TTS 672 // CVIEW_T3_Decostop and CVIEW_T3_TTS
604 const SDecoinfo * pDecoinfo; 673 const SDecoinfo * pDecoinfo;
605 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) 674 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
606 pDecoinfo = &stateUsed->decolistBuehlmann; 675 pDecoinfo = &stateUsed->decolistBuehlmann;
607 else 676 else
630 SDivetime Stopwatch = {0,0,0,0}; 699 SDivetime Stopwatch = {0,0,0,0};
631 float fAverageDepth, fAverageDepthAbsolute; 700 float fAverageDepth, fAverageDepthAbsolute;
632 701
633 702
634 uint16_t tempWinX0; 703 uint16_t tempWinX0;
704 uint16_t tempWinX1;
635 uint16_t tempWinY0; 705 uint16_t tempWinY0;
706 uint16_t tempWinY1;
636 uint16_t tempWinC2X0; 707 uint16_t tempWinC2X0;
637 uint16_t tempWinC2Tab; 708 uint16_t tempWinC2Tab;
638 709
639 tempWinX0 = tXc1->WindowX0; 710 tempWinX0 = tXc1->WindowX0;
640 tempWinY0 = tXc1->WindowY0; 711 tempWinY0 = tXc1->WindowY0;
674 t3_basics_colorscheme_mod(text); 745 t3_basics_colorscheme_mod(text);
675 GFX_write_string(&FontT105,tXc1,text,0); 746 GFX_write_string(&FontT105,tXc1,text,0);
676 break; 747 break;
677 748
678 case CVIEW_T3_StopWatch: 749 case CVIEW_T3_StopWatch:
750
751 tempWinX0 = tXc1->WindowX0;
752 tempWinY0 = tXc1->WindowY0;
753 tempWinX1 = tXc1->WindowX1;
754 tempWinY1 = tXc1->WindowY1;
755
679 Stopwatch.Total = timer_Stopwatch_GetTime(); 756 Stopwatch.Total = timer_Stopwatch_GetTime();
680 Stopwatch.Minutes = Stopwatch.Total / 60; 757 Stopwatch.Minutes = Stopwatch.Total / 60;
681 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); 758 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 );
682 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); 759 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter();
683 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; 760 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter;
685 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth); 762 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth);
686 GFX_write_string(&FontT42,tXc1,text,0); 763 GFX_write_string(&FontT42,tXc1,text,0);
687 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); 764 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute));
688 GFX_write_string(&FontT105,tXc1,text,0); 765 GFX_write_string(&FontT105,tXc1,text,0);
689 766
690 tempWinX0 = tXc1->WindowX0; 767
691 tempWinY0 = tXc1->WindowY0; 768
692 tXc1->WindowX0 = 480; 769 if(!pSettings->FlipDisplay)
770 {
771 tXc1->WindowX0 = 480;
772 }
773 else
774 {
775 tXc1->WindowX1 = 320;
776 tXc1->WindowY0 = t3c1.WindowY0; /* select customer window */
777 }
693 // snprintf(text,TEXTSIZE,"\032\f%c%c - %c",TXT_2BYTE, TXT2BYTE_Clock, TXT_AvgDepth); 778 // snprintf(text,TEXTSIZE,"\032\f%c%c - %c",TXT_2BYTE, TXT2BYTE_Clock, TXT_AvgDepth);
779
694 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch); 780 snprintf(text,TEXTSIZE,"\032\f%c", TXT_Stopwatch);
695 GFX_write_string(&FontT42,tXc1,text,0); 781 GFX_write_string(&FontT42,tXc1,text,0);
696 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth)); 782 snprintf(text,TEXTSIZE,"\030\016%01.1f",unit_depth_float(fAverageDepth));
697 GFX_write_string(&FontT105,tXc1,text,0); 783 GFX_write_string(&FontT105,tXc1,text,0);
698 tXc1->WindowY0 = 100; 784 if(!pSettings->FlipDisplay)
785 {
786 tXc1->WindowY0 = 100;
787 }
788 else
789 {
790 tXc1->WindowY1 -= 100; /* jump to upper of two lines */
791 }
792
699 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); 793 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds);
700 GFX_write_string(&FontT105,tXc1,text,0); 794 GFX_write_string(&FontT105,tXc1,text,0);
795
701 tXc1->WindowX0 = tempWinX0; 796 tXc1->WindowX0 = tempWinX0;
702 tXc1->WindowY0 = tempWinY0; 797 tXc1->WindowY0 = tempWinY0;
798 tXc1->WindowX1 = tempWinX1;
799 tXc1->WindowY1 = tempWinY1;
703 break; 800 break;
704 801
705 case CVIEW_T3_GasList: 802 case CVIEW_T3_GasList:
706 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); 803 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist);
707 GFX_write_string(&FontT42,tXc1,text,0); 804 GFX_write_string(&FontT42,tXc1,text,0);