fix: SPORT power handling UI on supported B&W radios (#3636)
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <opentx.h>
|
#include <opentx.h>
|
||||||
#include "hal/adc_driver.h"
|
#include "hal/adc_driver.h"
|
||||||
|
#include "io/frsky_firmware_update.h"
|
||||||
|
|
||||||
#if defined(CROSSFIRE)
|
#if defined(CROSSFIRE)
|
||||||
#include "telemetry/crossfire.h"
|
#include "telemetry/crossfire.h"
|
||||||
@@ -132,9 +133,7 @@ enum {
|
|||||||
|
|
||||||
ITEM_RADIO_HARDWARE_JITTER_FILTER,
|
ITEM_RADIO_HARDWARE_JITTER_FILTER,
|
||||||
ITEM_RADIO_HARDWARE_RAS,
|
ITEM_RADIO_HARDWARE_RAS,
|
||||||
#if defined(SPORT_UPDATE_PWR_GPIO)
|
|
||||||
ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER,
|
ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER,
|
||||||
#endif
|
|
||||||
ITEM_RADIO_HARDWARE_DEBUG,
|
ITEM_RADIO_HARDWARE_DEBUG,
|
||||||
#if defined(EEPROM)
|
#if defined(EEPROM)
|
||||||
ITEM_RADIO_BACKUP_EEPROM,
|
ITEM_RADIO_BACKUP_EEPROM,
|
||||||
@@ -274,11 +273,7 @@ static uint8_t _dispSerialPort(uint8_t port_nr)
|
|||||||
#define HW_SETTINGS_COLUMN2 (HW_SETTINGS_COLUMN1 + 5*FW)
|
#define HW_SETTINGS_COLUMN2 (HW_SETTINGS_COLUMN1 + 5*FW)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SPORT_UPDATE_PWR_GPIO)
|
#define SPORT_PWR_ROW (hasSportPower() ? (uint8_t)0 : HIDDEN_ROW)
|
||||||
#define SPORT_POWER_ROWS 0,
|
|
||||||
#else
|
|
||||||
#define SPORT_POWER_ROWS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(EEPROM)
|
#if defined(EEPROM)
|
||||||
#define EEPROM_ROWS 0 /* EEPROM backup */, 0 /* Factory reset */,
|
#define EEPROM_ROWS 0 /* EEPROM backup */, 0 /* Factory reset */,
|
||||||
@@ -326,7 +321,7 @@ void menuRadioHardware(event_t event)
|
|||||||
SERIAL_PORT_ROWS
|
SERIAL_PORT_ROWS
|
||||||
0 /* ADC filter */,
|
0 /* ADC filter */,
|
||||||
READONLY_ROW /* RAS */,
|
READONLY_ROW /* RAS */,
|
||||||
SPORT_POWER_ROWS
|
SPORT_PWR_ROW,
|
||||||
1 /* debugs */,
|
1 /* debugs */,
|
||||||
EEPROM_ROWS
|
EEPROM_ROWS
|
||||||
});
|
});
|
||||||
@@ -666,15 +661,15 @@ void menuRadioHardware(event_t event)
|
|||||||
lcdDrawText(lcdNextPos, y, "---");
|
lcdDrawText(lcdNextPos, y, "---");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// TODO: this is board specific, do something about it!
|
case ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER:
|
||||||
// #if defined(SPORT_UPDATE_PWR_GPIO)
|
g_eeGeneral.sportUpdatePower = editChoice(HW_SETTINGS_COLUMN2, y, STR_SPORT_UPDATE_POWER_MODE, STR_SPORT_UPDATE_POWER_MODES, g_eeGeneral.sportUpdatePower, 0, 1, attr, event);
|
||||||
// case ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER:
|
if (attr && checkIncDec_Ret) {
|
||||||
// g_eeGeneral.sportUpdatePower = editChoice(HW_SETTINGS_COLUMN2, y, STR_SPORT_UPDATE_POWER_MODE, STR_SPORT_UPDATE_POWER_MODES, g_eeGeneral.sportUpdatePower, 0, 1, attr, event);
|
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
|
||||||
// if (attr && checkIncDec_Ret) {
|
if (mod_desc && mod_desc->set_pwr) {
|
||||||
// SPORT_UPDATE_POWER_INIT();
|
mod_desc->set_pwr(g_eeGeneral.sportUpdatePower);
|
||||||
// }
|
}
|
||||||
// break;
|
}
|
||||||
// #endif
|
break;
|
||||||
|
|
||||||
case ITEM_RADIO_HARDWARE_DEBUG:
|
case ITEM_RADIO_HARDWARE_DEBUG:
|
||||||
lcdDrawTextAlignedLeft(y, STR_DEBUG);
|
lcdDrawTextAlignedLeft(y, STR_DEBUG);
|
||||||
|
|||||||
@@ -476,6 +476,14 @@ bool isSerialModeAvailable(uint8_t port_nr, int mode)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasSportPower() {
|
||||||
|
auto mod_desc = modulePortGetModuleDescription(SPORT_MODULE);
|
||||||
|
if (mod_desc && mod_desc->set_pwr) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool isSwitchAvailableInLogicalSwitches(int swtch)
|
bool isSwitchAvailableInLogicalSwitches(int swtch)
|
||||||
{
|
{
|
||||||
return isSwitchAvailable(swtch, LogicalSwitchesContext);
|
return isSwitchAvailable(swtch, LogicalSwitchesContext);
|
||||||
@@ -1123,6 +1131,7 @@ int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable)
|
|||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
|
|
||||||
const uint8_t getMaxMultiOptions()
|
const uint8_t getMaxMultiOptions()
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ uint8_t getTelemetrySensorsCount();
|
|||||||
bool isTelemetryFieldComparisonAvailable(int index);
|
bool isTelemetryFieldComparisonAvailable(int index);
|
||||||
bool isSensorAvailable(int sensor);
|
bool isSensorAvailable(int sensor);
|
||||||
bool isRssiSensorAvailable(int sensor);
|
bool isRssiSensorAvailable(int sensor);
|
||||||
|
bool hasSportPower();
|
||||||
|
|
||||||
bool modelHasNotes();
|
bool modelHasNotes();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user