diff --git a/radio/src/rtos.h b/radio/src/rtos.h index 1478b778a..d352b953a 100644 --- a/radio/src/rtos.h +++ b/radio/src/rtos.h @@ -27,8 +27,6 @@ extern "C++" { #endif -#define doNothing() do { } while(0) // seems unused? don't ever use this with SIMU - #if defined(SIMU) #include @@ -149,7 +147,7 @@ extern "C++" { } #endif - #define RTOS_MS_PER_TICK (CFG_CPU_FREQ / CFG_SYSTICK_FREQ / (CFG_CPU_FREQ / 1000)) // RTOS timer tick length in ms (currently 2) + #define RTOS_MS_PER_TICK ((CFG_CPU_FREQ / CFG_SYSTICK_FREQ) / (CFG_CPU_FREQ / 1000)) // RTOS timer tick length in ms (currently 2) typedef OS_TID RTOS_TASK_HANDLE; typedef OS_MutexID RTOS_MUTEX_HANDLE; diff --git a/radio/src/tasks_arm.cpp b/radio/src/tasks_arm.cpp index fdfa36f0c..129684a4d 100644 --- a/radio/src/tasks_arm.cpp +++ b/radio/src/tasks_arm.cpp @@ -122,7 +122,7 @@ TASK_FUNCTION(mixerTask) if (!s_pulses_paused) { uint16_t t0 = getTmr2MHz(); - + DEBUG_TIMER_START(debugTimerMixer); RTOS_LOCK_MUTEX(mixerMutex); doMixerCalculations(); @@ -162,11 +162,11 @@ void scheduleNextMixerCalculation(uint8_t module, uint16_t period_ms) { // Schedule next mixer calculation time, // for now assume mixer calculation takes 2 ms. - nextMixerTime[module] = (uint32_t)RTOS_GET_TIME() + period_ms - 1 /*1.2ms before next pulse*/; + nextMixerTime[module] = (uint32_t)RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK) - 1 /* 1 tick in advance*/; DEBUG_TIMER_STOP(debugTimerMixerCalcToUsage); } -#define MENU_TASK_PERIOD_TICKS 50 // 50ms +#define MENU_TASK_PERIOD_TICKS (50 / RTOS_MS_PER_TICK) // 50ms #if defined(COLORLCD) && defined(CLI) bool perMainEnabled = true;