Fixes switch warning evaluation on COLORLCD
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "switch_warn_dialog.h"
|
||||
#include "switches.h"
|
||||
|
||||
bool SwitchWarnDialog::warningInactive()
|
||||
{
|
||||
@@ -47,19 +48,24 @@ void SwitchWarnDialog::paint(BitmapBuffer * dc)
|
||||
FullScreenDialog::paint(dc);
|
||||
|
||||
coord_t x = ALERT_MESSAGE_LEFT;
|
||||
coord_t y = ALERT_MESSAGE_TOP; // ALERT_FRAME_TOP + ALERT_FRAME_PADDING + ALERT_TITLE_LINE_HEIGHT * 3;
|
||||
coord_t y = ALERT_MESSAGE_TOP;
|
||||
swarnstate_t states = g_model.switchWarningState;
|
||||
|
||||
for (int i = 0; i < NUM_SWITCHES; ++i) {
|
||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||
unsigned int state = ((g_model.switchWarningState >> (3 * i)) & 0x07);
|
||||
if (state && state - 1 != ((switches_states >> (i * 2)) & 0x03)) {
|
||||
if (y < LCD_H) {
|
||||
x = drawSwitch(dc, x, y, SWSRC_FIRST_SWITCH + i * 3 + state - 1, COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
x += 5;
|
||||
}
|
||||
else {
|
||||
dc->drawText(x, y, "...", COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
break;
|
||||
swarnstate_t mask = ((swarnstate_t)0x07 << (i*3));
|
||||
if (states & mask) {
|
||||
if ((switches_states & mask) != (states & mask)) {
|
||||
swarnstate_t state = (states >> (i*3)) & 0x07;
|
||||
if (x < LCD_W) {
|
||||
x = drawSwitch(dc, x, y, SWSRC_FIRST_SWITCH + i * 3 + state - 1,
|
||||
COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
x += 5;
|
||||
}
|
||||
else {
|
||||
dc->drawText(x, y, "...", COLOR_THEME_PRIMARY1 | FONT(BOLD));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ class SwitchWarnDialog: public FullScreenDialog {
|
||||
FullScreenDialog(WARNING_TYPE_ALERT, STR_SWITCHWARN)
|
||||
{
|
||||
last_bad_switches = 0xff;
|
||||
states = g_model.switchWarningState;
|
||||
bad_pots = 0;
|
||||
last_bad_pots = 0xff;
|
||||
setCloseCondition(std::bind(&SwitchWarnDialog::warningInactive, this));
|
||||
|
||||
@@ -38,3 +38,5 @@ typedef int16_t delayval_t;
|
||||
|
||||
uint8_t lswFamily(uint8_t func);
|
||||
int16_t lswTimerValue(delayval_t val);
|
||||
|
||||
bool isSwitchWarningRequired(uint8_t &bad_pots);
|
||||
|
||||
Reference in New Issue
Block a user