comparison Discovery/Src/tMenuEditCustom.c @ 575:86c4baa6ba29

Change style of viewport calibration menu: Viewport is now independend from heading value => removed compass value and replaced it by a bar indicator for visualization of the deviation between calibrated and current view
author Ideenmodellierer
date Sun, 29 Nov 2020 22:53:33 +0100
parents f3463c06b2d3
children 280c11153080
comparison
equal deleted inserted replaced
574:01ee21dd311f 575:86c4baa6ba29
174 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); 174 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
175 } 175 }
176 176
177 void refresh_ViewPort(void) 177 void refresh_ViewPort(void)
178 { 178 {
179 uint16_t heading;
180 char text[32]; 179 char text[32];
181 uint8_t textIndex = 0; 180 uint8_t textIndex = 0;
182 float distance = 0.0; 181 float distance = 0.0;
183 SSettings* pSettings = settingsGetPointer(); 182 SSettings* pSettings = settingsGetPointer();
184 GFX_DrawCfgScreen* pdrawScreen; 183 GFX_DrawCfgScreen* pdrawScreen;
185 point_t lowerleft = {0,0}; 184 point_t lowerleft = {0,0};
186 point_t upperright = {799,479}; 185 point_t upperright = {799,479};
186 float localLimit = 0.1;
187 187
188 text[0] = '\001'; 188 text[0] = '\001';
189 text[1] = TXT_2BYTE; 189 text[1] = TXT_2BYTE;
190 text[2] = TXT2BYTE_CalibView; 190 text[2] = TXT2BYTE_CalibView;
191 text[3] = 0; 191 text[3] = 0;
193 193
194 text[0] = TXT_2BYTE; 194 text[0] = TXT_2BYTE;
195 text[1] = TXT2BYTE_CalibView; 195 text[1] = TXT2BYTE_CalibView;
196 text[2] = 0; 196 text[2] = 0;
197 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); 197 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text);
198
199 if(pSettings->compassInertia)
200 {
201 heading = (uint16_t)compass_getCompensated();
202 }
203 else
204 {
205 heading = (uint16_t)stateUsed->lifeData.compass_heading;
206 }
207 snprintf(text,32,"\001%03i`",heading);
208 write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text);
209 198
210 textIndex = 0; 199 textIndex = 0;
211 text[textIndex++] = TXT_2BYTE; 200 text[textIndex++] = TXT_2BYTE;
212 text[textIndex++] = TXT2BYTE_IndicateFrame; 201 text[textIndex++] = TXT2BYTE_IndicateFrame;
213 text[textIndex++] = ' '; 202 text[textIndex++] = ' ';
231 if(pSettings->showDebugInfo) 220 if(pSettings->showDebugInfo)
232 { 221 {
233 snprintf(text,32,"\001%03.3f",distance); 222 snprintf(text,32,"\001%03.3f",distance);
234 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text); 223 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text);
235 } 224 }
225
226
227 /* show "bar graph" indicating the distance to the center point */
228 textIndex = 0;
229 text[textIndex++] = '\001';
230
231 if(distance < localLimit)
232 {
233 text[textIndex++] = '+';
234 }
235 else
236 {
237 text[textIndex++] = '-';
238 while (localLimit < 0.6)
239 {
240 localLimit += 0.1;
241 text[textIndex++] = '-';
242 text[textIndex++] = '-';
243 if(distance < localLimit)
244 {
245 break;
246 }
247 }
248 }
249 text[textIndex] = 0;
250 write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text);
251
236 if(distance < 0.5) 252 if(distance < 0.5)
237 { 253 {
238 set_Backlight_Boost(settingsGetPointer()->viewPortMode & 0x03); 254 set_Backlight_Boost(settingsGetPointer()->viewPortMode & 0x03);
239 if(pSettings->viewPortMode >> 4) 255 if(pSettings->viewPortMode >> 4)
240 { 256 {