comparison Discovery/Src/show_logbook.c @ 567:1c95f811967c

-Add 12HR Time Support -Add firmware image only font extensions -Show english units when required in log's graphs -Show decompression info with Font84 if 10 characters long -Remove usage of ' symbol to denote minutes and instead use min abbreviation -Show english units when required on the simulation configuration screen -Remove usage of ' symbol to denote feet in in non-metric mode and use ft abbrevation
author izzni
date Tue, 24 Nov 2020 13:22:23 -0600
parents eea282e733e8
children 3860b8fa4b29
comparison
equal deleted inserted replaced
566:7761dd028386 567:1c95f811967c
119 winsmal.left = wintemp.left - 48; 119 winsmal.left = wintemp.left - 48;
120 winsmal.top = wintemp.top - 3; 120 winsmal.top = wintemp.top - 3;
121 winsmal.right = wintemp.left -1; 121 winsmal.right = wintemp.left -1;
122 winsmal.bottom = winsmal.top + 16; 122 winsmal.bottom = winsmal.top + 16;
123 123
124 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"[m]"); 124 if(settingsGetPointer()->nonMetricalSystem)
125 {
126 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"[ft]");
127 }
128 else
129 {
130 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"[m]");
131 }
125 132
126 // winsmal.left = wintemp.left - 48; 133 // winsmal.left = wintemp.left - 48;
127 char msg[3]; 134 char msg[3];
128 float deltaline = ((float)(wintemp.bottom - wintemp.top))/5; 135 float deltaline = ((float)(wintemp.bottom - wintemp.top))/5;
129 for(int i = 1; i<=5; i++) 136 for(int i = 1; i<=5; i++)
130 { 137 {
131 winsmal.top = wintemp.top + deltaline * i - 14; 138 winsmal.top = wintemp.top + deltaline * i - 14;
132 winsmal.bottom = winsmal.top + 16; 139 winsmal.bottom = winsmal.top + 16;
133 140
134 // winsmal.right = wintemp.left - 2; 141 // winsmal.right = wintemp.left - 2;
135 snprintf(msg,5,"%i",i * vstep); 142 snprintf(msg,5,"%i",unit_depth_integer(i * vstep));
136 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg); 143 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg);
137 } 144 }
138 145
139 //vertical (Time) ******************************************************************* 146 //vertical (Time) *******************************************************************
140 //--- calc time lines and labels -- 147 //--- calc time lines and labels --
419 SWindowGimpStyle winsmal; 426 SWindowGimpStyle winsmal;
420 wintemp.left = LOG_BORDER_OFFSET; 427 wintemp.left = LOG_BORDER_OFFSET;
421 wintemp.right = 799 - wintemp.left; 428 wintemp.right = 799 - wintemp.left;
422 wintemp.top = LOG_BORDER_OFFSET; 429 wintemp.top = LOG_BORDER_OFFSET;
423 wintemp.bottom = 479 - 40; 430 wintemp.bottom = 479 - 40;
431 char timeSuffix;
432 uint8_t hoursToDisplay;
424 433
425 SLogbookHeader logbookHeader; 434 SLogbookHeader logbookHeader;
426 logbook_getHeader(StepBackwards ,&logbookHeader); 435 logbook_getHeader(StepBackwards ,&logbookHeader);
427 436
428 uint16_t depthdata[1000] = { 0 }; 437 uint16_t depthdata[1000] = { 0 };
465 } 474 }
466 475
467 //Print time 476 //Print time
468 uint8_t hour = logbookHeader.timeHour; 477 uint8_t hour = logbookHeader.timeHour;
469 uint8_t minute = logbookHeader.timeMinute; 478 uint8_t minute = logbookHeader.timeMinute;
470 snprintf(text,20,"\002%02i:%02i",hour,minute); 479
480 if (settingsGetPointer()->amPMTime)
481 {
482 if (logbookHeader.timeHour > 11)
483 {
484 timeSuffix = 'P';
485 }
486 else
487 {
488 timeSuffix = 'A';
489 }
490
491 if (logbookHeader.timeHour % 12 == 0)
492 {
493 hoursToDisplay = 12;
494 }
495 else
496 {
497 hoursToDisplay = (logbookHeader.timeHour % 12);
498 }
499
500 snprintf(text,20,"\002%02i:%02i %cM",hoursToDisplay,minute,timeSuffix);
501 }
502 else
503 {
504 hoursToDisplay = logbookHeader.timeHour;
505 snprintf(text,20,"\002%02i:%02i",hoursToDisplay,minute);
506 }
507
508
471 Gfx_write_label_var(hgfx, 600, wintemp.right,10, &FontT42,CLUT_GasSensor1,text); 509 Gfx_write_label_var(hgfx, 600, wintemp.right,10, &FontT42,CLUT_GasSensor1,text);
472 510
473 //Print Dive Mode (OC/CCR/...) 511 //Print Dive Mode (OC/CCR/...)
474 switch(logbookHeader.diveMode) 512 switch(logbookHeader.diveMode)
475 { 513 {
703 winsmal.left = wintemp.right +6; 741 winsmal.left = wintemp.right +6;
704 winsmal.top = wintemp.top - 3; 742 winsmal.top = wintemp.top - 3;
705 winsmal.right = wintemp.right + 30; 743 winsmal.right = wintemp.right + 30;
706 winsmal.bottom = winsmal.top + 16; 744 winsmal.bottom = winsmal.top + 16;
707 745
708 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,"[C]"); 746 if(settingsGetPointer()->nonMetricalSystem)
747 {
748 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,"[F]");
749 }
750 else
751 {
752 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,"[C]");
753 }
709 754
710 int16_t minVal = 0; 755 int16_t minVal = 0;
711 int16_t maxVal = 0; 756 int16_t maxVal = 0;
712 int newTop = 0; 757 int newTop = 0;
713 int newBottom = 0; 758 int newBottom = 0;
724 769
725 // temperature in 1/10 �C 770 // temperature in 1/10 �C
726 int deltaline = (1 + wintemp.bottom - wintemp.top)/5; 771 int deltaline = (1 + wintemp.bottom - wintemp.top)/5;
727 char msg[3]; 772 char msg[3];
728 int tmp = maxValTop; 773 int tmp = maxValTop;
774 int converted;
729 for(int i = 1; i<=5; i++) 775 for(int i = 1; i<=5; i++)
730 { 776 {
731 tmp -= step; 777 tmp -= step;
778 if(settingsGetPointer()->nonMetricalSystem) {
779 converted = unit_temperature_integer(tmp);
780 }
781 else{
782 converted = tmp;
783 }
732 //if(tmp < 0) 784 //if(tmp < 0)
733 //break; 785 //break;
734 winsmal.top = wintemp.top + deltaline * i - 14; 786 winsmal.top = wintemp.top + deltaline * i - 14;
735 winsmal.bottom = winsmal.top + 16; 787 winsmal.bottom = winsmal.top + 16;
736 if((tmp >= 0) && (tmp < 100)) 788 if((converted >= 0) && (converted < 100))
737 snprintf(msg,2,"%1i",tmp); 789 snprintf(msg,2,"%1i",converted);
738 else 790 else
739 snprintf(msg,3,"%2i",tmp); 791 snprintf(msg,3,"%2i",converted);
740 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,msg); 792 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,msg);
741 } 793 }
742 794
743 795
744 //--- print temperature graph --- 796 //--- print temperature graph ---