Skip to content

Commit 0260d56

Browse files
committed
Move the flysky gimbal hook to the adc driver
1 parent 6e68c5e commit 0260d56

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

radio/src/hal/adc_driver.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
#include "adc_driver.h"
2323
#include "board.h"
24+
#if defined(FLYSKY_GIMBAL)
25+
#include "flysky_gimbal_driver.h"
26+
#endif
2427

2528
#include "edgetx.h"
2629

@@ -61,6 +64,12 @@ static bool adcSingleRead()
6164
if (_hal_adc_driver->wait_completion)
6265
_hal_adc_driver->wait_completion();
6366

67+
// Need to put all in a group to ensure DMA transfer will not affect ADC sampling
68+
#if defined(FLYSKY_GIMBAL) && !defined(SIMU)
69+
flysky_gimbal_start_read();
70+
flysky_gimbal_wait_completion();
71+
#endif
72+
6473
return true;
6574
}
6675

radio/src/tasks/mixer_task.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,6 @@ void doMixerCalculations()
254254
getADC();
255255
DEBUG_TIMER_STOP(debugTimerGetAdc);
256256

257-
// Need to put all in a group to ensure DMA transfer will not affect ADC sampling
258-
#if defined(FLYSKY_GIMBAL) && !defined(SIMU)
259-
flysky_gimbal_start_read();
260-
#endif
261-
#if defined(FLYSKY_GIMBAL) && !defined(SIMU)
262-
flysky_gimbal_wait_completion();
263-
#endif
264-
265257
DEBUG_TIMER_START(debugTimerGetSwitches);
266258
getSwitchesPosition(!s_mixer_first_run_done);
267259
DEBUG_TIMER_STOP(debugTimerGetSwitches);

0 commit comments

Comments
 (0)