feat: indicate in analog debug if serial gimbals are used (#5442)
This commit is contained in:
@@ -81,11 +81,13 @@ static void adc_wait_completion()
|
||||
}
|
||||
|
||||
const etx_hal_adc_driver_t _adc_driver = {
|
||||
_hal_inputs,
|
||||
_pot_default_config,
|
||||
adc_init,
|
||||
adc_start_read,
|
||||
adc_wait_completion
|
||||
.inputs = _hal_inputs,
|
||||
.default_pots_cfg = _pot_default_config,
|
||||
.init = adc_init,
|
||||
.start_conversion = adc_start_read,
|
||||
.wait_completion = adc_wait_completion,
|
||||
.set_input_mask = stm32_hal_set_inputs_mask,
|
||||
.get_input_mask = stm32_hal_get_inputs_mask,
|
||||
};
|
||||
|
||||
#if defined(PWM_STICKS)
|
||||
|
||||
@@ -86,7 +86,13 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
x = INDENT_WIDTH;
|
||||
y += FH;
|
||||
}
|
||||
drawStringWithIndex(x, y, "A", i + 1);
|
||||
if (((adcGetInputMask() & (1 << i)) != 0) && i < adcGetMaxInputs(ADC_INPUT_MAIN)) {
|
||||
lcdDrawText(x, y, "D");
|
||||
lcdDrawNumber(lcdNextPos, y, i + 1);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(x, y, i+1, LEADING0|LEFT, 2);
|
||||
}
|
||||
lcdDrawChar(lcdNextPos, y, ':');
|
||||
switch (viewpage) {
|
||||
case (ANAVIEW_RAWLOWFPS):
|
||||
|
||||
@@ -56,7 +56,13 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
for (uint8_t i = 0; i < MAX_ANALOG_INPUTS; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + (i/2)*FH;
|
||||
uint8_t x = i&1 ? LCD_W/2 + FW : 0;
|
||||
lcdDrawNumber(x, y, i+1, LEADING0|LEFT, 2);
|
||||
if (((adcGetInputMask() & (1 << i)) != 0) && i < adcGetMaxInputs(ADC_INPUT_MAIN)) {
|
||||
lcdDrawText(x, y, "D");
|
||||
lcdDrawNumber(lcdNextPos, y, i + 1);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(x, y, i + 1, LEADING0 | LEFT, 2);
|
||||
}
|
||||
lcdDrawChar(x+2*FW-2, y, ':');
|
||||
|
||||
switch (viewpage)
|
||||
|
||||
@@ -84,8 +84,11 @@ class AnaViewWindow : public Window
|
||||
#endif
|
||||
|
||||
lv_obj_set_style_pad_column(line->getLvObj(), 8, 0);
|
||||
if (((adcGetInputMask() & (1 << i)) != 0) && i < adcGetMaxInputs(ADC_INPUT_MAIN))
|
||||
sprintf(s, "D%d :", i + 1);
|
||||
else
|
||||
sprintf(s, "%02d :", i + 1);
|
||||
|
||||
sprintf(s, "%02d :", i + 1);
|
||||
new StaticText(line, rect_t{}, s);
|
||||
|
||||
auto lbl = new DynamicText(
|
||||
|
||||
@@ -579,3 +579,17 @@ const char* adcGetInputShortLabel(uint8_t type, uint8_t idx)
|
||||
|
||||
return _hal_adc_inputs[type].inputs[idx].short_label;
|
||||
}
|
||||
|
||||
void adcSetInputMask(uint32_t mask)
|
||||
{
|
||||
if (_hal_adc_driver && _hal_adc_driver->set_input_mask) {
|
||||
_hal_adc_driver->set_input_mask(mask);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t adcGetInputMask()
|
||||
{
|
||||
return _hal_adc_driver && _hal_adc_driver->get_input_mask
|
||||
? _hal_adc_driver->get_input_mask()
|
||||
: 0;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,9 @@ struct etx_hal_adc_driver_t {
|
||||
bool (*init)();
|
||||
bool (*start_conversion)();
|
||||
void (*wait_completion)();
|
||||
|
||||
void (*set_input_mask)(uint32_t);
|
||||
uint32_t (*get_input_mask)();
|
||||
};
|
||||
|
||||
bool adcInit(const etx_hal_adc_driver_t* driver);
|
||||
@@ -137,6 +140,9 @@ int adcGetInputIdx(const char* input, uint8_t len);
|
||||
const char* adcGetInputLabel(uint8_t type, uint8_t idx);
|
||||
const char* adcGetInputShortLabel(uint8_t type, uint8_t idx);
|
||||
|
||||
void adcSetInputMask(uint32_t mask);
|
||||
uint32_t adcGetInputMask();
|
||||
|
||||
// To be implemented by the target driver
|
||||
// int8_t adcGetVRTC();
|
||||
// int8_t adcGetVBAT();
|
||||
|
||||
@@ -173,7 +173,7 @@ bool flysky_gimbal_init()
|
||||
delay_ms(1);
|
||||
if (_fs_gimbal_detected) {
|
||||
// Mask the first 4 inputs (sticks)
|
||||
stm32_hal_mask_inputs(0xF);
|
||||
stm32_hal_set_inputs_mask(0xF);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,11 +77,16 @@ static uint8_t _adc_run;
|
||||
static uint8_t _adc_oversampling_disabled;
|
||||
static uint16_t _adc_oversampling[MAX_ADC_INPUTS];
|
||||
|
||||
void stm32_hal_mask_inputs(uint32_t inputs)
|
||||
void stm32_hal_set_inputs_mask(uint32_t inputs)
|
||||
{
|
||||
_adc_input_inhibt_mask |= inputs;
|
||||
}
|
||||
|
||||
uint32_t stm32_hal_get_inputs_mask()
|
||||
{
|
||||
return _adc_input_inhibt_mask;
|
||||
}
|
||||
|
||||
// STM32 uses a 25K+25K voltage divider bridge to measure the battery voltage
|
||||
// Measuring VBAT puts considerable drain (22 µA) on the battery instead of
|
||||
// normal drain (~10 nA)
|
||||
|
||||
@@ -67,4 +67,5 @@ void stm32_hal_adc_disable_oversampling();
|
||||
void stm32_hal_adc_dma_isr(const stm32_adc_t* adc);
|
||||
void stm32_hal_adc_isr(const stm32_adc_t* adc);
|
||||
|
||||
void stm32_hal_mask_inputs(uint32_t inputs);
|
||||
void stm32_hal_set_inputs_mask(uint32_t inputs);
|
||||
uint32_t stm32_hal_get_inputs_mask();
|
||||
|
||||
@@ -55,7 +55,9 @@ typedef enum
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
|
||||
#if !defined(UNUSED)
|
||||
#define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */
|
||||
#endif
|
||||
|
||||
#define HAL_MAX_DELAY 0xFFFFFFFFU
|
||||
|
||||
|
||||
Reference in New Issue
Block a user