Fixed custom failsafe screen
This commit is contained in:
@@ -84,7 +84,7 @@ class ChannelFailsafeBargraph: public Window {
|
|||||||
class FailSafeBody : public FormGroup {
|
class FailSafeBody : public FormGroup {
|
||||||
public:
|
public:
|
||||||
FailSafeBody(FormGroup * parent, const rect_t & rect, uint8_t moduleIdx) :
|
FailSafeBody(FormGroup * parent, const rect_t & rect, uint8_t moduleIdx) :
|
||||||
FormGroup(parent, rect),
|
FormGroup(parent, rect, FORM_FORWARD_FOCUS),
|
||||||
moduleIdx(moduleIdx)
|
moduleIdx(moduleIdx)
|
||||||
{
|
{
|
||||||
build();
|
build();
|
||||||
@@ -110,16 +110,17 @@ class FailSafeBody : public FormGroup {
|
|||||||
new StaticText(this, grid.getLabelSlot(), getSourceString(MIXSRC_CH1 + ch));
|
new StaticText(this, grid.getLabelSlot(), getSourceString(MIXSRC_CH1 + ch));
|
||||||
|
|
||||||
// Channel numeric value
|
// Channel numeric value
|
||||||
new NumberEdit(this, grid.getFieldSlot(3, 0), -lim, lim,
|
new NumberEdit(this, grid.getFieldSlot(8, 0), -lim, lim,
|
||||||
GET_DEFAULT(calcRESXto1000(g_model.failsafeChannels[ch])),
|
GET_DEFAULT(g_model.failsafeChannels[ch]),
|
||||||
SET_VALUE(g_model.failsafeChannels[ch], newValue),
|
SET_VALUE(g_model.failsafeChannels[ch], newValue),
|
||||||
0, PREC1);
|
0, PREC1 | RIGHT);
|
||||||
|
|
||||||
// Channel bargraph
|
// Channel bargraph
|
||||||
new ChannelFailsafeBargraph(this, {150, grid.getWindowHeight(), 150, PAGE_LINE_HEIGHT}, moduleIdx, ch);
|
new ChannelFailsafeBargraph(this, {180, grid.getWindowHeight(), 150, PAGE_LINE_HEIGHT}, moduleIdx, ch);
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grid.spacer();
|
||||||
auto out2fail = new TextButton(this, grid.getLineSlot(), STR_CHANNELS2FAILSAFE);
|
auto out2fail = new TextButton(this, grid.getLineSlot(), STR_CHANNELS2FAILSAFE);
|
||||||
out2fail->setPressHandler([=]() {
|
out2fail->setPressHandler([=]() {
|
||||||
setCustomFailsafe(moduleIdx);
|
setCustomFailsafe(moduleIdx);
|
||||||
@@ -128,33 +129,24 @@ class FailSafeBody : public FormGroup {
|
|||||||
});
|
});
|
||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
setInnerHeight(grid.getWindowHeight());
|
setInnerHeight(grid.getWindowHeight() + PAGE_PADDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t moduleIdx;
|
uint8_t moduleIdx;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FailSafeFooter : public Window {
|
|
||||||
public:
|
|
||||||
FailSafeFooter(Window * parent, const rect_t & rect) :
|
|
||||||
Window(parent, rect)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void paint(BitmapBuffer * dc) override
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class FailSafePage : public Page {
|
class FailSafePage : public Page {
|
||||||
public:
|
public:
|
||||||
explicit FailSafePage(uint8_t moduleIdx) :
|
explicit FailSafePage(uint8_t moduleIdx) :
|
||||||
Page(ICON_STATS_ANALOGS),
|
Page(ICON_STATS_ANALOGS),
|
||||||
moduleIdx(moduleIdx)
|
moduleIdx(moduleIdx)
|
||||||
{
|
{
|
||||||
new FailSafeBody(&body, {0, 0, LCD_W, height() - footerHeight}, moduleIdx);
|
new FailSafeBody(&body, {0, 0, LCD_W, body.height()}, moduleIdx);
|
||||||
new FailSafeFooter(&body, {0, height() - footerHeight, LCD_W, footerHeight});
|
new StaticText(&header,
|
||||||
|
{PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT,
|
||||||
|
PAGE_LINE_HEIGHT},
|
||||||
|
STR_FAILSAFESET, 0, FOCUS_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user