fix: Type cast for failsafe channel update causing EM crashes (#2170)
This commit is contained in:
@@ -148,6 +148,8 @@ public:
|
|||||||
|
|
||||||
class ChannelFSCombo : public FormGroup
|
class ChannelFSCombo : public FormGroup
|
||||||
{
|
{
|
||||||
|
ChannelFailsafeEdit* edit = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChannelFSCombo(Window* parent, uint8_t ch, int vmin, int vmax) :
|
ChannelFSCombo(Window* parent, uint8_t ch, int vmin, int vmax) :
|
||||||
FormGroup(parent, rect_t{})
|
FormGroup(parent, rect_t{})
|
||||||
@@ -156,7 +158,7 @@ public:
|
|||||||
lv_obj_set_style_pad_column(lvobj, lv_dpx(4), 0);
|
lv_obj_set_style_pad_column(lvobj, lv_dpx(4), 0);
|
||||||
lv_obj_set_style_flex_cross_place(lvobj, LV_FLEX_ALIGN_CENTER, 0);
|
lv_obj_set_style_flex_cross_place(lvobj, LV_FLEX_ALIGN_CENTER, 0);
|
||||||
|
|
||||||
auto edit = new ChannelFailsafeEdit(this, ch, vmin, vmax);
|
edit = new ChannelFailsafeEdit(this, ch, vmin, vmax);
|
||||||
auto btn = new TextButton(this, rect_t{}, LV_SYMBOL_SETTINGS, [=]() {
|
auto btn = new TextButton(this, rect_t{}, LV_SYMBOL_SETTINGS, [=]() {
|
||||||
edit->toggle();
|
edit->toggle();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -164,6 +166,8 @@ public:
|
|||||||
btn->padTop(lv_dpx(4));
|
btn->padTop(lv_dpx(4));
|
||||||
btn->padBottom(lv_dpx(4));
|
btn->padBottom(lv_dpx(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void update() { edit->update(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -174,8 +178,8 @@ static const lv_coord_t line_row_dsc[] = {LV_GRID_CONTENT,
|
|||||||
|
|
||||||
static void set_failsafe(lv_event_t* e)
|
static void set_failsafe(lv_event_t* e)
|
||||||
{
|
{
|
||||||
auto edit = (NumberEdit*)lv_event_get_user_data(e);
|
auto combo = (ChannelFSCombo*)lv_event_get_user_data(e);
|
||||||
if (edit) edit->update();
|
if (combo) combo->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
FailSafePage::FailSafePage(uint8_t moduleIdx) :
|
FailSafePage::FailSafePage(uint8_t moduleIdx) :
|
||||||
@@ -215,8 +219,8 @@ FailSafePage::FailSafePage(uint8_t moduleIdx) :
|
|||||||
new StaticText(line, rect_t{}, ch_label, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, ch_label, 0, COLOR_THEME_PRIMARY1);
|
||||||
|
|
||||||
// Channel value
|
// Channel value
|
||||||
auto edit = new ChannelFSCombo(line, ch, -lim, lim);
|
auto combo = new ChannelFSCombo(line, ch, -lim, lim);
|
||||||
lv_obj_add_event_cb(btn->getLvObj(), set_failsafe, LV_EVENT_CLICKED, edit);
|
lv_obj_add_event_cb(btn->getLvObj(), set_failsafe, LV_EVENT_CLICKED, combo);
|
||||||
|
|
||||||
// Channel bargraph
|
// Channel bargraph
|
||||||
auto bar = new ChannelFailsafeBargraph(line, rect_t{}, moduleIdx, ch);
|
auto bar = new ChannelFailsafeBargraph(line, rect_t{}, moduleIdx, ch);
|
||||||
|
|||||||
Reference in New Issue
Block a user