@@ -37,72 +37,6 @@ std::string switchWarninglabel(swsrc_t index)
|
|||||||
return TEXT_AT_INDEX(STR_VSRCRAW, (index + MIXSRC_FIRST_SWITCH - MIXSRC_Rud + 1)) + std::string(&switchPositions[g_model.switchWarningState >> (3*index) & 0x07], 1);
|
return TEXT_AT_INDEX(STR_VSRCRAW, (index + MIXSRC_FIRST_SWITCH - MIXSRC_Rud + 1)) + std::string(&switchPositions[g_model.switchWarningState >> (3*index) & 0x07], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ModuleStatus: public StaticText
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ModuleStatus(Window * parent, const rect_t & rect, uint8_t moduleIdx):
|
|
||||||
StaticText(parent, rect),
|
|
||||||
moduleIdx(moduleIdx)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkEvents() override
|
|
||||||
{
|
|
||||||
getModuleStatusString(moduleIdx, reusableBuffer.moduleSetup.msg);
|
|
||||||
if (text != reusableBuffer.moduleSetup.msg) {
|
|
||||||
setText(reusableBuffer.moduleSetup.msg);
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
uint8_t moduleIdx;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ModuleCurrentPower: public StaticText
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ModuleCurrentPower(Window * parent, const rect_t & rect, uint8_t moduleIdx):
|
|
||||||
StaticText(parent, rect),
|
|
||||||
moduleIdx(moduleIdx)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkEvents() override
|
|
||||||
{
|
|
||||||
getStringAtIndex(reusableBuffer.moduleSetup.msg, STR_AFHDS3_POWERS, actualAfhdsRunPower(moduleIdx));
|
|
||||||
if (text != reusableBuffer.moduleSetup.msg) {
|
|
||||||
setText(reusableBuffer.moduleSetup.msg);
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
uint8_t moduleIdx;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ModuleSyncStatus: public StaticText
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ModuleSyncStatus(Window * parent, const rect_t & rect, uint8_t moduleIdx):
|
|
||||||
StaticText(parent, rect),
|
|
||||||
moduleIdx(moduleIdx)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkEvents() override
|
|
||||||
{
|
|
||||||
getModuleSyncStatusString(moduleIdx, reusableBuffer.moduleSetup.msg);
|
|
||||||
if (text != reusableBuffer.moduleSetup.msg) {
|
|
||||||
setText(reusableBuffer.moduleSetup.msg);
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
uint8_t moduleIdx;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ChannelFailsafeBargraph: public Window {
|
class ChannelFailsafeBargraph: public Window {
|
||||||
public:
|
public:
|
||||||
ChannelFailsafeBargraph(Window * parent, const rect_t & rect, uint8_t moduleIdx, uint8_t channel):
|
ChannelFailsafeBargraph(Window * parent, const rect_t & rect, uint8_t moduleIdx, uint8_t channel):
|
||||||
@@ -714,7 +648,11 @@ class ModuleWindow : public FormGroup {
|
|||||||
|
|
||||||
// Multimodule status
|
// Multimodule status
|
||||||
new StaticText(this, grid.getLabelSlot(true), STR_MODULE_STATUS);
|
new StaticText(this, grid.getLabelSlot(true), STR_MODULE_STATUS);
|
||||||
new ModuleStatus(this, grid.getFieldSlot(), moduleIdx);
|
new DynamicText(this, grid.getFieldSlot(), [=] {
|
||||||
|
char msg[64] = "";
|
||||||
|
getModuleStatusString(moduleIdx, msg);
|
||||||
|
return std::string(msg);
|
||||||
|
});
|
||||||
|
|
||||||
// Multimodule sync
|
// Multimodule sync
|
||||||
/*if (multiSyncStatus.isValid()) {
|
/*if (multiSyncStatus.isValid()) {
|
||||||
@@ -752,6 +690,11 @@ class ModuleWindow : public FormGroup {
|
|||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
new StaticText(this, grid.getLabelSlot(true), STR_MULTI_LOWPOWER);
|
new StaticText(this, grid.getLabelSlot(true), STR_MULTI_LOWPOWER);
|
||||||
new CheckBox(this, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.lowPowerMode));
|
new CheckBox(this, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.lowPowerMode));
|
||||||
|
|
||||||
|
// Disable telemetry
|
||||||
|
grid.nextLine();
|
||||||
|
new StaticText(this, grid.getLabelSlot(true), STR_DISABLE_TELEM);
|
||||||
|
new CheckBox(this, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.disableMapping));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(AFHDS3)
|
#if defined(AFHDS3)
|
||||||
@@ -768,12 +711,21 @@ class ModuleWindow : public FormGroup {
|
|||||||
// Status
|
// Status
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
new StaticText(this, grid.getLabelSlot(true), STR_MODULE_STATUS);
|
new StaticText(this, grid.getLabelSlot(true), STR_MODULE_STATUS);
|
||||||
new ModuleStatus(this, grid.getFieldSlot(), moduleIdx);
|
new DynamicText(this, grid.getFieldSlot(), [=] {
|
||||||
|
char msg[64] = "";
|
||||||
|
getModuleStatusString(moduleIdx, msg);
|
||||||
|
return std::string(msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Power source
|
// Power source
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_POWER_SOURCE);
|
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_POWER_SOURCE);
|
||||||
new ModuleSyncStatus(this, grid.getFieldSlot(), moduleIdx);
|
new DynamicText(this, grid.getFieldSlot(), [=] {
|
||||||
|
char msg[64] = "";
|
||||||
|
getModuleSyncStatusString(moduleIdx, msg);
|
||||||
|
return std::string(msg);
|
||||||
|
});
|
||||||
|
|
||||||
// RX Freq
|
// RX Freq
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
@@ -787,7 +739,11 @@ class ModuleWindow : public FormGroup {
|
|||||||
// Module actual power
|
// Module actual power
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_ACTUAL_POWER);
|
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_ACTUAL_POWER);
|
||||||
new ModuleCurrentPower(this, grid.getFieldSlot(), moduleIdx);
|
new DynamicText(this, grid.getFieldSlot(), [=] {
|
||||||
|
char msg[64] = "";
|
||||||
|
getStringAtIndex(msg, STR_AFHDS3_POWERS, actualAfhdsRunPower(moduleIdx));
|
||||||
|
return std::string(msg);
|
||||||
|
});
|
||||||
|
|
||||||
// Module power
|
// Module power
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
@@ -893,6 +849,7 @@ class ModuleWindow : public FormGroup {
|
|||||||
|
|
||||||
// Failsafe
|
// Failsafe
|
||||||
if (isModuleFailsafeAvailable(moduleIdx)) {
|
if (isModuleFailsafeAvailable(moduleIdx)) {
|
||||||
|
hasFailsafe = true;
|
||||||
new StaticText(this, grid.getLabelSlot(true), STR_FAILSAFE);
|
new StaticText(this, grid.getLabelSlot(true), STR_FAILSAFE);
|
||||||
failSafeChoice = new Choice(this, grid.getFieldSlot(2, 0), STR_VFAILSAFE, 0, FAILSAFE_LAST,
|
failSafeChoice = new Choice(this, grid.getFieldSlot(2, 0), STR_VFAILSAFE, 0, FAILSAFE_LAST,
|
||||||
GET_DEFAULT(g_model.moduleData[moduleIdx].failsafeMode),
|
GET_DEFAULT(g_model.moduleData[moduleIdx].failsafeMode),
|
||||||
@@ -980,7 +937,18 @@ class ModuleWindow : public FormGroup {
|
|||||||
getParent()->moveWindowsTop(top() + 1, adjustHeight());
|
getParent()->moveWindowsTop(top() + 1, adjustHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkEvents() override
|
||||||
|
{
|
||||||
|
if (isModuleFailsafeAvailable(moduleIdx) != hasFailsafe) {
|
||||||
|
hasFailsafe = isModuleFailsafeAvailable(moduleIdx);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
FormGroup::checkEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool hasFailsafe = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
ModelSetupPage::ModelSetupPage() :
|
ModelSetupPage::ModelSetupPage() :
|
||||||
|
|||||||
Reference in New Issue
Block a user