[all] Telemetry display bug fixes

[X9D] Some more work on screens
This commit is contained in:
bsongis
2012-11-02 16:53:44 +00:00
parent 1080514bd9
commit 55b242c96b
4 changed files with 30 additions and 5 deletions
+6 -2
View File
@@ -189,8 +189,12 @@ void menuMainView(uint8_t event)
// Flight Phase Name
uint8_t phase = s_perout_flight_phase;
#if defined(PCBX9D)
lcd_putsnAtt(21*FW-1, 5, g_model.phaseData[phase].name, sizeof(g_model.phaseData[phase].name), ZCHAR);
lcd_rect(21*FW-3, 5-2, lcdLastPos-20*FW, FH+3);
uint8_t len = ZLEN(g_model.phaseData[phase].name);
if (len > 0) {
uint8_t tmp = (DISPLAY_W - 6*FW - 2 - len*FW/2);
lcd_putsnAtt(tmp, 5, g_model.phaseData[phase].name, sizeof(g_model.phaseData[phase].name), ZCHAR);
lcd_rect(tmp-2, 5-2, 3+FW*len, FH+3);
}
#else
lcd_putsnAtt(6*FW, 2*FH, g_model.phaseData[phase].name, sizeof(g_model.phaseData[phase].name), ZCHAR);
#endif
+5 -1
View File
@@ -3176,12 +3176,16 @@ void menuModelTelemetry(uint8_t event)
switch (m_posHorz) {
case 0:
bar.source = checkIncDecModel(event, barSource, 0, g_model.frsky.usrProto ? TELEM_DISPLAY_MAX : TELEM_NOUSR_MAX);
if (checkIncDec_Ret) {
bar.barMin = 0;
bar.barMax = 255-maxTelemValue(bar.source);
}
break;
case 1:
bar.barMin = checkIncDec(event, bar.barMin, 0, 254-bar.barMax, EE_MODEL|NO_INCDEC_MARKS);
break;
case 2:
bar.barMax = 255 - checkIncDec(event, 255-bar.barMax, bar.barMin+1, 255, EE_MODEL|NO_INCDEC_MARKS);
bar.barMax = 255 - checkIncDec(event, 255-bar.barMax, bar.barMin+1, maxTelemValue(barSource), EE_MODEL|NO_INCDEC_MARKS);
break;
}
}
+12
View File
@@ -158,6 +158,18 @@ char idx2char(int8_t idx)
return ' ';
}
#if defined(PCBX9D)
uint8_t zlen(const char *str, uint8_t size)
{
while (size > 0) {
if (str[size-1] != 0)
return size;
size--;
}
return size;
}
#endif
PhaseData *phaseaddress(uint8_t idx)
{
return &g_model.phaseData[idx];
+7 -2
View File
@@ -1267,5 +1267,10 @@ void checkFlashOnBeep();
void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att);
#endif
#endif // gruvin9x_h
/*eof*/
#if defined(PCBX9D)
uint8_t zlen(const char *str, uint8_t size);
#define ZLEN(s) zlen(s, sizeof(s))
#endif
#endif