fixed issue with calling afhds2a SPI before setup (blank screen issue),

fixed watchdog issue where isModuleSynchronous was defined wrong,
remove DisablePPMOut,
This commit is contained in:
janek
2025-01-19 19:12:29 +01:00
committed by Janek
parent 8e9dd6066e
commit e99e8b4d13
6 changed files with 41 additions and 39 deletions
+1 -1
View File
@@ -410,7 +410,7 @@ void perMain()
{
DEBUG_TIMER_START(debugTimerPerMain1);
#if !defined(PCBI6X)
#if defined(AUDIO)
checkSpeakerVolume();
#endif
+14 -3
View File
@@ -174,9 +174,20 @@ inline void startPulses()
#endif
}
inline bool pulsesStarted() { return moduleState[0].protocol != 255; }
inline void pausePulses() { s_pulses_paused = true; }
inline void resumePulses() { s_pulses_paused = false; }
inline bool pulsesStarted()
{
return moduleState[0].protocol != PROTOCOL_CHANNELS_UNINITIALIZED;
}
inline void pausePulses()
{
s_pulses_paused = true;
}
inline void resumePulses()
{
s_pulses_paused = false;
}
#define SEND_FAILSAFE_NOW(idx) moduleState[idx].counter = 1
+2 -2
View File
@@ -44,9 +44,9 @@ const uint8_t AFHDS2A_A7105_regs[] = {
};
void SPI_Write(uint8_t command)
{//working OK
{
while((SPI1->SR & SPI_SR_BSY));
*(__IO uint8_t *)&SPI1->DR = command; //Write the first data item to be transmitted into the SPI_DR register (this clears the TXE flag).
*(__IO uint8_t *)&SPI1->DR = command; // Write the first data item to be transmitted into the SPI_DR register (this clears the TXE flag).
#ifdef DEBUG_SPI
debug("%02X ",command);
#endif
+6 -22
View File
@@ -22,29 +22,11 @@
void extmoduleSendNextFrame();
//inline void EnablePPMTim(void) {
// TRACE("EnablePPMTim");
// SET_BIT(EXTMODULE_TIMER->CR1, TIM_CR1_CEN);
//}
//inline void DisablePPMTim(void) {
// TRACE("DisablePPMTim");
// CLEAR_BIT(EXTMODULE_TIMER->CR1, TIM_CR1_CEN);
//}
// inline void EnablePPMOut(void) {
// TRACE("EnablePPMOut");
// SET_BIT(EXTMODULE_TIMER->CCER, TIM_CCER_CC2E);
// }
inline void DisablePPMOut(void) {
TRACE("DisablePPMOut");
CLEAR_BIT(EXTMODULE_TIMER->CCER, TIM_CCER_CC2E);
}
void extmoduleStop() {
TRACE("extmoduleStop");
DisablePPMOut();
CLEAR_BIT(EXTMODULE_TIMER->CCER, TIM_CCER_CC2E);
// Keep timer running because PPM IN uses the same one
// DisablePPMTim();
// NVIC_DisableIRQ(EXTMODULE_TIMER_IRQn);
EXTERNAL_MODULE_OFF();
@@ -104,7 +86,8 @@ void extmoduleTimerStart(uint32_t period, uint8_t state) {
EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN; // Start counter
}
void extmodulePpmStart() {
void extmodulePpmStart()
{
TRACE("extmodulePpmStart");
/**EXTMODULE_TIMER GPIO Configuration
PF9 ------> TIM15_CH1
@@ -126,7 +109,8 @@ void extmodulePpmStart() {
EXTMODULE_TIMER->CCER |= TIM_CCER_CC2E;
}
inline void extmoduleSendNextFrame() {
inline void extmoduleSendNextFrame()
{
static bool delay = true;
static uint16_t delay_halfus = GET_PPM_DELAY(EXTERNAL_MODULE) * 2;
if (moduleState[EXTERNAL_MODULE].protocol == PROTOCOL_CHANNELS_PPM) {
@@ -25,7 +25,9 @@
void intmoduleStop() {
TRACE("intmoduleStop");
CLEAR_BIT(INTMODULE_TIMER->CR1, TIM_CR1_CEN);
A7105_Sleep();
if (moduleState[INTERNAL_MODULE].protocol == PROTOCOL_CHANNELS_AFHDS2A_SPI)
A7105_Sleep();
}
void intmoduleAfhds2aPulsesStart(uint16_t periodUs) {
+15 -10
View File
@@ -68,8 +68,8 @@ bool isForcePowerOffRequested()
bool isModuleSynchronous(uint8_t moduleIdx)
{
switch (g_model.moduleData[moduleIdx].type) {
case MODULE_TYPE_CROSSFIRE:
switch (moduleState[moduleIdx].protocol) {
case PROTOCOL_CHANNELS_CROSSFIRE:
case PROTOCOL_CHANNELS_NONE:
#if defined(MULTIMODULE)
case PROTOCOL_CHANNELS_MULTIMODULE:
@@ -123,10 +123,12 @@ void execMixerFrequentActions()
#endif
}
TASK_FUNCTION(mixerTask) {
TASK_FUNCTION(mixerTask)
{
s_pulses_paused = true;
mixerSchedulerInit();
mixerSchedulerStart();
while (true) {
@@ -170,7 +172,13 @@ TASK_FUNCTION(mixerTask) {
doMixerCalculations();
#if defined(HARDWARE_INTERNAL_MODULE) && defined(HARDWARE_EXTERNAL_MODULE)
sendSynchronousPulses((1 << INTERNAL_MODULE) | (1 << EXTERNAL_MODULE));
#elif defined(HARDWARE_INTERNAL_MODULE)
sendSynchronousPulses((1 << INTERNAL_MODULE));
#elif defined(HARDWARE_EXTERNAL_MODULE)
sendSynchronousPulses(1 << EXTERNAL_MODULE);
#endif
doMixerPeriodicUpdates();
@@ -209,7 +217,8 @@ TASK_FUNCTION(mixerTask) {
bool perMainEnabled = true;
#endif
TASK_FUNCTION(menusTask) {
TASK_FUNCTION(menusTask)
{
opentxInit();
#if defined(PWR_BUTTON_PRESS)
@@ -226,13 +235,9 @@ TASK_FUNCTION(menusTask) {
#endif
uint32_t start = (uint32_t)RTOS_GET_TIME();
DEBUG_TIMER_START(debugTimerPerMain);
#if defined(COLORLCD) && defined(CLI)
if (perMainEnabled) {
perMain();
}
#else
perMain();
#endif
DEBUG_TIMER_STOP(debugTimerPerMain);
// TODO remove completely massstorage from sky9x firmware
uint32_t runtime = ((uint32_t)RTOS_GET_TIME() - start);