[color] Fix timer display problem

This commit is contained in:
eshifri
2021-07-22 20:32:18 +02:00
committed by Raphael Coeffic
parent c832a74114
commit 44d4d25f4f
2 changed files with 42 additions and 21 deletions
+6
View File
@@ -21,6 +21,12 @@
#include "opentx.h" #include "opentx.h"
#include "widgets_container_impl.h" #include "widgets_container_impl.h"
// libopemui defines TIMOUR as zero
#ifdef TIMEHOUR
#undef TIMEHOUR
#define TIMEHOUR 0x2000
#endif
class TimerWidget: public Widget class TimerWidget: public Widget
{ {
public: public:
+36 -21
View File
@@ -86,30 +86,45 @@ class ValueWidget: public Widget
if (timerState.val < 0) { if (timerState.val < 0) {
color = ALARM_COLOR; color = ALARM_COLOR;
} }
drawSource(dc, NUMBERS_PADDING, 2, field, color); if (persistentData->options[2].value.boolValue) {
drawSource(dc, NUMBERS_PADDING + 1, 3, field, COLOR2FLAGS(BLACK)); drawSource(dc, xLabel + 1, yLabel + 1, field, attrLabel | COLOR2FLAGS(BLACK));
drawTimer(dc, xValue, yValue, abs(timerState.val), attrValue | FONT(XL) | color); drawTimer(dc, xValue + 1, yValue + 1, abs(timerState.val),
} attrValue | FONT(STD) | COLOR2FLAGS(BLACK));
if (field == MIXSRC_TX_TIME) {
drawTimer(dc, xValue, yValue, getValue(MIXSRC_TX_TIME),
attrValue | FONT(XL) | color);
}
if (field >= MIXSRC_FIRST_TELEM) {
TelemetryItem & telemetryItem = telemetryItems[(field - MIXSRC_FIRST_TELEM) / 3];
if (!telemetryItem.isAvailable() || telemetryItem.isOld()) {
color = TEXT_DISABLE_COLOR;
} }
} drawSource(dc, xLabel, yLabel, field, attrLabel | color);
drawTimer(dc, xValue, yValue, abs(timerState.val),
attrValue | FONT(STD) | color);
if (persistentData->options[2].value.boolValue) { } else if (field == MIXSRC_TX_TIME) {
drawSource(dc,xLabel + 1, yLabel + 1, field, attrLabel | COLOR2FLAGS(BLACK)); int32_t tme = getValue(MIXSRC_TX_TIME);
drawSourceValue(dc, xValue + 1, yValue + 1, field, attrValue | COLOR2FLAGS(BLACK)); if (persistentData->options[2].value.boolValue) {
} drawSource(dc, xLabel + 1, yLabel + 1, field, COLOR2FLAGS(BLACK));
drawTimer(dc, xValue + 1, yValue + 1, tme,
attrValue | FONT(STD) | COLOR2FLAGS(BLACK));
}
drawSource(dc, xLabel, yLabel, field, attrLabel | color);
drawTimer(dc, xValue, yValue, tme,
attrValue | FONT(STD) | color);
} else {
drawSource(dc, xLabel, yLabel, field, attrLabel | color); if (field >= MIXSRC_FIRST_TELEM) {
drawSourceValue(dc, xValue, yValue, field, attrValue | color); TelemetryItem& telemetryItem =
telemetryItems[(field - MIXSRC_FIRST_TELEM) / 3];
if (!telemetryItem.isAvailable() || telemetryItem.isOld()) {
color = TEXT_DISABLE_COLOR;
}
}
if (persistentData->options[2].value.boolValue) {
drawSource(dc, xLabel + 1, yLabel + 1, field,
attrLabel | COLOR2FLAGS(BLACK));
drawSourceValue(dc, xValue + 1, yValue + 1, field,
attrValue | COLOR2FLAGS(BLACK));
}
drawSource(dc, xLabel, yLabel, field, attrLabel | color);
drawSourceValue(dc, xValue, yValue, field, attrValue | color);
}
} }
void checkEvents() override void checkEvents() override