comparison Discovery/Src/t7.c @ 372:75eedde05ff6 MotionDetection

merged default into MotionDetection
author Ideenmodellierer
date Mon, 19 Aug 2019 17:50:55 +0200
parents 210bffc496a3 449e9e9632e4
children ef1b8579166c
comparison
equal deleted inserted replaced
371:fca370f847f8 372:75eedde05ff6
157 #define CUSTOMBOX_INSIDE_OFFSET (2) 157 #define CUSTOMBOX_INSIDE_OFFSET (2)
158 #define CUSTOMBOX_OUTSIDE_OFFSET (2) 158 #define CUSTOMBOX_OUTSIDE_OFFSET (2)
159 #define CUSTOMBOX_SPACE_INSIDE (CUSTOMBOX_LINE_RIGHT + 1 - (CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + CUSTOMBOX_INSIDE_OFFSET)) 159 #define CUSTOMBOX_SPACE_INSIDE (CUSTOMBOX_LINE_RIGHT + 1 - (CUSTOMBOX_LINE_LEFT + CUSTOMBOX_INSIDE_OFFSET + CUSTOMBOX_INSIDE_OFFSET))
160 #define TOP_LINE_HIGHT (25) 160 #define TOP_LINE_HIGHT (25)
161 161
162 #define SHOW_AMBIENTE_SURFACE_DELTA (0.02f)
163 #define SHOW_AMBIENTE_DEBOUNCE (0.003f)
164
162 /* Exported functions --------------------------------------------------------*/ 165 /* Exported functions --------------------------------------------------------*/
163 166
164 void t7_init(void) 167 void t7_init(void)
165 { 168 {
166 169
663 Gfx_write_label_var(&t7screen, 300,800, ytop,&FontT48,CLUT_Font020,"Shutting down..."); 666 Gfx_write_label_var(&t7screen, 300,800, ytop,&FontT48,CLUT_Font020,"Shutting down...");
664 } 667 }
665 668
666 void t7_refresh_surface(void) 669 void t7_refresh_surface(void)
667 { 670 {
671 static float debounceAmbientPressure = 0;
668 char text[256]; 672 char text[256];
669 uint8_t date[3], year,month,day; 673 uint8_t date[3], year,month,day;
670 uint32_t color; 674 uint32_t color;
671 uint8_t customview_warnings = 0; 675 uint8_t customview_warnings = 0;
672 676
907 } 911 }
908 912
909 /* surface pressure and temperature */ 913 /* surface pressure and temperature */
910 if(stateUsed->sensorErrorsRTE == 0) 914 if(stateUsed->sensorErrorsRTE == 0)
911 { 915 {
912 snprintf(text,30,"%01.0f\022\016\016 %s", stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT); 916 if(fabs(stateUsed->lifeData.pressure_surface_bar - stateUsed->lifeData.pressure_ambient_bar) < SHOW_AMBIENTE_SURFACE_DELTA) /* show ambient pressure if difference to surface is significant*/
917 {
918 snprintf(text,30,"%01.0f\022\016\016 %s", stateUsed->lifeData.pressure_surface_bar * 1000.0f,TEXT_PRESSURE_UNIT);
919 }
920 else
921 {
922 if(fabsf(debounceAmbientPressure - stateUsed->lifeData.pressure_ambient_bar) > SHOW_AMBIENTE_DEBOUNCE) /* there might be a jitter ~+-1 HPa on the pressure signal => update only if delta is bigger */
923 {
924 debounceAmbientPressure = stateUsed->lifeData.pressure_ambient_bar;
925 }
926 snprintf(text,30,"%01.0f\022\016\016 %s", debounceAmbientPressure * 1000.0f,TEXT_PRESSURE_UNIT);
927 }
928
913 GFX_write_string(&FontT48,&t7surfaceL,text,3); 929 GFX_write_string(&FontT48,&t7surfaceL,text,3);
914 930
915 if(settingsGetPointer()->nonMetricalSystem) 931 if(settingsGetPointer()->nonMetricalSystem)
916 snprintf(text,40,"%01.0f\140\022\016\016 fahrenheit",unit_temperature_float(stateUsed->lifeData.temperature_celsius)); 932 snprintf(text,40,"%01.0f\140\022\016\016 fahrenheit",unit_temperature_float(stateUsed->lifeData.temperature_celsius));
917 else 933 else
1225 Gfx_write_label_var(&t7screen, 500,800, 45,&FontT48,CLUT_Font020,TextL1); 1241 Gfx_write_label_var(&t7screen, 500,800, 45,&FontT48,CLUT_Font020,TextL1);
1226 } 1242 }
1227 else 1243 else
1228 if(DataEX_lost_connection_count()) 1244 if(DataEX_lost_connection_count())
1229 { 1245 {
1230 snprintf(TextL1,TEXTSIZE,"\002%i",DataEX_lost_connection_count()); 1246 snprintf(TextL1,TEXTSIZE,"\002%ld",DataEX_lost_connection_count());
1231 Gfx_write_label_var(&t7screen, 600,800, 45,&FontT48,CLUT_Font020,TextL1); 1247 Gfx_write_label_var(&t7screen, 600,800, 45,&FontT48,CLUT_Font020,TextL1);
1232 } 1248 }
1233 1249
1234 snprintf(TextL1,TEXTSIZE,"\002%i",blockedFramesCount()); 1250 snprintf(TextL1,TEXTSIZE,"\002%i",blockedFramesCount());
1235 Gfx_write_label_var(&t7screen, 600,800, 0,&FontT48,CLUT_Font020,TextL1); 1251 Gfx_write_label_var(&t7screen, 600,800, 0,&FontT48,CLUT_Font020,TextL1);
1290 Gfx_write_label_var(&t7screen, 660,800,200,&Batt24,color,TextL1); 1306 Gfx_write_label_var(&t7screen, 660,800,200,&Batt24,color,TextL1);
1291 } 1307 }
1292 1308
1293 extern uint32_t base_tempLightLevel; 1309 extern uint32_t base_tempLightLevel;
1294 1310
1295 snprintf(TextL1,TEXTSIZE,"# %u (%u)",stateUsed->lifeData.ambient_light_level, base_tempLightLevel); 1311 snprintf(TextL1,TEXTSIZE,"# %u (%ld)",stateUsed->lifeData.ambient_light_level, base_tempLightLevel);
1296 Gfx_write_label_var(&t7screen, 401,600,310,&FontT42,CLUT_DiveMainLabel,"Light"); 1312 Gfx_write_label_var(&t7screen, 401,600,310,&FontT42,CLUT_DiveMainLabel,"Light");
1297 Gfx_write_label_var(&t7screen, 401,800,355,&FontT48,CLUT_Font020,TextL1); 1313 Gfx_write_label_var(&t7screen, 401,800,355,&FontT48,CLUT_Font020,TextL1);
1298 1314
1299 // snprintf(TextL1,TEXTSIZE,"# %u",stateUsed->lifeData.ambient_light_level); 1315 // snprintf(TextL1,TEXTSIZE,"# %u",stateUsed->lifeData.ambient_light_level);
1300 // Gfx_write_label_var(&t7screen, 601,800,310,&FontT42,CLUT_DiveMainLabel,"Light"); 1316 // Gfx_write_label_var(&t7screen, 601,800,310,&FontT42,CLUT_DiveMainLabel,"Light");