comparison Discovery/Src/t7.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 5e0a75e2f00b
children 9bb9a52d6ae5
comparison
equal deleted inserted replaced
566:7761dd028386 567:1c95f811967c
678 678
679 void t7_refresh_surface(void) 679 void t7_refresh_surface(void)
680 { 680 {
681 static float debounceAmbientPressure = 0; 681 static float debounceAmbientPressure = 0;
682 char text[256]; 682 char text[256];
683 char timeSuffix;
684 uint8_t hours;
683 uint8_t loop, textIdx; 685 uint8_t loop, textIdx;
684 uint8_t date[3], year,month,day; 686 uint8_t date[3], year,month,day;
685 uint32_t color; 687 uint32_t color;
686 uint8_t customview_warnings = 0; 688 uint8_t customview_warnings = 0;
687 689
753 else 755 else
754 snprintf(text,255,"\001%02d\031:\020%02d",Stime.Hours,Stime.Minutes); 756 snprintf(text,255,"\001%02d\031:\020%02d",Stime.Hours,Stime.Minutes);
755 GFX_write_string(&FontT54,&t7surfaceR,text,3); 757 GFX_write_string(&FontT54,&t7surfaceR,text,3);
756 */ 758 */
757 // debug version: 759 // debug version:
758 if(Stime.Seconds % 2) 760
759 snprintf(text,255,"\001%02d:%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds); 761 if (settingsGetPointer()->amPMTime)
760 else if(dateNotSet) 762 {
761 snprintf(text,255,"\001\031%02d:%02d:%02d\020",Stime.Hours,Stime.Minutes,Stime.Seconds); 763 if (Stime.Hours > 11)
762 else 764 {
763 snprintf(text,255,"\001%02d\031:\020%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds); 765 timeSuffix = 'P';
764 GFX_write_string(&FontT54,&t7surfaceR,text,3); 766 }
767 else
768 {
769 timeSuffix = 'A';
770 }
771
772 if (Stime.Hours % 12 == 0)
773 {
774 hours = 12;
775 }
776 else
777 {
778 hours = (Stime.Hours % 12);
779 }
780
781 if(Stime.Seconds % 2)
782 snprintf(text,255,"\001%02d:%02d:%02d\016\016%cM\017",hours,Stime.Minutes,Stime.Seconds,timeSuffix);
783 else if(dateNotSet)
784 snprintf(text,255,"\001\031%02d:%02d:%02d\016\016%cM\017\020",hours,Stime.Minutes,Stime.Seconds,timeSuffix);
785 else
786 snprintf(text,255,"\001%02d\031:\020%02d:%02d\016\016%cM\017",hours,Stime.Minutes,Stime.Seconds,timeSuffix);
787 GFX_write_string(&FontT48,&t7surfaceR,text,3);
788 }
789 else
790 {
791 if(Stime.Seconds % 2)
792 snprintf(text,255,"\001%02d:%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds);
793 else if(dateNotSet)
794 snprintf(text,255,"\001\031%02d:%02d:%02d\020",Stime.Hours,Stime.Minutes,Stime.Seconds);
795 else
796 snprintf(text,255,"\001%02d\031:\020%02d:%02d",Stime.Hours,Stime.Minutes,Stime.Seconds);
797 GFX_write_string(&FontT54,&t7surfaceR,text,3);
798 }
765 799
766 if(settingsGetPointer()->date_format == DDMMYY) 800 if(settingsGetPointer()->date_format == DDMMYY)
767 { 801 {
768 day = 0; 802 day = 0;
769 month = 1; 803 month = 1;
1642 void t7_refresh_customview(void) 1676 void t7_refresh_customview(void)
1643 { 1677 {
1644 static uint8_t last_customview = CVIEW_END; 1678 static uint8_t last_customview = CVIEW_END;
1645 1679
1646 char text[256]; 1680 char text[256];
1681 char timeSuffix;
1682 uint8_t hoursToDisplay;
1647 uint16_t textpointer = 0; 1683 uint16_t textpointer = 0;
1648 uint16_t heading = 0; 1684 uint16_t heading = 0;
1649 int16_t start; 1685 int16_t start;
1650 uint8_t lineCountCustomtext = 0; 1686 uint8_t lineCountCustomtext = 0;
1651 int16_t shiftWindowY0; 1687 int16_t shiftWindowY0;
1847 snprintf(text,100,"\032\001%c%c",TXT_2BYTE,TXT2BYTE_Clock ); 1883 snprintf(text,100,"\032\001%c%c",TXT_2BYTE,TXT2BYTE_Clock );
1848 GFX_write_string(&FontT42, &t7cY0free, text, 1); 1884 GFX_write_string(&FontT42, &t7cY0free, text, 1);
1849 1885
1850 translateDate(stateRealGetPointer()->lifeData.dateBinaryFormat, &Sdate); 1886 translateDate(stateRealGetPointer()->lifeData.dateBinaryFormat, &Sdate);
1851 translateTime(stateRealGetPointer()->lifeData.timeBinaryFormat, &Stime); 1887 translateTime(stateRealGetPointer()->lifeData.timeBinaryFormat, &Stime);
1852 if(Stime.Seconds % 2) 1888
1853 textpointer += snprintf(&text[textpointer],100,"\030\001%02d:%02d",Stime.Hours,Stime.Minutes); 1889 if (settingsGetPointer()->amPMTime)
1854 else 1890 {
1855 textpointer += snprintf(&text[textpointer],100,"\030\001%02d\031:\030%02d",Stime.Hours,Stime.Minutes); 1891 if (Stime.Hours > 11)
1892 {
1893 timeSuffix = 'P';
1894 }
1895 else
1896 {
1897 timeSuffix = 'A';
1898 }
1899
1900 if (Stime.Hours % 12 == 0)
1901 {
1902 hoursToDisplay = 12;
1903 }
1904 else
1905 {
1906 hoursToDisplay = (Stime.Hours % 12);
1907 }
1908
1909 if(Stime.Seconds % 2)
1910 textpointer += snprintf(&text[textpointer],100,"\030\001%02d:%02d %cM",hoursToDisplay,Stime.Minutes,timeSuffix);
1911 else
1912 textpointer += snprintf(&text[textpointer],100,"\030\001%02d\031:\030%02d %cM",hoursToDisplay,Stime.Minutes,timeSuffix);
1913 }
1914 else
1915 {
1916 if(Stime.Seconds % 2)
1917 textpointer += snprintf(&text[textpointer],100,"\030\001%02d:%02d",Stime.Hours,Stime.Minutes);
1918 else
1919 textpointer += snprintf(&text[textpointer],100,"\030\001%02d\031:\030%02d",Stime.Hours,Stime.Minutes);
1920 }
1921
1856 GFX_write_string(&FontT42, &t7cY0free, text, 2); 1922 GFX_write_string(&FontT42, &t7cY0free, text, 2);
1857 1923
1858 // EAD / END 1924 // EAD / END
1859 // The equivalent air depth can be calculated for depths in metres as follows: 1925 // The equivalent air depth can be calculated for depths in metres as follows:
1860 // EAD = (Depth + 10) � Fraction of N2 / 0.79 - 10 (wikipedia) 1926 // EAD = (Depth + 10) � Fraction of N2 / 0.79 - 10 (wikipedia)
2265 t7_colorscheme_mod(TextR2); 2331 t7_colorscheme_mod(TextR2);
2266 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS) 2332 if(time_elapsed_ms(pDecoinfo->tickstamp, HAL_GetTick()) > MAX_AGE_DECOINFO_MS)
2267 TextR2[0] = '\031'; 2333 TextR2[0] = '\031';
2268 if(textlength <= 9) 2334 if(textlength <= 9)
2269 GFX_write_string(&FontT105,&t7r2,TextR2,1); 2335 GFX_write_string(&FontT105,&t7r2,TextR2,1);
2336 else if(textlength <= 10)
2337 GFX_write_string(&FontT84Spaced,&t7r2,TextR2,1);
2270 else 2338 else
2271 GFX_write_string(&FontT54,&t7r2,TextR2,1); 2339 GFX_write_string(&FontT54,&t7r2,TextR2,1);
2272 } 2340 }
2273 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) 2341 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit()))
2274 { 2342 {