comparison Discovery/Src/t3.c @ 496:9623f166b0c0

Bugfix display of disabled screen. It is possible to select a screen as default which is in parallel disabled in the selection view. To avoid this the enable / disable state is not also checked when entering dive mode. The check function was depending on an ACTION. The functionality has been changed to allow the function call without ACTION. Changed setting of compass circle position from constant position to variable This was needed to reuse the same function in several views with different compass position Added new views Navigation and Depth data Both views were basically already available but the idea behind the layout is to combine all information needed for navigation dives (compass + timer) in one view. The classic maxdepth view just showed the maxdepth with a black box on the right side. this box is now used for display of average depth (shown in classic view Stopwatch) Minor changes in compass paint function to improve code readability Use same Y offset for all views While switching across the views some number were shown ~20 pixel higher than others. This was caused by the usage of the line selection which works for some fonts but not for all => set linenumber to 0 for all views
author Ideenmodellierer
date Mon, 24 Aug 2020 19:53:27 +0200
parents 65c7b009136f
children 5185ade91096
comparison
equal deleted inserted replaced
495:fa8b09544b3d 496:9623f166b0c0
70 CVIEW_T3_TTS, 70 CVIEW_T3_TTS,
71 CVIEW_T3_ppO2andGas, 71 CVIEW_T3_ppO2andGas,
72 CVIEW_T3_END 72 CVIEW_T3_END
73 }; 73 };
74 74
75 75 #ifdef ENABLE_BIGFONT_VX
76 const uint8_t *t3_customviews = t3_customviewsStandard; 76 const uint8_t t3_customviewsV2[] =
77 {
78 CVIEW_T3_Decostop,
79 CVIEW_sensors,
80 CVIEW_T3_Navigation,
81 CVIEW_T3_DepthData,
82 CVIEW_T3_TTS,
83 CVIEW_T3_ppO2andGas,
84 CVIEW_T3_END
85 };
86 #endif
77 87
78 /* Private function prototypes -----------------------------------------------*/ 88 /* Private function prototypes -----------------------------------------------*/
79 void t3_refresh_divemode(void); 89 void t3_refresh_divemode(void);
80 90
81 uint8_t t3_test_customview_warnings(void); 91 uint8_t t3_test_customview_warnings(void);
82 void t3_refresh_customview(float depth); 92 void t3_refresh_customview(float depth);
83 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, uint16_t ActualHeading, uint16_t UserSetHeading); 93 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading);
84 94
85 /* Exported functions --------------------------------------------------------*/ 95 /* Exported functions --------------------------------------------------------*/
86 96
87 void t3_init(void) 97 void t3_init(void)
88 { 98 {
89 SSettings* pSettings; 99 SSettings* pSettings;
90 pSettings = settingsGetPointer(); 100 pSettings = settingsGetPointer();
91 101
92 t3_selection_customview = t3_customviews[0]; 102 t3_selection_customview = t3_customviewsStandard[0];
93 103
94 t3screen.FBStartAdress = 0; 104 t3screen.FBStartAdress = 0;
95 t3screen.ImageHeight = 480; 105 t3screen.ImageHeight = 480;
96 t3screen.ImageWidth = 800; 106 t3screen.ImageWidth = 800;
97 t3screen.LayerIndex = 1; 107 t3screen.LayerIndex = 1;
161 } 171 }
162 172
163 173
164 void t3_refresh(void) 174 void t3_refresh(void)
165 { 175 {
176 static uint8_t last_mode = MODE_SURFACE;
177
166 SStateList status; 178 SStateList status;
167 get_globalStateList(&status); 179 get_globalStateList(&status);
168 180
169 if(stateUsed->mode != MODE_DIVE) 181 if(stateUsed->mode != MODE_DIVE)
170 { 182 {
173 } 185 }
174 186
175 if(status.base != BaseHome) 187 if(status.base != BaseHome)
176 return; 188 return;
177 189
190 if(last_mode != MODE_DIVE) /* Select customview */
191 {
192 if((settingsGetPointer()->tX_customViewTimeout == 0) && (settingsGetPointer()->showDebugInfo))
193 {
194 t3_selection_customview = CVIEW_noneOrDebug;
195 }
196 else
197 {
198 t3_selection_customview = settingsGetPointer()->tX_customViewPrimary;
199 }
200 t3_change_customview(ACTION_END);
201 }
178 t3screen.FBStartAdress = getFrame(24); 202 t3screen.FBStartAdress = getFrame(24);
179 t3_refresh_divemode(); 203 t3_refresh_divemode();
180 GFX_SetFramesTopBottom(t3screen.FBStartAdress, 0,480); 204 GFX_SetFramesTopBottom(t3screen.FBStartAdress, 0,480);
181 releaseAllFramesExcept(24,t3screen.FBStartAdress); 205 releaseAllFramesExcept(24,t3screen.FBStartAdress);
206 last_mode = stateUsed->mode;
182 } 207 }
183 208
184 209
185 /* Private functions ---------------------------------------------------------*/ 210 /* Private functions ---------------------------------------------------------*/
186 211
472 t3_basics_show_customview_warnings(&t3c1); 497 t3_basics_show_customview_warnings(&t3c1);
473 else 498 else
474 t3_refresh_customview(depth_meter); 499 t3_refresh_customview(depth_meter);
475 500
476 if(stateUsed->warnings.lowBattery) 501 if(stateUsed->warnings.lowBattery)
477 t3_basics_battery_low_customview_extra(&t3c1); 502 t3_basics_battery_low_customview_extra(&t3r1); //t3c1);
478 } 503 }
479 504
480 505
481 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1) 506 void t3_basics_battery_low_customview_extra(GFX_DrawCfgWindow* tXc1)
482 { 507 {
483 char TextC1[256]; 508 char TextC1[256];
484 509
485 TextC1[0] = '\002'; 510 TextC1[0] = ' ';//'\002';
486 TextC1[1] = '\f'; 511 TextC1[1] = '\f';
487 TextC1[2] = '\025'; 512 TextC1[2] = '\025';
488 TextC1[3] = '3'; 513 TextC1[3] = '3';
489 TextC1[4] = '1'; 514 TextC1[4] = '1';
490 TextC1[5] = '1'; 515 TextC1[5] = '1';
654 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth; 679 float fPpO2limitHigh, fPpO2limitLow, fPpO2ofGasAtThisDepth;
655 const SGasLine * pGasLine; 680 const SGasLine * pGasLine;
656 uint8_t oxygen, helium; 681 uint8_t oxygen, helium;
657 uint8_t lineNumber; 682 uint8_t lineNumber;
658 683
684 /* compass position */
685 point_t center;
686
659 // CVIEW_T3_StopWatch 687 // CVIEW_T3_StopWatch
660 SDivetime Stopwatch = {0,0,0,0}; 688 SDivetime Stopwatch = {0,0,0,0};
661 float fAverageDepth, fAverageDepthAbsolute; 689 float fAverageDepth, fAverageDepthAbsolute;
662 690
663 uint16_t tempWinX0; 691 uint16_t tempWinX0;
670 uint16_t tempWinC2Y1; 698 uint16_t tempWinC2Y1;
671 uint16_t tempWinC2Tab; 699 uint16_t tempWinC2Tab;
672 700
673 tempWinX0 = tXc1->WindowX0; 701 tempWinX0 = tXc1->WindowX0;
674 tempWinY0 = tXc1->WindowY0; 702 tempWinY0 = tXc1->WindowY0;
703 tempWinX1 = tXc1->WindowX1;
704 tempWinY1 = tXc1->WindowY1;
675 705
676 tempWinC2X0 = tXc2->WindowX0; 706 tempWinC2X0 = tXc2->WindowX0;
677 tempWinC2Y0 = tXc2->WindowY0; 707 tempWinC2Y0 = tXc2->WindowY0;
678 tempWinC2X1 = tXc2->WindowX1; 708 tempWinC2X1 = tXc2->WindowX1;
679 tempWinC2Y1 = tXc2->WindowY1; 709 tempWinC2Y1 = tXc2->WindowY1;
722 } 752 }
723 break; 753 break;
724 754
725 case CVIEW_T3_StopWatch: 755 case CVIEW_T3_StopWatch:
726 756
727 tempWinX0 = tXc1->WindowX0;
728 tempWinY0 = tXc1->WindowY0;
729 tempWinX1 = tXc1->WindowX1;
730 tempWinY1 = tXc1->WindowY1;
731
732 Stopwatch.Total = timer_Stopwatch_GetTime(); 757 Stopwatch.Total = timer_Stopwatch_GetTime();
733 Stopwatch.Minutes = Stopwatch.Total / 60; 758 Stopwatch.Minutes = Stopwatch.Total / 60;
734 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 ); 759 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 );
735 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter(); 760 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter();
736 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; 761 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter;
738 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth); 763 snprintf(text,TEXTSIZE,"\032\f%c",TXT_AvgDepth);
739 GFX_write_string(&FontT42,tXc1,text,0); 764 GFX_write_string(&FontT42,tXc1,text,0);
740 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute)); 765 snprintf(text,TEXTSIZE,"\030\003\016%01.1f",unit_depth_float(fAverageDepthAbsolute));
741 GFX_write_string(&FontT105,tXc1,text,0); 766 GFX_write_string(&FontT105,tXc1,text,0);
742 767
743
744
745 if(!pSettings->FlipDisplay) 768 if(!pSettings->FlipDisplay)
746 { 769 {
747 tXc1->WindowX0 = 480; 770 tXc1->WindowX0 = 480;
748 } 771 }
749 else 772 else
767 } 790 }
768 791
769 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds); 792 snprintf(text,TEXTSIZE,"\030%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds);
770 GFX_write_string(&FontT105,tXc1,text,0); 793 GFX_write_string(&FontT105,tXc1,text,0);
771 794
772 tXc1->WindowX0 = tempWinX0; 795 break;
773 tXc1->WindowY0 = tempWinY0;
774 tXc1->WindowX1 = tempWinX1;
775 tXc1->WindowY1 = tempWinY1;
776 break;
777 796
778 case CVIEW_T3_GasList: 797 case CVIEW_T3_GasList:
779 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist); 798 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Gaslist);
780 GFX_write_string(&FontT42,tXc1,text,0); 799 GFX_write_string(&FontT42,tXc1,text,0);
781 800
782 textpointer = 0; 801 textpointer = 0;
783 tempWinC2X0 = tXc2->WindowX0;
784 tempWinC2Tab = tXc2->WindowTab;
785 tXc2->WindowX0 = 0; 802 tXc2->WindowX0 = 0;
786 tXc2->WindowTab = 800/2; 803 tXc2->WindowTab = 800/2;
787 804
788 if(pSettings->FlipDisplay) 805 if(pSettings->FlipDisplay)
789 { 806 {
834 text[textpointer++] = 0; 851 text[textpointer++] = 0;
835 GFX_write_string(&FontT105,tXc1,text,0); 852 GFX_write_string(&FontT105,tXc1,text,0);
836 break; 853 break;
837 854
838 case CVIEW_Compass: 855 case CVIEW_Compass:
856 center.x = 600;
857 center.y = 116;
839 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); 858 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass);
840 GFX_write_string(&FontT42,tXc1,text,0); 859 GFX_write_string(&FontT42,tXc1,text,0);
841 snprintf(text,100,"\030\003%03i`",(uint16_t)stateUsed->lifeData.compass_heading); 860 snprintf(text,100,"\030\003%03i`",(uint16_t)stateUsed->lifeData.compass_heading);
842 GFX_write_string(&FontT105,tXc1,text,0); 861 GFX_write_string(&FontT105,tXc1,text,0);
843 t3_basics_compass(tXscreen, (uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading); 862 t3_basics_compass(tXscreen, center, (uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading);
844 break; 863 break;
845 864
846 case CVIEW_T3_Decostop: 865 case CVIEW_T3_Decostop:
847 default: 866 default:
848 // decostop 867 // decostop
871 , unit_depth_char1_T105() 890 , unit_depth_char1_T105()
872 , unit_depth_char2_T105() 891 , unit_depth_char2_T105()
873 , (nextstopLengthSeconds+59)/60); 892 , (nextstopLengthSeconds+59)/60);
874 // old without feet hw 170703 snprintf(&text[textpointer],TEXTSIZE,"\020\003%um %u'",nextstopDepthMeter,(nextstopLengthSeconds+59)/60); 893 // old without feet hw 170703 snprintf(&text[textpointer],TEXTSIZE,"\020\003%um %u'",nextstopDepthMeter,(nextstopLengthSeconds+59)/60);
875 t3_basics_colorscheme_mod(text); 894 t3_basics_colorscheme_mod(text);
876 GFX_write_string(&FontT105,tXc1,text,1); 895 GFX_write_string(&FontT105,tXc1,text,0);
877 } 896 }
878 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit())) 897 else if(SafetyStopTime.Total && (depth > timer_Safetystop_GetDepthUpperLimit()))
879 { 898 {
880 textpointer = 0; 899 textpointer = 0;
881 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2); 900 snprintf(&text[textpointer],TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_SafetyStop2);
882 GFX_write_string(&FontT42,tXc1,text,0); 901 GFX_write_string(&FontT42,tXc1,text,0);
883 902
884 textpointer = 0; 903 textpointer = 0;
885 snprintf(&text[textpointer],TEXTSIZE,"\020\003\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds); 904 snprintf(&text[textpointer],TEXTSIZE,"\020\003\016%u:%02u",SafetyStopTime.Minutes,SafetyStopTime.Seconds);
886 t3_basics_colorscheme_mod(text); 905 t3_basics_colorscheme_mod(text);
887 GFX_write_string(&FontT105,tXc1,text,1); 906 GFX_write_string(&FontT105,tXc1,text,0);
888 } 907 }
889 else if(pDecoinfo->output_ndl_seconds) // NDL 908 else if(pDecoinfo->output_ndl_seconds) // NDL
890 { 909 {
891 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit); 910 snprintf(text,TEXTSIZE,"\032\f%c",TXT_Nullzeit);
892 GFX_write_string(&FontT42,tXc1,text,0); 911 GFX_write_string(&FontT42,tXc1,text,0);
893 if(pDecoinfo->output_ndl_seconds < 1000 * 60) 912 if(pDecoinfo->output_ndl_seconds < 1000 * 60)
894 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60); 913 snprintf(text,TEXTSIZE,"\020\003%i'",pDecoinfo->output_ndl_seconds/60);
895 else 914 else
896 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600); 915 snprintf(text,TEXTSIZE,"\020\003%ih",pDecoinfo->output_ndl_seconds/3600);
897 t3_basics_colorscheme_mod(text); 916 t3_basics_colorscheme_mod(text);
898 GFX_write_string(&FontT105,tXc1,text,1); 917 GFX_write_string(&FontT105,tXc1,text,0);
899 } 918 }
900 break; 919 break;
901 920
902 case CVIEW_sensors: 921 case CVIEW_sensors:
903 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor); 922 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE,TXT2BYTE_O2monitor);
922 { 941 {
923 if(stateUsed->warnings.sensorOutOfBounds[i]) 942 if(stateUsed->warnings.sensorOutOfBounds[i])
924 text[textpointer++] = '\025'; 943 text[textpointer++] = '\025';
925 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.1f",stateUsed->lifeData.ppO2Sensor_bar[i]); 944 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.1f",stateUsed->lifeData.ppO2Sensor_bar[i]);
926 } 945 }
927 GFX_write_string(&FontT144,tXc1,text,1); 946 GFX_write_string(&FontT144,tXc1,text,0);
928 } 947 }
929 break; 948 break;
930 949
931 case CVIEW_T3_MaxDepth: 950 case CVIEW_T3_MaxDepth:
932 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); 951 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
958 GFX_write_string(&FontT105,tXc1,text,0); 977 GFX_write_string(&FontT105,tXc1,text,0);
959 } 978 }
960 } 979 }
961 else 980 else
962 { 981 {
963 GFX_write_string(&FontT105,tXc1,text,1); 982 GFX_write_string(&FontT105,tXc1,text,0);
964 } 983 }
965 break; 984 break;
966 985
967 case CVIEW_T3_TTS: 986 case CVIEW_T3_TTS:
968 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS); 987 snprintf(text,TEXTSIZE,"\032\f%c",TXT_TTS);
972 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60) 991 if(pDecoinfo->output_time_to_surface_seconds < 1000 * 60)
973 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60); 992 snprintf(text,TEXTSIZE,"\020\003\002%i'",(pDecoinfo->output_time_to_surface_seconds + 59)/ 60);
974 else 993 else
975 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600); 994 snprintf(text,TEXTSIZE,"\020\003\002%ih",(pDecoinfo->output_time_to_surface_seconds + 59)/ 3600);
976 t3_basics_colorscheme_mod(text); 995 t3_basics_colorscheme_mod(text);
977 GFX_write_string(&FontT105,tXc1,text,1); 996 GFX_write_string(&FontT105,tXc1,text,0);
978 } 997 }
979 break; 998 break;
980 999
981 case CVIEW_T3_ppO2andGas: 1000 case CVIEW_T3_ppO2andGas:
982 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2); 1001 snprintf(text,TEXTSIZE,"\032\f%c",TXT_ppO2);
983 GFX_write_string(&FontT42,tXc1,text,0); 1002 GFX_write_string(&FontT42,tXc1,text,0);
984 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2); 1003 snprintf(text,TEXTSIZE,"\020\003%01.2f",stateUsed->lifeData.ppO2);
985 t3_basics_colorscheme_mod(text); 1004 t3_basics_colorscheme_mod(text);
986 GFX_write_string(&FontT105,tXc1,text,1); 1005 GFX_write_string(&FontT105,tXc1,text,0);
987 1006
988 textpointer = 0; 1007 textpointer = 0;
989 text[textpointer++] = '\020'; 1008 text[textpointer++] = '\020';
990 text[textpointer++] = '\003'; 1009 text[textpointer++] = '\003';
991 oxygen_percentage = 100; 1010 oxygen_percentage = 100;
993 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage; 1012 oxygen_percentage -= stateUsed->lifeData.actualGas.helium_percentage;
994 text[textpointer++] = '\002'; 1013 text[textpointer++] = '\002';
995 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]); 1014 tHome_gas_writer(oxygen_percentage,stateUsed->lifeData.actualGas.helium_percentage,&text[textpointer]);
996 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage); 1015 //textpointer = snprintf(&text[textpointer],TEXTSIZE,"\020\002%02u/%02u",oxygen_percentage, stateUsed->lifeData.actualGas.helium_percentage);
997 t3_basics_colorscheme_mod(text); 1016 t3_basics_colorscheme_mod(text);
998 GFX_write_string(&FontT48,tXc1,text,1); 1017 GFX_write_string(&FontT48,tXc1,text,0);
999 break; 1018 break;
1000 } 1019
1020 #ifdef ENABLE_BIGFONT_VX
1021 case CVIEW_T3_Navigation:
1022 Stopwatch.Total = timer_Stopwatch_GetTime();
1023 Stopwatch.Minutes = Stopwatch.Total / 60;
1024 Stopwatch.Seconds = Stopwatch.Total - ( Stopwatch.Minutes * 60 );
1025 fAverageDepth = timer_Stopwatch_GetAvarageDepth_Meter();
1026
1027 if(!pSettings->FlipDisplay)
1028 {
1029 tXc2->WindowX0 = 550;
1030 }
1031 else
1032 {
1033 tXc2->WindowX1 = 800;
1034 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */
1035 }
1036
1037 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch);
1038 GFX_write_string(&FontT42,tXc2,text,0);
1039 snprintf(text,TEXTSIZE,"\030\016\002%01.1f",unit_depth_float(fAverageDepth));
1040 GFX_write_string(&FontT105,tXc2,text,0);
1041 if(!pSettings->FlipDisplay)
1042 {
1043 tXc2->WindowY0 = 100;
1044 }
1045 else
1046 {
1047 tXc2->WindowY1 -= 100; /* jump to upper of two lines */
1048 }
1049
1050 snprintf(text,TEXTSIZE,"\030\002%u:\016\016%02u",Stopwatch.Minutes, Stopwatch.Seconds);
1051 GFX_write_string(&FontT105,tXc2,text,0);
1052
1053
1054 center.x = 400;
1055 center.y = 116;
1056
1057 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass);
1058 GFX_write_string(&FontT42,tXc1,text,0);
1059 //snprintf(text,100,"\030\003%03i`",(uint16_t)stateUsed->lifeData.compass_heading);
1060 snprintf(text,100,"\030%03i`",(uint16_t)stateUsed->lifeData.compass_heading);
1061 GFX_write_string(&FontT144,tXc1,text,0);
1062 t3_basics_compass(tXscreen, center, (uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading);
1063
1064 break;
1065
1066 case CVIEW_T3_DepthData:
1067 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
1068 if(pSettings->FlipDisplay)
1069 {
1070 if(mode == DIVEMODE_Apnea)
1071 {
1072 GFX_write_string(&FontT42,tXc2,text,0);
1073 }
1074 else
1075 {
1076 GFX_write_string(&FontT42,tXc1,text,0);
1077 }
1078 }
1079 else
1080 {
1081 GFX_write_string(&FontT42,tXc1,text,0);
1082 }
1083 snprintf(text,TEXTSIZE,"\020\003\016%01.1f",unit_depth_float(stateUsed->lifeData.max_depth_meter));
1084 t3_basics_colorscheme_mod(text);
1085 if(pSettings->FlipDisplay)
1086 {
1087 if(mode == DIVEMODE_Apnea)
1088 {
1089 GFX_write_string(&FontT105,tXc2,text,0);
1090 }
1091 else
1092 {
1093 GFX_write_string(&FontT105,tXc1,text,0);
1094 }
1095 }
1096 else
1097 {
1098 GFX_write_string(&FontT105,tXc1,text,0);
1099 }
1100 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter;
1101 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth);
1102 GFX_write_string(&FontT42,tXc2,text,0);
1103
1104 snprintf(text,TEXTSIZE,"\020\003\016\002\%01.1f",unit_depth_float(fAverageDepthAbsolute));
1105 GFX_write_string(&FontT105,tXc2,text,0);
1106 break;
1107 #endif
1108 }
1109
1110
1111
1001 tXc1->WindowX0 = tempWinX0; 1112 tXc1->WindowX0 = tempWinX0;
1002 tXc1->WindowY0 = tempWinY0; 1113 tXc1->WindowY0 = tempWinY0;
1114 tXc1->WindowX1 = tempWinX1;
1115 tXc1->WindowY1 = tempWinY1;
1003 1116
1004 tXc2->WindowX0 = tempWinC2X0; 1117 tXc2->WindowX0 = tempWinC2X0;
1005 tXc2->WindowY0 = tempWinC2Y0; 1118 tXc2->WindowY0 = tempWinC2Y0;
1006 tXc2->WindowX1 = tempWinC2X1; 1119 tXc2->WindowX1 = tempWinC2X1;
1007 tXc2->WindowY1 = tempWinC2Y1; 1120 tXc2->WindowY1 = tempWinC2Y1;
1182 { 1295 {
1183 GFX_write_string(&FontT48,&t3c2,text,1); 1296 GFX_write_string(&FontT48,&t3c2,text,1);
1184 } 1297 }
1185 } 1298 }
1186 1299
1300 uint8_t t3_customview_disabled(uint8_t view)
1301 {
1302 uint8_t i = 0;
1303 uint8_t cv_disabled = 0;
1304 const uint8_t *pcv_changelist;
1305 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen;
1306
1307 #ifdef ENABLE_BIGFONT_VX
1308 if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2)
1309 {
1310 pcv_changelist = cv_changelist_BSV2;
1311 }
1312 else
1313 #endif
1314 {
1315 pcv_changelist = cv_changelist_BS;
1316 }
1317
1318 while(pcv_changelist[i] != CVIEW_T3_END)
1319 {
1320 if((view == pcv_changelist[i]) && !CHECK_BIT_THOME(cv_config, pcv_changelist[i]))
1321 {
1322 cv_disabled = 1;
1323 break;
1324 }
1325 i++;
1326 }
1327
1328 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) &&
1329 ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0)))
1330 {
1331 cv_disabled = 1;
1332 }
1333
1334 return cv_disabled;
1335 }
1187 1336
1188 void t3_change_customview(uint8_t action) 1337 void t3_change_customview(uint8_t action)
1189 { 1338 {
1190 t3_basics_change_customview(&t3_selection_customview, t3_customviews, action); 1339 #ifdef ENABLE_BIGFONT_VX
1340 if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2)
1341 {
1342 t3_basics_change_customview(&t3_selection_customview, t3_customviewsV2, action);
1343 }
1344 else
1345 {
1346 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action);
1347 }
1348 #else
1349 t3_basics_change_customview(&t3_selection_customview, t3_customviewsStandard, action);
1350 #endif
1191 } 1351 }
1192 1352
1193 1353
1194 void t3_basics_change_customview(uint8_t *tX_selection_customview, const uint8_t *tX_customviews, uint8_t action) 1354 void t3_basics_change_customview(uint8_t *tX_selection_customview, uint8_t *tX_customviews, uint8_t action)
1195 { 1355 {
1196 const SDecoinfo * pDecoinfo; 1356 const SDecoinfo * pDecoinfo;
1197 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE) 1357 if(stateUsed->diveSettings.deco_type.ub.standard == GF_MODE)
1198 pDecoinfo = &stateUsed->decolistBuehlmann; 1358 pDecoinfo = &stateUsed->decolistBuehlmann;
1199 else 1359 else
1200 pDecoinfo = &stateUsed->decolistVPM; 1360 pDecoinfo = &stateUsed->decolistVPM;
1201 1361
1362 uint8_t curView;
1202 uint8_t *pViews; 1363 uint8_t *pViews;
1203 pViews = tX_customviews; 1364 pViews = tX_customviews;
1204 1365
1205 uint8_t *pStartView,*pCurView, *pLastView; 1366 uint8_t *pStartView,*pCurView, *pLastView;
1206 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */ 1367 uint8_t iterate = 0; /* set to 1 if a view has to be skipped */
1207 1368
1208 pStartView = pViews; 1369 pStartView = pViews;
1370 curView = CVIEW_T3_END;
1209 /* set pointer to currently selected view and count number of entries */ 1371 /* set pointer to currently selected view and count number of entries */
1210 while((*pViews != CVIEW_T3_END)) 1372 while((*pViews != CVIEW_T3_END))
1211 { 1373 {
1212 if (*pViews == *tX_selection_customview) 1374 if (*pViews == *tX_selection_customview)
1213 { 1375 {
1214 pCurView = pViews; 1376 pCurView = pViews;
1377 curView = *pViews;
1215 } 1378 }
1216 pViews++; 1379 pViews++;
1217 } 1380 }
1381 if(curView == CVIEW_T3_END) /* called with unknown view */
1382 {
1383 *tX_selection_customview = CVIEW_T3_Decostop;
1384 pCurView = pStartView;
1385 }
1218 pLastView = pViews; 1386 pLastView = pViews;
1219 pViews = pCurView; 1387 pViews = pCurView;
1220 1388
1221 do 1389 do
1222 { 1390 {
1223 iterate = 0; 1391 iterate = 0;
1224 if((action == ACTION_BUTTON_ENTER) || (action == ACTION_PITCH_POS)) 1392 switch(action)
1225 { 1393 {
1226 if(*pViews != CVIEW_T3_END) 1394 case ACTION_BUTTON_ENTER:
1227 pViews++; 1395 case ACTION_PITCH_POS:
1228 1396
1229 if(*pViews == CVIEW_T3_END) 1397 if(*pViews != CVIEW_T3_END)
1230 { 1398 pViews++;
1231 pViews = pStartView; 1399
1232 } 1400 if(*pViews == CVIEW_T3_END)
1401 {
1402 pViews = pStartView;
1403 }
1404 break;
1405 case ACTION_PITCH_NEG:
1406 if(pViews == pStartView)
1407 {
1408 pViews = pLastView - 1;
1409 }
1410 else
1411 {
1412 pViews--;
1413 }
1414 break;
1415 default:
1416 break;
1233 } 1417 }
1234 else 1418
1235 { 1419 if(t3_customview_disabled(*pViews))
1236 if(pViews == pStartView)
1237 {
1238 pViews = pLastView - 1;
1239 }
1240 else
1241 {
1242 pViews--;
1243 }
1244 }
1245 if((*pViews == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0))
1246 { 1420 {
1247 iterate = 1; 1421 iterate = 1;
1248 } 1422 }
1249 if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds) 1423 if((*pViews == CVIEW_T3_TTS) && !pDecoinfo->output_time_to_surface_seconds)
1250 { 1424 {
1251 iterate = 1; 1425 iterate = 1;
1252 } 1426 }
1427 if((iterate) && (action == ACTION_END))
1428 {
1429 action = ACTION_BUTTON_ENTER;
1430 }
1253 }while (iterate == 1); 1431 }while (iterate == 1);
1254 1432
1255 *tX_selection_customview = *pViews; 1433 *tX_selection_customview = *pViews;
1256 } 1434 }
1257 1435
1263 text[0] = '\027'; 1441 text[0] = '\027';
1264 } 1442 }
1265 } 1443 }
1266 1444
1267 1445
1268 point_t t3_compass_circle(uint8_t id, uint16_t degree) 1446 point_t t3_compass_circle(uint8_t id, uint16_t degree, point_t center)
1269 { 1447 {
1270 float fCos, fSin; 1448 float fCos, fSin;
1271 const float piMult = ((2 * 3.14159) / 360); 1449 const float piMult = ((2 * 3.14159) / 360);
1272 // const int radius[4] = {95,105,115,60}; 1450 // const int radius[4] = {95,105,115,60};
1273 const int radius[4] = {85,95,105,90}; 1451 const int radius[4] = {85,95,105,90};
1274 const point_t offset = {.x = 600, .y = 116}; 1452 static point_t forcenter = {.x = 900, .y = 500}; /* used to identify change of circle position */
1275
1276 static point_t r[4][360] = { 0 }; 1453 static point_t r[4][360] = { 0 };
1277 1454
1278 if(r[0][0].y == 0) 1455 if((r[0][0].y == 0) || (forcenter.x != center.x) || (forcenter.y != center.y)) /* calculate values only once during first call or if center position changed */
1279 { 1456 {
1280 for(int i=0;i<360;i++) 1457 for(int i=0;i<360;i++)
1281 { 1458 {
1282 fCos = cos(i * piMult); 1459 fCos = cos(i * piMult);
1283 fSin = sin(i * piMult); 1460 fSin = sin(i * piMult);
1284 for(int j=0;j<4;j++) 1461 for(int j=0;j<4;j++)
1285 { 1462 {
1286 r[j][i].x = offset.x + (int)(fSin * radius[j]); 1463 r[j][i].x = center.x + (int)(fSin * radius[j]);
1287 r[j][i].y = offset.y + (int)(fCos * radius[j]); 1464 r[j][i].y = center.y + (int)(fCos * radius[j]);
1288 } 1465 }
1289 } 1466 }
1467 forcenter.x = center.x;
1468 forcenter.y = center.y;
1290 } 1469 }
1291 if(id > 3) id = 0; 1470 if(id > 3) id = 0;
1292 if(degree > 359) degree = 0; 1471 if(degree > 359) degree = 0;
1293 return r[id][degree]; 1472 return r[id][degree];
1294 } 1473 }
1295 1474
1296 1475
1297 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, uint16_t ActualHeading, uint16_t UserSetHeading) 1476 void t3_basics_compass(GFX_DrawCfgScreen *tXscreen, point_t center, uint16_t ActualHeading, uint16_t UserSetHeading)
1298 { 1477 {
1478 uint8_t loop = 0;
1299 uint16_t LineHeading; 1479 uint16_t LineHeading;
1300 point_t center; 1480
1301 static int32_t LastHeading = 0; 1481 static int32_t LastHeading = 0;
1302 int32_t newHeading = 0; 1482 int32_t newHeading = 0;
1303 int32_t diff = 0; 1483 int32_t diff = 0;
1304 int32_t diff2 = 0; 1484 int32_t diff2 = 0;
1305 1485
1341 ActualHeading += 360; 1521 ActualHeading += 360;
1342 1522
1343 while(ActualHeading > 359) ActualHeading -= 360; 1523 while(ActualHeading > 359) ActualHeading -= 360;
1344 1524
1345 LineHeading = 360 - ActualHeading; 1525 LineHeading = 360 - ActualHeading;
1346 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font030); // North 1526
1527 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font030); // North
1347 LineHeading += 90; 1528 LineHeading += 90;
1348 if(LineHeading > 359) LineHeading -= 360; 1529
1349 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Maintick 1530 for (loop = 0; loop < 3; loop++)
1350 LineHeading += 90; 1531 {
1351 if(LineHeading > 359) LineHeading -= 360; 1532 if(LineHeading > 359) LineHeading -= 360;
1352 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); 1533 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(0,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Main Ticks
1353 LineHeading += 90; 1534 LineHeading += 90;
1354 if(LineHeading > 359) LineHeading -= 360; 1535 }
1355 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1356 1536
1357 LineHeading = 360 - ActualHeading; 1537 LineHeading = 360 - ActualHeading;
1358 LineHeading += 45; 1538 LineHeading += 45;
1359 if(LineHeading > 359) LineHeading -= 360; 1539
1360 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Subtick 1540 for (loop = 0; loop < 4; loop++)
1361 LineHeading += 90; 1541 {
1362 if(LineHeading > 359) LineHeading -= 360; 1542 if(LineHeading > 359) LineHeading -= 360;
1363 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); 1543 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick
1364 LineHeading += 90; 1544 LineHeading += 90;
1365 if(LineHeading > 359) LineHeading -= 360; 1545 }
1366 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1367 LineHeading += 90;
1368 if(LineHeading > 359) LineHeading -= 360;
1369 GFX_draw_thick_line(5,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1370 1546
1371 LineHeading = 360 - ActualHeading; 1547 LineHeading = 360 - ActualHeading;
1372 LineHeading += 22; 1548 LineHeading += 22;
1373 if(LineHeading > 359) LineHeading -= 360; 1549 for (loop = 0; loop < 8; loop++)
1374 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Subtick 1550 {
1375 LineHeading += 45; 1551 if(LineHeading > 359) LineHeading -= 360;
1376 if(LineHeading > 359) LineHeading -= 360; 1552 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_Font031); // Subtick
1377 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); 1553 LineHeading += 45;
1378 LineHeading += 45; 1554 }
1379 if(LineHeading > 359) LineHeading -= 360;
1380 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1381 LineHeading += 45;
1382 if(LineHeading > 359) LineHeading -= 360;
1383 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1384 LineHeading += 45;
1385 if(LineHeading > 359) LineHeading -= 360;
1386 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031); // Subtick
1387 LineHeading += 45;
1388 if(LineHeading > 359) LineHeading -= 360;
1389 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1390 LineHeading += 45;
1391 if(LineHeading > 359) LineHeading -= 360;
1392 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1393 LineHeading += 45;
1394 if(LineHeading > 359) LineHeading -= 360;
1395 GFX_draw_thick_line(3,tXscreen, t3_compass_circle(1,LineHeading), t3_compass_circle(2,LineHeading), CLUT_Font031);
1396
1397 if(UserSetHeading) 1555 if(UserSetHeading)
1398 { 1556 {
1399 LineHeading = UserSetHeading + 360 - ActualHeading; 1557 LineHeading = UserSetHeading + 360 - ActualHeading;
1400 if(LineHeading > 359) LineHeading -= 360; 1558 if(LineHeading > 359) LineHeading -= 360;
1401 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading), t3_compass_circle(2,LineHeading), CLUT_CompassUserHeadingTick); 1559 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserHeadingTick);
1402 1560
1403 // R�ckpeilung, User Back Heading 1561 // R�ckpeilung, User Back Heading
1404 LineHeading = UserSetHeading + 360 + 180 - ActualHeading; 1562 LineHeading = UserSetHeading + 360 + 180 - ActualHeading;
1405 if(LineHeading > 359) LineHeading -= 360; 1563 if(LineHeading > 359) LineHeading -= 360;
1406 if(LineHeading > 359) LineHeading -= 360; 1564 if(LineHeading > 359) LineHeading -= 360;
1407 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading), t3_compass_circle(2,LineHeading), CLUT_CompassUserBackHeadingTick); 1565 GFX_draw_thick_line(9,tXscreen, t3_compass_circle(3,LineHeading, center), t3_compass_circle(2,LineHeading, center), CLUT_CompassUserBackHeadingTick);
1408 } 1566 }
1409 1567
1410 center.x = 600;
1411 center.y = 116;
1412 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030); 1568 GFX_draw_circle(tXscreen, center, 106, CLUT_Font030);
1413 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030); 1569 GFX_draw_circle(tXscreen, center, 107, CLUT_Font030);
1414 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030); 1570 GFX_draw_circle(tXscreen, center, 108, CLUT_Font030);
1415 } 1571 }
1416 1572
1417 uint8_t t3_GetEnabled_customviews() 1573 uint8_t t3_GetEnabled_customviews()
1418 { 1574 {
1419 int8_t i; 1575 uint8_t *pViews;
1576 uint8_t increment = 1;
1420 uint8_t enabledViewCnt = 0; 1577 uint8_t enabledViewCnt = 0;
1421 uint32_t cv_config = settingsGetPointer()->cv_configuration; 1578
1422 1579 #ifdef ENABLE_BIGFONT_VX
1423 i=0; 1580 if(settingsGetPointer()->extraDisplay == EXTRADISPLAY_BIGFONT2)
1581 {
1582 pViews = (uint8_t*)t3_customviewsV2;
1583 }
1584 else
1585 {
1586 pViews = (uint8_t*)t3_customviewsStandard;
1587 }
1588
1589 while((*pViews != CVIEW_T3_END))
1590 {
1591 increment = 1;
1592 /* check if view is enabled */
1593 if(t3_customview_disabled(*pViews))
1594 {
1595 increment = 0;
1596 }
1597 pViews++;
1598 enabledViewCnt += increment;
1599 }
1600 #else
1601
1602 uint8_t i=0;
1603 uint32_t cv_config = settingsGetPointer()->cv_config_BigScreen;
1604 pcv_changelist = cv_changelist_BS;
1424 do 1605 do
1425 { 1606 {
1426 if(cv_changelist[i] == CVIEW_sensors) /* at the moment specific big font view may not be selected. Only sensor setting is taken from t7 configuration */ 1607 if(pcv_changelist[i] == CVIEW_sensors) /* at the moment specific big font view may not be selected. Only sensor setting is taken from t7 configuration */
1427 { 1608 {
1428 if(!CHECK_BIT_THOME(cv_config, cv_changelist[i])) 1609 if(!CHECK_BIT_THOME(cv_config, pcv_changelist[i]))
1429 { 1610 {
1430 enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */ 1611 enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */
1431 } 1612 }
1432 else 1613 else
1433 { 1614 {
1434 enabledViewCnt = NUMBER_OF_VIEWS; /* enable all possible views */ 1615 enabledViewCnt = NUMBER_OF_VIEWS; /* enable all possible views */
1435 } 1616 }
1436 break; 1617 break;
1437 } 1618 }
1438 i++; 1619 i++;
1439 } while(cv_changelist[i] != CVIEW_END); 1620 } while(pcv_changelist[i] != CVIEW_T3_END);
1440 if ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0)) 1621 if ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0))
1441 { 1622 {
1442 enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */ 1623 enabledViewCnt = NUMBER_OF_VIEWS - 1; /* sensor shall not be displayed */
1443 } 1624 }
1444 1625 #endif
1445 return enabledViewCnt; 1626 return enabledViewCnt;
1446 } 1627 }
1447 1628
1448 1629