@@ -303,6 +303,8 @@ extern "C" void TRAINER_TIMER_IRQHandler()
303
303
304
304
#if defined(TRAINER_MODULE_CPPM)
305
305
306
+ #include " hal/module_port.h"
307
+
306
308
static_assert (__IS_TRAINER_TIMER_IN_CHANNEL_SUPPORTED(TRAINER_MODULE_CPPM_TIMER_Channel),
307
309
"Unsupported trainer timer input channel");
308
310
@@ -323,12 +325,14 @@ static const stm32_pulse_timer_t trainerModuleTimer = {
323
325
324
326
void init_trainer_module_cppm ()
325
327
{
328
+ modulePortSetPower (EXTERNAL_MODULE,true );
326
329
_init_trainer_capture (&trainerModuleTimer);
327
330
}
328
331
329
332
void stop_trainer_module_cppm ()
330
333
{
331
334
_stop_trainer (&trainerModuleTimer);
335
+ modulePortSetPower (EXTERNAL_MODULE,false );
332
336
}
333
337
334
338
#if defined(TRAINER_MODULE_CPPM_TIMER_IRQHandler)
@@ -362,6 +366,7 @@ static etx_module_state_t* sbus_trainer_mod_st = nullptr;
362
366
void init_trainer_module_sbus ()
363
367
{
364
368
if (sbus_trainer_mod_st) return ;
369
+ modulePortSetPower (EXTERNAL_MODULE,true );
365
370
366
371
sbus_trainer_mod_st = modulePortInitSerial (EXTERNAL_MODULE, ETX_MOD_PORT_UART,
367
372
&sbusTrainerParams);
@@ -371,6 +376,8 @@ void stop_trainer_module_sbus()
371
376
{
372
377
if (!sbus_trainer_mod_st) return ;
373
378
modulePortDeInit (sbus_trainer_mod_st);
379
+ modulePortSetPower (EXTERNAL_MODULE,false );
380
+ sbus_trainer_mod_st = nullptr ;
374
381
}
375
382
376
383
int trainerModuleSbusGetByte (uint8_t * data)
0 commit comments