Mercurial > public > ostc4
comparison Discovery/Src/show_logbook.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 | 3834b6272ee5 |
comparison
equal
deleted
inserted
replaced
109:65a6e352ce08 | 110:cc8e24374b83 |
---|---|
147 winsmal.left = wintemp.left - 48; | 147 winsmal.left = wintemp.left - 48; |
148 winsmal.top = wintemp.top - 3; | 148 winsmal.top = wintemp.top - 3; |
149 winsmal.right = wintemp.left -1; | 149 winsmal.right = wintemp.left -1; |
150 winsmal.bottom = winsmal.top + 16; | 150 winsmal.bottom = winsmal.top + 16; |
151 | 151 |
152 write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor1,"[m]"); | 152 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"[m]"); |
153 winsmal.left = wintemp.left - 48; | 153 |
154 // winsmal.left = wintemp.left - 48; | |
154 char msg[3]; | 155 char msg[3]; |
155 float deltaline = ((float)(wintemp.bottom - wintemp.top))/5; | 156 float deltaline = ((float)(wintemp.bottom - wintemp.top))/5; |
156 for(int i = 1; i<=5; i++) | 157 for(int i = 1; i<=5; i++) |
157 { | 158 { |
158 | |
159 winsmal.top = wintemp.top + deltaline * i - 14; | 159 winsmal.top = wintemp.top + deltaline * i - 14; |
160 winsmal.bottom = winsmal.top + 16; | 160 winsmal.bottom = winsmal.top + 16; |
161 winsmal.right = wintemp.left - 2; | 161 |
162 // winsmal.right = wintemp.left - 2; | |
162 snprintf(msg,5,"%i",i * vstep); | 163 snprintf(msg,5,"%i",i * vstep); |
163 write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor1,msg); | 164 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg); |
164 } | 165 } |
165 | 166 |
166 //vertical (Time) ******************************************************************* | 167 //vertical (Time) ******************************************************************* |
167 //--- calc time lines and labels -- | 168 //--- calc time lines and labels -- |
168 int timestep = 0; | 169 int timestep = 0; |
186 winsmal.left = wintemp.left; | 187 winsmal.left = wintemp.left; |
187 winsmal.top = wintemp.top - 40; | 188 winsmal.top = wintemp.top - 40; |
188 winsmal.right = winsmal.left + 60; | 189 winsmal.right = winsmal.left + 60; |
189 winsmal.bottom = winsmal.top + 16; | 190 winsmal.bottom = winsmal.top + 16; |
190 | 191 |
191 | 192 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"min"); |
192 for(int i = 1; i<=lines; i++) | 193 for(int i = 1; i<=lines; i++) |
193 { | 194 { |
194 winsmal.left= wintemp.left + vdeltaline * i - 15; | 195 winsmal.left= wintemp.left + vdeltaline * i - 15; |
195 winsmal.right = winsmal.left + 30; | 196 winsmal.right = winsmal.left + 30; |
196 snprintf(msg,5,"%3i",i * timestep); | 197 snprintf(msg,5,"%3i",i * timestep); |
197 write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor1,msg); | 198 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg); |
198 } | 199 } |
199 winsmal.left = wintemp.left;// - 9; | 200 winsmal.left = wintemp.left;// - 9; |
200 winsmal.top = wintemp.top - 40; | 201 winsmal.top = wintemp.top - 40; |
201 winsmal.right = winsmal.left + 60; | 202 winsmal.right = winsmal.left + 60; |
202 write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor1,"min");; | |
203 | 203 |
204 //--- print depth graph --- | 204 //--- print depth graph --- |
205 //adapt window | 205 //adapt window |
206 int winhight = wintemp.bottom - wintemp.top; | 206 int winhight = wintemp.bottom - wintemp.top; |
207 int newhight = (winhight * maxDepth)/vscale; | 207 int newhight = (winhight * maxDepth)/vscale; |
236 } | 236 } |
237 else | 237 else |
238 GFX_graph_print(hgfx,&wintemp,saveTop,1,0,datamax, decostopdata,dataLength, CLUT_NiceGreen, NULL); | 238 GFX_graph_print(hgfx,&wintemp,saveTop,1,0,datamax, decostopdata,dataLength, CLUT_NiceGreen, NULL); |
239 } | 239 } |
240 | 240 |
241 if(settingsGetPointer()->FlipDisplay) | |
242 { | |
243 winsmal.right = 800 - wintemp.left; | |
244 winsmal.left = 800 - wintemp.right; | |
245 winsmal.bottom = wintemp.bottom; | |
246 winsmal.top = wintemp.top; | |
247 } | |
248 else | |
249 { | |
250 winsmal.right = wintemp.right; | |
251 winsmal.left = wintemp.left; | |
252 winsmal.bottom = wintemp.bottom; | |
253 winsmal.top = wintemp.top; | |
254 } | |
255 | |
241 switch(mode) | 256 switch(mode) |
242 { | 257 { |
243 case 0: | 258 case 0: |
244 GFX_graph_print(hgfx,&wintemp,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); | 259 GFX_graph_print(hgfx,&winsmal,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); |
245 break; | 260 break; |
246 case 1: | 261 case 1: |
247 GFX_graph_print(hgfx,&wintemp,saveBottom,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); | 262 GFX_graph_print(hgfx,&winsmal,saveBottom,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); |
248 break; | 263 break; |
249 case 2: | 264 case 2: |
250 if(*colordata) | 265 if(*colordata) |
251 GFX_graph_print(hgfx,&wintemp,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); | 266 GFX_graph_print(hgfx,&winsmal,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor0,colordata); |
252 else | 267 else |
253 GFX_graph_print(hgfx,&wintemp,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); | 268 GFX_graph_print(hgfx,&winsmal,0,1,0,datamax, depthdata,dataLength,CLUT_GasSensor1, NULL); |
254 } | 269 } |
255 | |
256 } | 270 } |
257 | 271 |
258 | 272 |
259 | 273 |
260 /** | 274 /** |
450 uint8_t year = logbookHeader.dateYear; | 464 uint8_t year = logbookHeader.dateYear; |
451 uint8_t month = logbookHeader.dateMonth; | 465 uint8_t month = logbookHeader.dateMonth; |
452 uint8_t day = logbookHeader.dateDay; | 466 uint8_t day = logbookHeader.dateDay; |
453 char text[40]; | 467 char text[40]; |
454 snprintf(text, 20, "20%02i-%02i-%02i", year, month, day); | 468 snprintf(text, 20, "20%02i-%02i-%02i", year, month, day); |
455 Gfx_write_label_var(hgfx, 30, 150,10, &FontT42,CLUT_GasSensor1,text); | 469 |
470 Gfx_write_label_var(hgfx, 30, 250,10, &FontT42,CLUT_GasSensor1,text); | |
471 | |
456 | 472 |
457 // Print logbook number with offset | 473 // Print logbook number with offset |
458 if(settingsGetPointer()->logbookOffset) | 474 if(settingsGetPointer()->logbookOffset) |
459 { | 475 { |
460 int32_t logNumber; | 476 int32_t logNumber; |
533 } | 549 } |
534 Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); | 550 Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); |
535 winsmal.left = 30; | 551 winsmal.left = 30; |
536 winsmal.top = top -3; | 552 winsmal.top = top -3; |
537 winsmal.bottom = winsmal.top + FontT42.height; | 553 winsmal.bottom = winsmal.top + FontT42.height; |
554 | |
555 if(maxdepth < 10) | |
556 { | |
557 winsmal.left = 137; | |
558 } | |
559 else if(maxdepth < 100) | |
560 { | |
561 winsmal.left = 151; | |
562 } | |
563 else | |
564 { | |
565 winsmal.left = 147; | |
566 } | |
538 winsmal.right = winsmal.left + 50; | 567 winsmal.right = winsmal.left + 50; |
539 if(maxdepth < 10) | 568 |
540 { | 569 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,top, &FontT24,CLUT_GasSensor4,"max"); |
541 winsmal.left = 137; | |
542 } | |
543 else if(maxdepth < 100) | |
544 { | |
545 winsmal.left = 151; | |
546 } | |
547 else | |
548 { | |
549 winsmal.left = 147; | |
550 } | |
551 write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor4,"max"); | |
552 snprintf(text,3,"%c%c" | 570 snprintf(text,3,"%c%c" |
553 , unit_depth_char1() | 571 , unit_depth_char1() |
554 , unit_depth_char2() | 572 , unit_depth_char2() |
555 ); | 573 ); |
556 Gfx_write_label_var(hgfx, winsmal.left - 37, 250,top, &FontT42,CLUT_GasSensor4,text); | 574 Gfx_write_label_var(hgfx, winsmal.left - 37, 250,top, &FontT42,CLUT_GasSensor4,text); |
568 else | 586 else |
569 { | 587 { |
570 snprintf(text,20,"%i.%i",avrdepth,avrdepth_dcm); | 588 snprintf(text,20,"%i.%i",avrdepth,avrdepth_dcm); |
571 } | 589 } |
572 Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); | 590 Gfx_write_label_var(hgfx, 30, 250,top, &FontT42,CLUT_GasSensor1,text); |
591 | |
573 winsmal.left = 30; | 592 winsmal.left = 30; |
574 winsmal.top = top -3; | 593 winsmal.top = top -3; |
575 winsmal.bottom = winsmal.top + FontT42.height; | 594 winsmal.bottom = winsmal.top + FontT42.height; |
595 | |
596 /* put avg behind previous string */ | |
597 if(avrdepth < 10) | |
598 { | |
599 winsmal.left = 137 ; | |
600 } | |
601 else if(avrdepth < 100) | |
602 { | |
603 winsmal.left = 151; | |
604 } | |
605 else | |
606 { | |
607 winsmal.left = 147; | |
608 } | |
576 winsmal.right = winsmal.left + 50; | 609 winsmal.right = winsmal.left + 50; |
577 if(avrdepth < 10) | 610 |
578 { | 611 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor4,"avg"); |
579 winsmal.left = 137 ; | |
580 } | |
581 else if(avrdepth < 100) | |
582 { | |
583 winsmal.left = 151; | |
584 } | |
585 else | |
586 { | |
587 winsmal.left = 147; | |
588 } | |
589 write_label_(hgfx, winsmal,&FontT24,CLUT_GasSensor4,"avg"); | |
590 snprintf(text,3,"%c%c" | 612 snprintf(text,3,"%c%c" |
591 , unit_depth_char1() | 613 , unit_depth_char1() |
592 , unit_depth_char2() | 614 , unit_depth_char2() |
593 ); | 615 ); |
594 Gfx_write_label_var(hgfx, winsmal.left - 37, 250,top, &FontT42,CLUT_GasSensor4,text); | 616 Gfx_write_label_var(hgfx, winsmal.left - 37, 250,top, &FontT42,CLUT_GasSensor4,text); |
632 | 654 |
633 //--- print coordinate system & depth graph with gaschanges --- | 655 //--- print coordinate system & depth graph with gaschanges --- |
634 wintemp.left = 330; | 656 wintemp.left = 330; |
635 wintemp.top = 160; | 657 wintemp.top = 160; |
636 wintemp.bottom -= 40; | 658 wintemp.bottom -= 40; |
659 | |
637 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 1, dataLength, depthdata, gasdata, NULL); | 660 show_logbook_draw_depth_graph(hgfx, StepBackwards, &wintemp, 1, dataLength, depthdata, gasdata, NULL); |
638 } | 661 } |
639 | 662 |
640 | 663 |
641 void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards) | 664 void show_logbook_logbook_show_log_page2(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards) |
680 winsmal.left = wintemp.right +6; | 703 winsmal.left = wintemp.right +6; |
681 winsmal.top = wintemp.top - 3; | 704 winsmal.top = wintemp.top - 3; |
682 winsmal.right = wintemp.right + 30; | 705 winsmal.right = wintemp.right + 30; |
683 winsmal.bottom = winsmal.top + 16; | 706 winsmal.bottom = winsmal.top + 16; |
684 | 707 |
685 write_label_(hgfx, winsmal,&FontT24,CLUT_LogbookTemperature,"[C]"); | 708 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,"[C]"); |
686 | |
687 | 709 |
688 int16_t minVal = 0; | 710 int16_t minVal = 0; |
689 int16_t maxVal = 0; | 711 int16_t maxVal = 0; |
690 int newTop = 0; | 712 int newTop = 0; |
691 int newBottom = 0; | 713 int newBottom = 0; |
713 winsmal.bottom = winsmal.top + 16; | 735 winsmal.bottom = winsmal.top + 16; |
714 if((tmp >= 0) && (tmp < 100)) | 736 if((tmp >= 0) && (tmp < 100)) |
715 snprintf(msg,2,"%1i",tmp); | 737 snprintf(msg,2,"%1i",tmp); |
716 else | 738 else |
717 snprintf(msg,3,"%2i",tmp); | 739 snprintf(msg,3,"%2i",tmp); |
718 write_label_(hgfx, winsmal,&FontT24,CLUT_LogbookTemperature,msg); | 740 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,msg); |
719 } | 741 } |
720 | 742 |
721 | 743 |
722 //--- print temperature graph --- | 744 //--- print temperature graph --- |
723 // input tempdata[i], maxtmpline, mintmpline, maxTmp, minTmp, deltaline, wintemp.top, dataLength, datamax, | 745 // input tempdata[i], maxtmpline, mintmpline, maxTmp, minTmp, deltaline, wintemp.top, dataLength, datamax, |
1015 uint8_t color = get_colour(i); | 1037 uint8_t color = get_colour(i); |
1016 | 1038 |
1017 print_gas_name(gas_name,15,logbookHeader.gasordil[i].oxygen_percentage,logbookHeader.gasordil[i].helium_percentage); | 1039 print_gas_name(gas_name,15,logbookHeader.gasordil[i].oxygen_percentage,logbookHeader.gasordil[i].helium_percentage); |
1018 snprintf(msg,15,"G%i: %s",i + 1, gas_name); | 1040 snprintf(msg,15,"G%i: %s",i + 1, gas_name); |
1019 //msg[10] = 0; | 1041 //msg[10] = 0; |
1020 write_label_(hgfx, winsmal,&FontT24,color,msg); | 1042 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg); |
1021 } | 1043 } |
1022 } | 1044 } |
1023 | 1045 |
1024 //--- define buttons --- | 1046 //--- define buttons --- |
1025 /*if(*ghost_char_logfile_oxydata) | 1047 /*if(*ghost_char_logfile_oxydata) |
1087 { | 1109 { |
1088 winsmal.left = wintemp.left + 2; | 1110 winsmal.left = wintemp.left + 2; |
1089 winsmal.right = winsmal.left + 55; | 1111 winsmal.right = winsmal.left + 55; |
1090 color = CLUT_GasSensor1;//LOGBOOK_GRAPH_DEPTH; | 1112 color = CLUT_GasSensor1;//LOGBOOK_GRAPH_DEPTH; |
1091 | 1113 |
1092 write_label_(hgfx, winsmal,&FontT24,color,"depth"); | 1114 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"depth"); |
1093 | 1115 |
1094 } | 1116 } |
1095 winsmal.left = 799 - 67;//wintemp.right -67; | 1117 winsmal.left = 799 - 67;//wintemp.right -67; |
1096 winsmal.right = winsmal.left;// + 45; | 1118 winsmal.right = winsmal.left;// + 45; |
1097 | 1119 |
1098 color = CLUT_LogbookTemperature;//LOGBOOK_GRAPH_DEPTH; | 1120 color = CLUT_LogbookTemperature;//LOGBOOK_GRAPH_DEPTH; |
1099 if(logbookHeader.diveMode != DIVEMODE_CCR) | 1121 if(logbookHeader.diveMode != DIVEMODE_CCR) |
1100 write_label_(hgfx, winsmal,&FontT24,color,"\002PP O2"); | 1122 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002PP O2"); |
1101 else | 1123 else |
1102 if(logbookHeader.CCRmode != CCRMODE_Sensors) | 1124 if(logbookHeader.CCRmode != CCRMODE_Sensors) |
1103 write_label_(hgfx, winsmal,&FontT24,color,"\002SETPOINT"); | 1125 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SETPOINT"); |
1104 else | 1126 else |
1105 write_label_(hgfx, winsmal,&FontT24,color,"\002SENSORS"); | 1127 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"\002SENSORS"); |
1106 | 1128 |
1107 //*** PP O2 **************************************************** | 1129 //*** PP O2 **************************************************** |
1108 //calc lines and labels | 1130 //calc lines and labels |
1109 int datamax = 0; | 1131 int datamax = 0; |
1110 int datamin = 10000; | 1132 int datamin = 10000; |
1140 winsmal.right = wintemp.right + 30; | 1162 winsmal.right = wintemp.right + 30; |
1141 winsmal.bottom = winsmal.top + 16; | 1163 winsmal.bottom = winsmal.top + 16; |
1142 //winsmal.font = ft_tiny + ft_SLIM; | 1164 //winsmal.font = ft_tiny + ft_SLIM; |
1143 color = CLUT_LogbookTemperature;// = LOGBOOK_GRAPH_TEMP; | 1165 color = CLUT_LogbookTemperature;// = LOGBOOK_GRAPH_TEMP; |
1144 | 1166 |
1145 write_label_(hgfx, winsmal,&FontT24,color,"bar"); | 1167 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,"bar"); |
1146 | 1168 |
1147 int deltaline = (wintemp.bottom - wintemp.top)/5; | 1169 int deltaline = (wintemp.bottom - wintemp.top)/5; |
1148 char msg[4]; | 1170 char msg[4]; |
1149 float oxy = maxoxyline; | 1171 float oxy = maxoxyline; |
1150 for(int i = 1; i<=5; i++) | 1172 for(int i = 1; i<=5; i++) |
1153 if(oxy < 0) | 1175 if(oxy < 0) |
1154 break; | 1176 break; |
1155 winsmal.top = wintemp.top + deltaline * i - 8; | 1177 winsmal.top = wintemp.top + deltaline * i - 8; |
1156 winsmal.bottom = winsmal.top + 16; | 1178 winsmal.bottom = winsmal.top + 16; |
1157 snprintf(msg,4,"%1.1f",oxy); | 1179 snprintf(msg,4,"%1.1f",oxy); |
1158 write_label_(hgfx, winsmal,&FontT24,color,msg); | 1180 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg); |
1159 //oled_write(OVERLAY, &winsmal,msg,false,true); | 1181 //oled_write(OVERLAY, &winsmal,msg,false,true); |
1160 } | 1182 } |
1161 | 1183 |
1162 //--- print PP O2 graph --- | 1184 //--- print PP O2 graph --- |
1163 //Adapt window | 1185 //Adapt window |