fix: Trainer jack initialisation and driver cleanup (#3811)

This commit is contained in:
3djc
2023-08-09 21:08:42 +10:00
committed by GitHub
parent f7037a92b0
commit ae8e1fff8a
16 changed files with 57 additions and 48 deletions
+2 -2
View File
@@ -287,12 +287,12 @@ void displayTopBar()
}
if (SLAVE_MODE()) {
if (is_trainer_connected()) {
if (is_trainer_dsc_connected()) {
LCD_NOTIF_ICON(x, ICON_TRAINEE);
x -= 12;
}
}
else if (IS_TRAINER_INPUT_VALID()) {
else if (is_trainer_connected()) {
LCD_NOTIF_ICON(x, ICON_TRAINER);
x -= 12;
}
+2 -2
View File
@@ -86,7 +86,7 @@ void RadioTrainerPage::build(FormWindow * form)
#endif
new DynamicNumber<int16_t>(line, rect_t{},
[=]() { return (ppmInput[i] - g_eeGeneral.trainer.calib[i]) * 2; },
[=]() { return (trainerInput[i] - g_eeGeneral.trainer.calib[i]) * 2; },
LEFT | PPM_PRECISION | COLOR_THEME_PRIMARY1);
}
@@ -110,7 +110,7 @@ void RadioTrainerPage::build(FormWindow * form)
// Trainer calibration
auto btn = new TextButton(line, rect_t{0, 0, 0, 30}, std::string(STR_CAL), [=]() -> uint8_t {
memcpy(g_eeGeneral.trainer.calib, ppmInput,
memcpy(g_eeGeneral.trainer.calib, trainerInput,
sizeof(g_eeGeneral.trainer.calib));
SET_DIRTY();
return 0;
@@ -93,7 +93,7 @@ void menuRadioTrainer(event_t event)
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+1+6*FH, STR_CAL, attr);
for (uint8_t i = 0; i < 4; i++) {
uint8_t x = 8*FW + (i * TRAINER_CALIB_COLUMN_WIDTH);
int32_t chVal = ppmInput[i] - g_eeGeneral.trainer.calib[i];
int32_t chVal = trainerInput[i] - g_eeGeneral.trainer.calib[i];
chVal *= g_eeGeneral.trainer.mix[i].studWeight * 10;
chVal /= 512;
#if defined (PPM_UNIT_PERCENT_PREC1)
@@ -106,7 +106,7 @@ void menuRadioTrainer(event_t event)
if (attr) {
s_editMode = 0;
if (event==EVT_KEY_LONG(KEY_ENTER)){
memcpy(g_eeGeneral.trainer.calib, ppmInput, sizeof(g_eeGeneral.trainer.calib));
memcpy(g_eeGeneral.trainer.calib, trainerInput, sizeof(g_eeGeneral.trainer.calib));
storageDirty(EE_GENERAL);
AUDIO_WARNING1();
}