Add AFSHD3 module parameters
This commit is contained in:
@@ -37,10 +37,10 @@ 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 MultimoduleStatus: public StaticText
|
class ModuleStatus: public StaticText
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MultimoduleStatus(Window * parent, const rect_t & rect, uint8_t moduleIdx):
|
ModuleStatus(Window * parent, const rect_t & rect, uint8_t moduleIdx):
|
||||||
StaticText(parent, rect),
|
StaticText(parent, rect),
|
||||||
moduleIdx(moduleIdx)
|
moduleIdx(moduleIdx)
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,51 @@ class MultimoduleStatus: public StaticText
|
|||||||
|
|
||||||
void checkEvents() override
|
void checkEvents() override
|
||||||
{
|
{
|
||||||
getMultiModuleStatus(moduleIdx).getStatusString(reusableBuffer.moduleSetup.msg);
|
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) {
|
if (text != reusableBuffer.moduleSetup.msg) {
|
||||||
setText(reusableBuffer.moduleSetup.msg);
|
setText(reusableBuffer.moduleSetup.msg);
|
||||||
invalidate();
|
invalidate();
|
||||||
@@ -670,7 +714,7 @@ 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 MultimoduleStatus(this, grid.getFieldSlot(), moduleIdx);
|
new ModuleStatus(this, grid.getFieldSlot(), moduleIdx);
|
||||||
|
|
||||||
// Multimodule sync
|
// Multimodule sync
|
||||||
/*if (multiSyncStatus.isValid()) {
|
/*if (multiSyncStatus.isValid()) {
|
||||||
@@ -710,22 +754,46 @@ class ModuleWindow : public FormGroup {
|
|||||||
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));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined (PCBNV14)
|
#if defined(AFHDS3)
|
||||||
else if (isModuleAFHDS3(moduleIdx)) {
|
else if (isModuleAFHDS3(moduleIdx)) {
|
||||||
grid.nextLine();
|
rfChoice = new Choice(this, grid.getFieldSlot(2, 1), STR_AFHDS3_PROTOCOLS, AFHDS_SUBTYPE_FIRST, AFHDS_SUBTYPE_LAST,
|
||||||
rfChoice = new Choice(this, grid.getFieldSlot(), STR_AFHDS3_PROTOCOLS, 0, 3,
|
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].subType));
|
||||||
GET_DEFAULT(g_model.moduleData[moduleIdx].flysky.mode),
|
|
||||||
[=](int32_t newValue) -> void {
|
|
||||||
g_model.moduleData[moduleIdx].flysky.mode = newValue;
|
|
||||||
SET_DIRTY();
|
|
||||||
//TODO moduleFlagBackNormal(moduleIdx);
|
|
||||||
//TODO onFlySkyReceiverSetPulse(INTERNAL_MODULE, newValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
// TYPE
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
new StaticText(this, grid.getLabelSlot(true), STR_FLYSKY_TELEMETRY);
|
new StaticText(this, grid.getLabelSlot(true), STR_TYPE);
|
||||||
new CheckBox(this, grid.getFieldSlot(), GET_SET_DEFAULT(g_model.rssiAlarms.flysky_telemetry));
|
new StaticText(this, grid.getFieldSlot(),
|
||||||
|
g_model.moduleData[EXTERNAL_MODULE].afhds3.telemetry ? STR_AFHDS3_ONE_TO_ONE_TELEMETRY : TR_AFHDS3_ONE_TO_MANY);
|
||||||
|
|
||||||
|
// Status
|
||||||
|
grid.nextLine();
|
||||||
|
new StaticText(this, grid.getLabelSlot(true), STR_MODULE_STATUS);
|
||||||
|
new ModuleStatus(this, grid.getFieldSlot(), moduleIdx);
|
||||||
|
|
||||||
|
// Power source
|
||||||
|
grid.nextLine();
|
||||||
|
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_POWER_SOURCE);
|
||||||
|
new ModuleSyncStatus(this, grid.getFieldSlot(), moduleIdx);
|
||||||
|
|
||||||
|
// RX Freq
|
||||||
|
grid.nextLine();
|
||||||
|
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_RX_FREQ);
|
||||||
|
auto edit = new NumberEdit(this, grid.getFieldSlot(2,0), MIN_FREQ, MAX_FREQ, GET_DEFAULT(g_model.moduleData[moduleIdx].afhds3.rxFreq()));
|
||||||
|
edit->setSetValueHandler([=](int32_t newValue) {
|
||||||
|
g_model.moduleData[EXTERNAL_MODULE].afhds3.setRxFreq((uint16_t)newValue);
|
||||||
|
});
|
||||||
|
edit->setSuffix(STR_HZ);
|
||||||
|
|
||||||
|
// Module actual power
|
||||||
|
grid.nextLine();
|
||||||
|
new StaticText(this, grid.getLabelSlot(true), STR_AFHDS3_ACTUAL_POWER);
|
||||||
|
new ModuleCurrentPower(this, grid.getFieldSlot(), moduleIdx);
|
||||||
|
|
||||||
|
// Module power
|
||||||
|
grid.nextLine();
|
||||||
|
new StaticText(this, grid.getLabelSlot(true), STR_RF_POWER);
|
||||||
|
new Choice(this, grid.getFieldSlot(2, 0), STR_AFHDS3_POWERS, afhds3::RUN_POWER::RUN_POWER_FIRST, afhds3::RUN_POWER::RUN_POWER_LAST,
|
||||||
|
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].afhds3.runPower));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
@@ -911,6 +979,8 @@ class ModuleWindow : public FormGroup {
|
|||||||
|
|
||||||
getParent()->moveWindowsTop(top() + 1, adjustHeight());
|
getParent()->moveWindowsTop(top() + 1, adjustHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ModelSetupPage::ModelSetupPage() :
|
ModelSetupPage::ModelSetupPage() :
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ const char STR_MOVESTICKSPOTS[] = TR_MOVESTICKSPOTS;
|
|||||||
const char STR_TX[] = TR_TXnRX;
|
const char STR_TX[] = TR_TXnRX;
|
||||||
const char STR_NODATA[] = TR_NODATA;
|
const char STR_NODATA[] = TR_NODATA;
|
||||||
const char STR_US[] = TR_US;
|
const char STR_US[] = TR_US;
|
||||||
|
const char STR_HZ[] = TR_HZ;
|
||||||
const char STR_TMIXMAXMS[] = TR_TMIXMAXMS;
|
const char STR_TMIXMAXMS[] = TR_TMIXMAXMS;
|
||||||
const char STR_FREE_STACK[] = TR_FREE_STACK;
|
const char STR_FREE_STACK[] = TR_FREE_STACK;
|
||||||
const char STR_MENUTORESET[] = TR_MENUTORESET;
|
const char STR_MENUTORESET[] = TR_MENUTORESET;
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ extern const char STR_TX[];
|
|||||||
#define STR_RX (STR_TX+OFS_RX)
|
#define STR_RX (STR_TX+OFS_RX)
|
||||||
extern const char STR_NODATA[];
|
extern const char STR_NODATA[];
|
||||||
extern const char STR_US[];
|
extern const char STR_US[];
|
||||||
|
extern const char STR_HZ[];
|
||||||
extern const char STR_TMIXMAXMS[];
|
extern const char STR_TMIXMAXMS[];
|
||||||
extern const char STR_FREE_STACK[];
|
extern const char STR_FREE_STACK[];
|
||||||
extern const char STR_MENUTORESET[];
|
extern const char STR_MENUTORESET[];
|
||||||
|
|||||||
@@ -581,6 +581,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER "NO DATA"
|
#define TR_NODATA CENTER "NO DATA"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
#define TR_FREE_STACK "Free stack"
|
#define TR_FREE_STACK "Free stack"
|
||||||
#define TR_MENUTORESET TR_ENTER " to reset"
|
#define TR_MENUTORESET TR_ENTER " to reset"
|
||||||
|
|||||||
@@ -575,6 +575,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER "NO DATA"
|
#define TR_NODATA CENTER "NO DATA"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
#define TR_FREE_STACK "Free stack"
|
#define TR_FREE_STACK "Free stack"
|
||||||
#define TR_MENUTORESET TR_ENTER" >> Reset"
|
#define TR_MENUTORESET TR_ENTER" >> Reset"
|
||||||
|
|||||||
@@ -585,6 +585,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER"Keine Daten"
|
#define TR_NODATA CENTER"Keine Daten"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
#define TR_FREE_STACK "Freier Stack"
|
#define TR_FREE_STACK "Freier Stack"
|
||||||
#define TR_MENUTORESET TR_ENTER " für Reset"
|
#define TR_MENUTORESET TR_ENTER " für Reset"
|
||||||
|
|||||||
@@ -581,6 +581,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER "NO DATA"
|
#define TR_NODATA CENTER "NO DATA"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
#define TR_FREE_STACK "Free stack"
|
#define TR_FREE_STACK "Free stack"
|
||||||
#define TR_MENUTORESET TR_ENTER " to reset"
|
#define TR_MENUTORESET TR_ENTER " to reset"
|
||||||
|
|||||||
@@ -577,6 +577,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER "SIN DATOS"
|
#define TR_NODATA CENTER "SIN DATOS"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "Tmix máx"
|
#define TR_TMIXMAXMS "Tmix máx"
|
||||||
#define TR_FREE_STACK "Stack libre"
|
#define TR_FREE_STACK "Stack libre"
|
||||||
#define TR_MENUTORESET TR_ENTER "Resetear"
|
#define TR_MENUTORESET TR_ENTER "Resetear"
|
||||||
|
|||||||
@@ -590,6 +590,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER "NO DATA"
|
#define TR_NODATA CENTER "NO DATA"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
|
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
#define TR_FREE_STACK "Free stack"
|
#define TR_FREE_STACK "Free stack"
|
||||||
|
|||||||
@@ -601,6 +601,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER "NO DATA"
|
#define TR_NODATA CENTER "NO DATA"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMR1LATMINUS "Tmr1Lat min\037\124us"
|
#define TR_TMR1LATMINUS "Tmr1Lat min\037\124us"
|
||||||
|
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
|
|||||||
@@ -605,6 +605,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER"DATI ASSENTI"
|
#define TR_NODATA CENTER"DATI ASSENTI"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
#define TR_FREE_STACK "Free stack"
|
#define TR_FREE_STACK "Free stack"
|
||||||
#define TR_MENUTORESET TR_ENTER" per azzerare"
|
#define TR_MENUTORESET TR_ENTER" per azzerare"
|
||||||
|
|||||||
@@ -584,6 +584,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER"Geen Data"
|
#define TR_NODATA CENTER"Geen Data"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
#define TR_FREE_STACK "Free stack"
|
#define TR_FREE_STACK "Free stack"
|
||||||
#define TR_MENUTORESET TR_ENTER" voor Reset"
|
#define TR_MENUTORESET TR_ENTER" voor Reset"
|
||||||
|
|||||||
@@ -601,6 +601,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER "BrakDAN"
|
#define TR_NODATA CENTER "BrakDAN"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "TmixMaks"
|
#define TR_TMIXMAXMS "TmixMaks"
|
||||||
#define TR_FREE_STACK "Wolny stos"
|
#define TR_FREE_STACK "Wolny stos"
|
||||||
#define TR_MENUTORESET TR_ENTER " >> Reset"
|
#define TR_MENUTORESET TR_ENTER " >> Reset"
|
||||||
|
|||||||
@@ -583,6 +583,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER"SEM DADOS"
|
#define TR_NODATA CENTER"SEM DADOS"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
#define TR_FREE_STACK "Free stack"
|
#define TR_FREE_STACK "Free stack"
|
||||||
#define TR_MENUTORESET TR_ENTER" Reinicia"
|
#define TR_MENUTORESET TR_ENTER" Reinicia"
|
||||||
|
|||||||
@@ -603,6 +603,7 @@
|
|||||||
#define TR_ACCEL "Acc:"
|
#define TR_ACCEL "Acc:"
|
||||||
#define TR_NODATA CENTER "DATA SAKNAS"
|
#define TR_NODATA CENTER "DATA SAKNAS"
|
||||||
#define TR_US "us"
|
#define TR_US "us"
|
||||||
|
#define TR_HZ "Hz"
|
||||||
#define TR_TMIXMAXMS "Tmix max"
|
#define TR_TMIXMAXMS "Tmix max"
|
||||||
#define TR_FREE_STACK "Free stack"
|
#define TR_FREE_STACK "Free stack"
|
||||||
#define TR_MENUTORESET TR_ENTER " Nollar"
|
#define TR_MENUTORESET TR_ENTER " Nollar"
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import glob
|
||||||
|
|
||||||
|
|
||||||
|
def addLine(filename, newline, after):
|
||||||
|
print(filename, newline)
|
||||||
|
with open(filename, 'r') as f:
|
||||||
|
lines = f.readlines()
|
||||||
|
for i, line in enumerate(lines):
|
||||||
|
if after in line:
|
||||||
|
lines.insert(i + 1, newline + '\n')
|
||||||
|
break
|
||||||
|
with open(filename, 'w') as f:
|
||||||
|
f.writelines(lines)
|
||||||
|
|
||||||
|
|
||||||
|
def modifyTranslations(constant, translation, after):
|
||||||
|
for filename in glob.glob('translations/*.h.txt'):
|
||||||
|
newline = "#define " + constant + " " * max(1, 31 - len(constant)) + '"' + translation + '"'
|
||||||
|
addLine(filename, newline, after + " ")
|
||||||
|
|
||||||
|
|
||||||
|
def modifyDeclaration(constant, after):
|
||||||
|
newline = "extern const char S" + constant + "[];"
|
||||||
|
filename = "translations.h"
|
||||||
|
addLine(filename, newline, after + "[];")
|
||||||
|
|
||||||
|
|
||||||
|
def modifyDefinition(constant, after):
|
||||||
|
newline = "const char S" + constant + "[] = " + constant + ";"
|
||||||
|
filename = "translations.cpp"
|
||||||
|
addLine(filename, newline, after + "[] ")
|
||||||
|
|
||||||
|
|
||||||
|
after = sys.argv[-1]
|
||||||
|
for arg in sys.argv[1:-1]:
|
||||||
|
constant, translation = arg.split("=")
|
||||||
|
modifyTranslations(constant, translation, after)
|
||||||
|
modifyDeclaration(constant, after)
|
||||||
|
modifyDefinition(constant, after)
|
||||||
|
after = constant
|
||||||
Reference in New Issue
Block a user