chore(afhds3): UI cosmetics and formatting

Post #3443 cleanup
This commit is contained in:
Peter Feerick
2023-04-13 20:40:58 +10:00
parent 02e804f55c
commit ddf6222d6b
2 changed files with 20 additions and 17 deletions
+19 -16
View File
@@ -152,10 +152,13 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
cfg = afhds3::getConfig(moduleIdx);
std::string title =
moduleIdx == INTERNAL_MODULE ? STR_INTERNALRF : STR_EXTERNALRF;
title += "AFHDS3";
title += moduleIdx == INTERNAL_MODULE ?"\nINRM301":"\nFRM303";
header.setTitle(title);
title = "AFHDS3 (";
title += (moduleIdx == INTERNAL_MODULE ? "INRM301" : "FRM303");
title += ")";
header.setTitle2(title);
auto form = new FormGroup(&body, rect_t{});
form->setFlexLayout();
form->padAll(lv_dpx(8));
@@ -170,17 +173,16 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
temp_str += TR_POWERMETER_FREQ;
new StaticText(line, rect_t{}, temp_str);
new PWMfrequencyChoice(line, moduleIdx );
//new NumberEdit(line, rect_t{}, 50, 400, GET_SET_DEFAULT(vCfg->PWMFrequency.Frequency));
temp_str ="PWM";
temp_str +=STR_SYNC;
line = form->newLine(&grid);
new StaticText(line, rect_t{}, temp_str);
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(vCfg->PWMFrequency.Synchronized));
line = form->newLine(&grid);
temp_str = TR_CHANS;
temp_str += "1";
temp_str = STR_CH;
temp_str += " 1";
new StaticText(line, rect_t{}, temp_str );
new Choice(line, rect_t{}, _analog_outputs,
afhds3::SES_ANALOG_OUTPUT_PWM, afhds3::SES_ANALOG_OUTPUT_PPM,
@@ -195,15 +197,16 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
} else {
auto vCfg = &cfg->v1;
for (uint8_t i = 0; i < channel_num[vCfg->PhyMode]; i++) {
std::string temp_str=TR_CHANS;
temp_str += std::to_string(i+1);
std::string temp_str = STR_CH;
temp_str += " " + std::to_string(i+1);
auto line = form->newLine(&grid);
new StaticText(line, rect_t{}, temp_str);
new PWMfrequencyChoice(line, moduleIdx, i);
temp_str ="PWM";
temp_str +=STR_SYNC;
line = form->newLine(&grid);
temp_str = "PWM";
temp_str += " ";
temp_str += STR_SYNC;
new StaticText(line, rect_t{}, temp_str);
new CheckBox(
line, rect_t{}, GET_DEFAULT((vCfg->PWMFrequenciesV1.Synchronized&1<<i)>>i),
@@ -240,10 +243,10 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
new StaticText(line, rect_t{}, STR_SIGNAL_OUTPUT);
std::vector<std::string> signed_strength_ch;
signed_strength_ch.emplace_back(STR_OFF);
for(int i=0; i<channel_num[cfg->v1.PhyMode]; i++ ){
std::string temstr = TR_CHANS;
temstr += std::to_string(i+1);
signed_strength_ch.emplace_back(temstr);
for (int i = 0; i < channel_num[cfg->v1.PhyMode]; i++) {
std::string temstr = STR_CH;
temstr += " " + std::to_string(i + 1);
signed_strength_ch.emplace_back(temstr);
}
new Choice(line, rect_t{}, signed_strength_ch,
0, channel_num[cfg->v1.PhyMode],
+1 -1
View File
@@ -1307,4 +1307,4 @@
#define TR_ANALOG_SERVO "Servo 50HZ"
#define TR_SIGNAL_OUTPUT "Signal output"
#define TR_SERIAL_BUS "Serial bus"
#define TR_SYNC "Sync"
#define TR_SYNC "Sync"