comparison Discovery/Src/t3.c @ 539:d784f281833a

Added inertia simulation for compass heading: In previous version calculated compass values were directly used for visualization of the compass. This causes a fast changing (jumping) of values. With the inertia introduction the compass behalfs more like an analog compass. The final value is reached slowly and the displayed values are more stable. For configuration a new menu item has been added to the compass menu allowing to switch inertia off (default), small and large inertia simulation
author Ideenmodellierer
date Sat, 10 Oct 2020 16:59:18 +0200
parents 0e1db77b2aca
children 6fbf7cd391cb
comparison
equal deleted inserted replaced
538:b1eee27cd02b 539:d784f281833a
695 uint8_t lineNumber; 695 uint8_t lineNumber;
696 uint8_t gasPosIdx; 696 uint8_t gasPosIdx;
697 697
698 /* compass position */ 698 /* compass position */
699 point_t center; 699 point_t center;
700 uint16_t heading;
700 701
701 // CVIEW_T3_StopWatch 702 // CVIEW_T3_StopWatch
702 SDivetime Stopwatch = {0,0,0,0}; 703 SDivetime Stopwatch = {0,0,0,0};
703 float fAverageDepth, fAverageDepthAbsolute; 704 float fAverageDepth, fAverageDepthAbsolute;
704 705
721 tempWinC2Y0 = tXc2->WindowY0; 722 tempWinC2Y0 = tXc2->WindowY0;
722 tempWinC2X1 = tXc2->WindowX1; 723 tempWinC2X1 = tXc2->WindowX1;
723 tempWinC2Y1 = tXc2->WindowY1; 724 tempWinC2Y1 = tXc2->WindowY1;
724 tempWinC2Tab = tXc2->WindowTab; 725 tempWinC2Tab = tXc2->WindowTab;
725 726
727 if(settingsGetPointer()->compassInertia)
728 {
729 heading = (uint16_t)compass_getCompensated();
730 }
731 else
732 {
733 heading = (uint16_t)stateUsed->lifeData.compass_heading;
734 }
735
726 switch(tX_selection_customview) 736 switch(tX_selection_customview)
727 { 737 {
728 case CVIEW_T3_ApnoeSurfaceInfo: 738 case CVIEW_T3_ApnoeSurfaceInfo:
729 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); 739 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
730 740
903 case CVIEW_Compass: 913 case CVIEW_Compass:
904 center.x = 600; 914 center.x = 600;
905 center.y = 116; 915 center.y = 116;
906 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); 916 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass);
907 GFX_write_string(&FontT42,tXc1,text,0); 917 GFX_write_string(&FontT42,tXc1,text,0);
908 snprintf(text,100,"\030\003%03i`",(uint16_t)stateUsed->lifeData.compass_heading); 918 snprintf(text,100,"\030\003%03i`",heading);
909 GFX_write_string(&FontT105,tXc1,text,0); 919 GFX_write_string(&FontT105,tXc1,text,0);
910 t3_basics_compass(tXscreen, center, (uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading); 920 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading);
911 break; 921 break;
912 922
913 case CVIEW_T3_Decostop: 923 case CVIEW_T3_Decostop:
914 default: 924 default:
915 // decostop 925 // decostop
1101 center.x = 400; 1111 center.x = 400;
1102 center.y = 116; 1112 center.y = 116;
1103 1113
1104 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass); 1114 snprintf(text,TEXTSIZE,"\032\f%c%c",TXT_2BYTE, TXT2BYTE_Compass);
1105 GFX_write_string(&FontT42,tXc1,text,0); 1115 GFX_write_string(&FontT42,tXc1,text,0);
1106 //snprintf(text,100,"\030\003%03i`",(uint16_t)stateUsed->lifeData.compass_heading); 1116 snprintf(text,100,"\030%03i`",heading);
1107 snprintf(text,100,"\030%03i`",(uint16_t)stateUsed->lifeData.compass_heading);
1108 GFX_write_string(&FontT144,tXc1,text,0); 1117 GFX_write_string(&FontT144,tXc1,text,0);
1109 t3_basics_compass(tXscreen, center, (uint16_t)stateUsed->lifeData.compass_heading, stateUsed->diveSettings.compassHeading); 1118 t3_basics_compass(tXscreen, center, heading, stateUsed->diveSettings.compassHeading);
1110 1119
1111 break; 1120 break;
1112 1121
1113 case CVIEW_T3_DepthData: 1122 case CVIEW_T3_DepthData:
1114 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); 1123 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);