From ebdc5e35e7587035f783466def32fed7922af72d Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sat, 4 May 2019 23:05:30 +0200 Subject: [PATCH] Remove two more OCR1A direct manipulations Use _NEXT_ISR and st_reset_timer to correctly reinitialize and re-schedule the advance ticks. --- Firmware/stepper.cpp | 33 +++++++++++++++++++++++++++------ Firmware/stepper.h | 10 +--------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 6b52c5ace..5a3d4010a 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -535,7 +535,7 @@ FORCE_INLINE void stepper_next_block() } } else { - OCR1A = 2000; // 1kHz. + _NEXT_ISR(2000); // 1kHz. } //WRITE_NC(LOGIC_ANALYZER_CH2, false); } @@ -1229,20 +1229,41 @@ void st_init() // create_speed_lookuptable.py TCCR1B = (TCCR1B & ~(0x07<