From cc47656cd560cfbb2a0bde037427ff49bbb9ed69 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 3 Jun 2023 12:18:46 +0200 Subject: [PATCH] Introduce 6POS default calib for Boxer and tx16s --- radio/src/hal/adc_driver.cpp | 12 ++++++------ radio/src/targets/horus/board.h | 5 +++++ radio/src/targets/taranis/board.h | 5 +++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/radio/src/hal/adc_driver.cpp b/radio/src/hal/adc_driver.cpp index 0c9f6e66a..5fe5ce07a 100644 --- a/radio/src/hal/adc_driver.cpp +++ b/radio/src/hal/adc_driver.cpp @@ -200,13 +200,13 @@ static void disableUncalibratedXPots() StepsCalibData* calib = (StepsCalibData*)&g_eeGeneral.calib[i + pot_offset]; if(!IS_MULTIPOS_CALIBRATED(calib)) { // not enough config points - // - // TODO: a way to provide to 6POS default calibration values - // - // -> check if there is a board supplied default calibration - // -> if not, just disable the input - // +#if defined(XPOS_CALIB_DEFAULT) + size_t index = 0; + calib->count = XPOTS_MULTIPOS_COUNT - 1; + for (const auto &value : XPOS_CALIB_DEFAULT) calib->steps[index++] = value; +#else g_eeGeneral.potsConfig &= POT_CONFIG_DISABLE_MASK(i); +#endif } } } diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index e14e48bb0..e475191a6 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -174,6 +174,11 @@ void SDRAM_Init(); #define NUM_FUNCTIONS_SWITCHES 0 #endif +// POTS and SLIDERS default configuration +#if defined(RADIO_TX16S) +#define XPOS_CALIB_DEFAULT {0x3, 0xc, 0x15, 0x1e, 0x26} +#endif + // Trims driver #define NUM_TRIMS 6 #define NUM_TRIMS_KEYS (NUM_TRIMS * 2) diff --git a/radio/src/targets/taranis/board.h b/radio/src/targets/taranis/board.h index b84d9aab0..1192b9ec4 100644 --- a/radio/src/targets/taranis/board.h +++ b/radio/src/targets/taranis/board.h @@ -137,6 +137,11 @@ uint32_t isBootloaderStart(const uint8_t * buffer); #define TRAINER_CONNECTED() true #endif +// POTS and SLIDERS default configuration +#if defined(RADIO_BOXER) +#define XPOS_CALIB_DEFAULT {0x5, 0xd, 0x16, 0x1f, 0x28} +#endif + #if defined(FUNCTION_SWITCHES) #define NUM_FUNCTIONS_SWITCHES 6