From 35708a61feb4ef0e4902b83202b2d51c3ed71697 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 23 Aug 2022 17:13:54 +0200 Subject: [PATCH] No longer disable temperature management in xyzcal We already disable the heaters upon entering, and the new temperature isr doesn't perform any direct movement until we return to the main loop. This allows us to remove direct control of the soft_pwm interrupt from the header, which is dangerous. --- Firmware/temperature.cpp | 8 ++++++++ Firmware/temperature.h | 14 -------------- Firmware/xyzcal.cpp | 30 ++++++++++++------------------ 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 53199cd6..80356bd4 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -50,6 +50,14 @@ #error "ADC_OVRSAMPL oversampling must match OVERSAMPLENR" #endif +#ifdef SYSTEM_TIMER_2 +#define ENABLE_SOFT_PWM_INTERRUPT() TIMSK2 |= (1<-1)) - DISABLE_FANCHECK_INTERRUPT(); -#endif //(defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1)) + st_synchronize(); + + // disable incompatible interrupts DISABLE_STEPPER_DRIVER_INTERRUPT(); #ifdef WATCHDOG wdt_disable(); #endif //WATCHDOG + + // setup internal callbacks sm4_stop_cb = 0; sm4_update_pos_cb = xyzcal_update_pos; sm4_calc_delay_cb = xyzcal_calc_delay; @@ -156,20 +159,15 @@ void xyzcal_meassure_leave(void) { DBG(_n("xyzcal_meassure_leave\n")); planner_abort_hard(); - ENABLE_SOFT_PWM_INTERRUPT(); -#if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1)) - ENABLE_FANCHECK_INTERRUPT(); -#endif //(defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1)) - ENABLE_STEPPER_DRIVER_INTERRUPT(); + + // re-enable interrupts #ifdef WATCHDOG wdt_enable(WDTO_4S); #ifdef EMERGENCY_HANDLERS WDTCSR |= (1 << WDIE); #endif //EMERGENCY_HANDLERS #endif //WATCHDOG - sm4_stop_cb = 0; - sm4_update_pos_cb = 0; - sm4_calc_delay_cb = 0; + ENABLE_STEPPER_DRIVER_INTERRUPT(); } @@ -999,13 +997,9 @@ BedSkewOffsetDetectionResultType xyzcal_scan_and_process(){ return ret; } -BedSkewOffsetDetectionResultType xyzcal_find_bed_induction_sensor_point_xy(void){ - BedSkewOffsetDetectionResultType ret = BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; - - //@size=258 +BedSkewOffsetDetectionResultType xyzcal_find_bed_induction_sensor_point_xy(void) { // DBG(_n("xyzcal_find_bed_induction_sensor_point_xy x=%ld y=%ld z=%ld\n"), count_position[X_AXIS], count_position[Y_AXIS], count_position[Z_AXIS]); - st_synchronize(); - + BedSkewOffsetDetectionResultType ret = BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; xyzcal_meassure_enter(); if (xyzcal_searchZ()) ret = xyzcal_scan_and_process();