fix: x10 Express boot freeze and bluetooth lockup (#3349)
* Fix attempt for boot issue * fix: reset BT usart context after de-init
This commit is contained in:
@@ -1694,6 +1694,8 @@ int main()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
boardInit();
|
boardInit();
|
||||||
|
|
||||||
|
modulePortInit();
|
||||||
pulsesInit();
|
pulsesInit();
|
||||||
|
|
||||||
checkValidMCU();
|
checkValidMCU();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include "timers_driver.h"
|
#include "timers_driver.h"
|
||||||
|
#include "tasks/mixer_task.h"
|
||||||
|
|
||||||
#if defined(USBJ_EX)
|
#if defined(USBJ_EX)
|
||||||
#include "usb_joystick.h"
|
#include "usb_joystick.h"
|
||||||
@@ -60,7 +61,10 @@ void preModelLoad()
|
|||||||
logsClose();
|
logsClose();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pulsesStop();
|
if (mixerTaskStarted()) {
|
||||||
|
pulsesStop();
|
||||||
|
}
|
||||||
|
|
||||||
stopTrainer();
|
stopTrainer();
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
deleteCustomScreens();
|
deleteCustomScreens();
|
||||||
@@ -182,7 +186,13 @@ void postModelLoad(bool alarms)
|
|||||||
PLAY_MODEL_NAME();
|
PLAY_MODEL_NAME();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pulsesStart();
|
|
||||||
|
// Mixer should only be restarted
|
||||||
|
// if we are switching between models,
|
||||||
|
// not on first boot (started later on)
|
||||||
|
if (mixerTaskStarted()) {
|
||||||
|
pulsesStart();
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(SDCARD)
|
#if defined(SDCARD)
|
||||||
referenceModelAudioFiles();
|
referenceModelAudioFiles();
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ void bluetoothDisable()
|
|||||||
LL_GPIO_SetOutputPin(BT_EN_GPIO, BT_EN_GPIO_PIN);
|
LL_GPIO_SetOutputPin(BT_EN_GPIO, BT_EN_GPIO_PIN);
|
||||||
if (_bt_usart_ctx) {
|
if (_bt_usart_ctx) {
|
||||||
STM32SerialDriver.deinit(_bt_usart_ctx);
|
STM32SerialDriver.deinit(_bt_usart_ctx);
|
||||||
|
_bt_usart_ctx = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ static RTOS_MUTEX_HANDLE mixerMutex;
|
|||||||
// The mixer will start in 'paused' mode
|
// The mixer will start in 'paused' mode
|
||||||
// and start working properly once
|
// and start working properly once
|
||||||
// mixerTaskStart() has been called.
|
// mixerTaskStart() has been called.
|
||||||
|
static bool _mixer_started = false;
|
||||||
static bool _mixer_running = false;
|
static bool _mixer_running = false;
|
||||||
static bool _mixer_exit = false;
|
static bool _mixer_exit = false;
|
||||||
|
|
||||||
@@ -61,8 +62,14 @@ void mixerTaskInit()
|
|||||||
MIXER_STACK_SIZE, MIXER_TASK_PRIO);
|
MIXER_STACK_SIZE, MIXER_TASK_PRIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool mixerTaskStarted()
|
||||||
|
{
|
||||||
|
return _mixer_started;
|
||||||
|
}
|
||||||
|
|
||||||
void mixerTaskStart()
|
void mixerTaskStart()
|
||||||
{
|
{
|
||||||
|
_mixer_started = true;
|
||||||
_mixer_running = true;
|
_mixer_running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ TASK_FUNCTION(mixerTask);
|
|||||||
// init, create and start the OS task itself
|
// init, create and start the OS task itself
|
||||||
void mixerTaskInit();
|
void mixerTaskInit();
|
||||||
|
|
||||||
|
// return true if the mixer has
|
||||||
|
// already started at least once since boot
|
||||||
|
bool mixerTaskStarted();
|
||||||
|
|
||||||
// start the main computations
|
// start the main computations
|
||||||
// and pushing channels out
|
// and pushing channels out
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user