comparison Discovery/Src/t3.c @ 564:5e0a75e2f00b

Bugfix One or more deactivated sensors hide sensor display: The sensor values were no longer displayed in case of a deactivated sensor. Root cause was the view available functionality which checked only if deactivation variable was set. Changed implementation to hide sensor views only if all sensors have been deactivated. Make sure that alignment of strings is set before dual font handling: The size (screen dimension) of a string needs the information regarding the font size to be used. If the dual font feature (using two font sizes in one string) is udes, the activation needs to happen after the definition of the alignment
author Ideenmodellierer
date Sun, 15 Nov 2020 20:09:31 +0100
parents 43a2dd4ba30f
children 9bb9a52d6ae5
comparison
equal deleted inserted replaced
563:d97f0e395058 564:5e0a75e2f00b
456 SurfaceBreakTime.Seconds = SurfaceBreakTime.Total - (SurfaceBreakTime.Minutes * 60); 456 SurfaceBreakTime.Seconds = SurfaceBreakTime.Total - (SurfaceBreakTime.Minutes * 60);
457 457
458 snprintf(text,TEXTSIZE,"\032\f\002%c%c", TXT_2BYTE,TXT2BYTE_ApneaSurface); 458 snprintf(text,TEXTSIZE,"\032\f\002%c%c", TXT_2BYTE,TXT2BYTE_ApneaSurface);
459 GFX_write_string(&FontT42,tXr1,text,0); 459 GFX_write_string(&FontT42,tXr1,text,0);
460 460
461 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds); 461 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",SurfaceBreakTime.Minutes, SurfaceBreakTime.Seconds);
462 } 462 }
463 else 463 else
464 { 464 {
465 Divetime.Total = stateUsed->lifeData.dive_time_seconds; 465 Divetime.Total = stateUsed->lifeData.dive_time_seconds;
466 Divetime.Minutes = Divetime.Total / 60; 466 Divetime.Minutes = Divetime.Total / 60;
468 468
469 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); 469 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime);
470 GFX_write_string(&FontT42,tXr1,text,0); 470 GFX_write_string(&FontT42,tXr1,text,0);
471 471
472 if(Divetime.Minutes < 100) 472 if(Divetime.Minutes < 100)
473 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); 473 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds);
474 else 474 else
475 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes); 475 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes);
476 } 476 }
477 t3_basics_colorscheme_mod(text); 477 t3_basics_colorscheme_mod(text);
478 GFX_write_string(&FontT105,tXr1,text,1); 478 GFX_write_string(&FontT105,tXr1,text,1);
479 } 479 }
480 else 480 else
507 507
508 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime); 508 snprintf(text,TEXTSIZE,"\032\f\002%c",TXT_Divetime);
509 GFX_write_string(&FontT42,tXr1,text,0); 509 GFX_write_string(&FontT42,tXr1,text,0);
510 510
511 if(Divetime.Minutes < 100) 511 if(Divetime.Minutes < 100)
512 snprintf(text,TEXTSIZE,"\020\003\016\002%u:%02u",Divetime.Minutes, Divetime.Seconds); 512 snprintf(text,TEXTSIZE,"\020\003\002\016%u:%02u",Divetime.Minutes, Divetime.Seconds);
513 else 513 else
514 snprintf(text,TEXTSIZE,"\020\003\016\002%u'",Divetime.Minutes); 514 snprintf(text,TEXTSIZE,"\020\003\002\016%u'",Divetime.Minutes);
515 515
516 t3_basics_colorscheme_mod(text); 516 t3_basics_colorscheme_mod(text);
517 GFX_write_string(&FontT105,tXr1,text,1); 517 GFX_write_string(&FontT105,tXr1,text,1);
518 break; 518 break;
519 } 519 }
1023 for(int i=0;i<3;i++) 1023 for(int i=0;i<3;i++)
1024 { 1024 {
1025 textpointer = 0; 1025 textpointer = 0;
1026 text[textpointer++] = '\030'; 1026 text[textpointer++] = '\030';
1027 if(i==1) 1027 if(i==1)
1028 text[textpointer++] = '\001'; 1028 text[textpointer++] = '\001'; /* center */
1029 else if(i==2) 1029 else if(i==2)
1030 text[textpointer++] = '\002'; 1030 text[textpointer++] = '\002'; /* right */
1031
1031 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) 1032 if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i))
1032 { 1033 {
1033 text[textpointer++] = '\031'; 1034 text[textpointer++] = '\031';
1034 text[textpointer++] = ' '; 1035 text[textpointer++] = ' ';
1035 text[textpointer++] = '-'; 1036 text[textpointer++] = '-';
1037 } 1038 }
1038 else 1039 else
1039 { 1040 {
1040 if(stateUsed->warnings.sensorOutOfBounds[i]) 1041 if(stateUsed->warnings.sensorOutOfBounds[i])
1041 text[textpointer++] = '\025'; 1042 text[textpointer++] = '\025';
1042 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.1f",stateUsed->lifeData.ppO2Sensor_bar[i]); 1043 textpointer += snprintf(&text[textpointer],TEXTSIZE,"%.2f",stateUsed->lifeData.ppO2Sensor_bar[i]);
1043 } 1044 }
1044 GFX_write_string(&FontT144,tXc1,text,0); 1045 GFX_write_string(&FontT105,tXc1,text,0);
1045 } 1046 }
1046 break; 1047 break;
1047 1048
1048 case CVIEW_T3_MaxDepth: 1049 case CVIEW_T3_MaxDepth:
1049 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth); 1050 snprintf(text,TEXTSIZE,"\032\f%c",TXT_MaxDepth);
1131 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */ 1132 tXc2->WindowY0 = t3c2.WindowY0; /* select customer window */
1132 } 1133 }
1133 1134
1134 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch); 1135 snprintf(text,TEXTSIZE,"\032\002\f%c", TXT_Stopwatch);
1135 GFX_write_string(&FontT42,tXc1,text,0); 1136 GFX_write_string(&FontT42,tXc1,text,0);
1136 snprintf(text,TEXTSIZE,"\030\016\002%01.1f",unit_depth_float(fAverageDepth)); 1137 snprintf(text,TEXTSIZE,"\030\002\016%01.1f",unit_depth_float(fAverageDepth));
1137 GFX_write_string(&FontT105,tXc1,text,0); 1138 GFX_write_string(&FontT105,tXc1,text,0);
1138 if(!pSettings->FlipDisplay) 1139 if(!pSettings->FlipDisplay)
1139 { 1140 {
1140 tXc2->WindowY0 = 100; 1141 tXc2->WindowY0 = 100;
1141 } 1142 }
1195 } 1196 }
1196 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter; 1197 fAverageDepthAbsolute = stateUsed->lifeData.average_depth_meter;
1197 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth); 1198 snprintf(text,TEXTSIZE,"\032\002\f%c",TXT_AvgDepth);
1198 GFX_write_string(&FontT42,tXc1,text,0); 1199 GFX_write_string(&FontT42,tXc1,text,0);
1199 1200
1200 snprintf(text,TEXTSIZE,"\020\003\016\002\%01.1f",unit_depth_float(fAverageDepthAbsolute)); 1201 snprintf(text,TEXTSIZE,"\020\003\002\016\%01.1f",unit_depth_float(fAverageDepthAbsolute));
1201 GFX_write_string(&FontT105,tXc1,text,0); 1202 GFX_write_string(&FontT105,tXc1,text,0);
1202 break; 1203 break;
1203 } 1204 }
1204 1205
1205 1206
1410 } 1411 }
1411 i++; 1412 i++;
1412 } 1413 }
1413 1414
1414 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) && 1415 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) &&
1415 ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0))) 1416 ((stateUsed->diveSettings.ppo2sensors_deactivated == 0x07) || (stateUsed->diveSettings.ccrOption == 0)))
1416 { 1417 {
1417 cv_disabled = 1; 1418 cv_disabled = 1;
1418 } 1419 }
1419 1420
1420 return cv_disabled; 1421 return cv_disabled;