Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2038,8 +2038,13 @@ if(zero_crosses < 5){
}

#if !defined(MCU_G031) && !defined(NEED_INPUT_READY)
// only touch the NVIC when the priority scheme actually changes
static uint8_t input_priority_is_high = 0xFF; // unknown at boot, first pass sets it
uint8_t want_input_priority = dshot_telemetry && (commutation_interval > DSHOT_PRIORITY_THRESHOLD);
if (want_input_priority != input_priority_is_high) {
input_priority_is_high = want_input_priority;
#ifdef NXP
if (dshot_telemetry && (commutation_interval > DSHOT_PRIORITY_THRESHOLD)) {
if (want_input_priority) {
NVIC_SetPriority(IC_DMA_IRQ_NAME, 0);
NVIC_SetPriority(COM_TIMER_IRQ, 1);
NVIC_SetPriority(COMP0_IRQ, 1);
Expand All @@ -2051,7 +2056,7 @@ if(zero_crosses < 5){
NVIC_SetPriority(COMP1_IRQ, 0);
}
#else
if (dshot_telemetry && (commutation_interval > DSHOT_PRIORITY_THRESHOLD)) {
if (want_input_priority) {
NVIC_SetPriority(IC_DMA_IRQ_NAME, 0);
NVIC_SetPriority(COM_TIMER_IRQ, 1);
NVIC_SetPriority(COMPARATOR_IRQ, 1);
Expand All @@ -2061,6 +2066,7 @@ if(zero_crosses < 5){
NVIC_SetPriority(COMPARATOR_IRQ, 0);
}
#endif
}
#endif
if (send_telemetry) {
#ifdef USE_SERIAL_TELEMETRY
Expand Down