File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -452,8 +452,9 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
452452 }
453453
454454 // Register access is fast and edge IRQ was configured before.
455- // Timer is 80MHz fixed. 160MHz binaries need scaling,
456- // 80MHz binaries in 160MHz boost (SDK) need NMI scaling
457- // to maintain duty/idle ratio.
458- T1L = CPU2X & 1 ? nextTimerCcys >> 1 : nextTimerCcys;
455+ // Timer is 80MHz fixed. 160MHz binaries need scaling.
456+ // For dynamic CPU clock frequency switch in loop the scaling logic would have to be adapted.
457+ // Using constexpr makes sure that the CPU clock frequency is compile-time fixed.
458+ constexpr bool cpuFreq80MHz = clockCyclesPerMicrosecond () == 80 ;
459+ T1L = cpuFreq80MHz ? nextTimerCcys : nextTimerCcys >> 1 ;
459460}
You can’t perform that action at this time.
0 commit comments