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.
This commit is contained in:
parent
7cd888cd0a
commit
35708a61fe
@ -50,6 +50,14 @@
|
|||||||
#error "ADC_OVRSAMPL oversampling must match OVERSAMPLENR"
|
#error "ADC_OVRSAMPL oversampling must match OVERSAMPLENR"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SYSTEM_TIMER_2
|
||||||
|
#define ENABLE_SOFT_PWM_INTERRUPT() TIMSK2 |= (1<<OCIE2B)
|
||||||
|
#define DISABLE_SOFT_PWM_INTERRUPT() TIMSK2 &= ~(1<<OCIE2B)
|
||||||
|
#else //SYSTEM_TIMER_2
|
||||||
|
#define ENABLE_SOFT_PWM_INTERRUPT() TIMSK0 |= (1<<OCIE0B)
|
||||||
|
#define DISABLE_SOFT_PWM_INTERRUPT() TIMSK0 &= ~(1<<OCIE0B)
|
||||||
|
#endif //SYSTEM_TIMER_2
|
||||||
|
|
||||||
// temperature manager timer configuration
|
// temperature manager timer configuration
|
||||||
#define TEMP_MGR_INTV 0.27 // seconds, ~3.7Hz
|
#define TEMP_MGR_INTV 0.27 // seconds, ~3.7Hz
|
||||||
#define TIMER5_PRESCALE 256
|
#define TIMER5_PRESCALE 256
|
||||||
|
@ -24,20 +24,6 @@
|
|||||||
#include "Marlin.h"
|
#include "Marlin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef SYSTEM_TIMER_2
|
|
||||||
|
|
||||||
#define ENABLE_SOFT_PWM_INTERRUPT() TIMSK2 |= (1<<OCIE2B)
|
|
||||||
#define DISABLE_SOFT_PWM_INTERRUPT() TIMSK2 &= ~(1<<OCIE2B)
|
|
||||||
|
|
||||||
#else //SYSTEM_TIMER_2
|
|
||||||
|
|
||||||
#define ENABLE_SOFT_PWM_INTERRUPT() TIMSK0 |= (1<<OCIE0B)
|
|
||||||
#define DISABLE_SOFT_PWM_INTERRUPT() TIMSK0 &= ~(1<<OCIE0B)
|
|
||||||
|
|
||||||
#endif //SYSTEM_TIMER_2
|
|
||||||
|
|
||||||
|
|
||||||
// public functions
|
// public functions
|
||||||
void soft_pwm_init(); //initialize the soft pwm isr
|
void soft_pwm_init(); //initialize the soft pwm isr
|
||||||
void temp_mgr_init(); //initialize the temperature handler
|
void temp_mgr_init(); //initialize the temperature handler
|
||||||
|
@ -138,15 +138,18 @@ pos_mm_t pos_2_mm(float pos){
|
|||||||
void xyzcal_meassure_enter(void)
|
void xyzcal_meassure_enter(void)
|
||||||
{
|
{
|
||||||
DBG(_n("xyzcal_meassure_enter\n"));
|
DBG(_n("xyzcal_meassure_enter\n"));
|
||||||
|
|
||||||
|
// disable heaters and stop motion before we initialize sm4
|
||||||
disable_heater();
|
disable_heater();
|
||||||
DISABLE_SOFT_PWM_INTERRUPT();
|
st_synchronize();
|
||||||
#if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
|
|
||||||
DISABLE_FANCHECK_INTERRUPT();
|
// disable incompatible interrupts
|
||||||
#endif //(defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
|
|
||||||
DISABLE_STEPPER_DRIVER_INTERRUPT();
|
DISABLE_STEPPER_DRIVER_INTERRUPT();
|
||||||
#ifdef WATCHDOG
|
#ifdef WATCHDOG
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
#endif //WATCHDOG
|
#endif //WATCHDOG
|
||||||
|
|
||||||
|
// setup internal callbacks
|
||||||
sm4_stop_cb = 0;
|
sm4_stop_cb = 0;
|
||||||
sm4_update_pos_cb = xyzcal_update_pos;
|
sm4_update_pos_cb = xyzcal_update_pos;
|
||||||
sm4_calc_delay_cb = xyzcal_calc_delay;
|
sm4_calc_delay_cb = xyzcal_calc_delay;
|
||||||
@ -156,20 +159,15 @@ void xyzcal_meassure_leave(void)
|
|||||||
{
|
{
|
||||||
DBG(_n("xyzcal_meassure_leave\n"));
|
DBG(_n("xyzcal_meassure_leave\n"));
|
||||||
planner_abort_hard();
|
planner_abort_hard();
|
||||||
ENABLE_SOFT_PWM_INTERRUPT();
|
|
||||||
#if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
|
// re-enable interrupts
|
||||||
ENABLE_FANCHECK_INTERRUPT();
|
|
||||||
#endif //(defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
|
|
||||||
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
|
||||||
#ifdef WATCHDOG
|
#ifdef WATCHDOG
|
||||||
wdt_enable(WDTO_4S);
|
wdt_enable(WDTO_4S);
|
||||||
#ifdef EMERGENCY_HANDLERS
|
#ifdef EMERGENCY_HANDLERS
|
||||||
WDTCSR |= (1 << WDIE);
|
WDTCSR |= (1 << WDIE);
|
||||||
#endif //EMERGENCY_HANDLERS
|
#endif //EMERGENCY_HANDLERS
|
||||||
#endif //WATCHDOG
|
#endif //WATCHDOG
|
||||||
sm4_stop_cb = 0;
|
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
||||||
sm4_update_pos_cb = 0;
|
|
||||||
sm4_calc_delay_cb = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -999,13 +997,9 @@ BedSkewOffsetDetectionResultType xyzcal_scan_and_process(){
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BedSkewOffsetDetectionResultType xyzcal_find_bed_induction_sensor_point_xy(void){
|
BedSkewOffsetDetectionResultType xyzcal_find_bed_induction_sensor_point_xy(void) {
|
||||||
BedSkewOffsetDetectionResultType ret = BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND;
|
|
||||||
|
|
||||||
//@size=258
|
|
||||||
// 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]);
|
// 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();
|
xyzcal_meassure_enter();
|
||||||
if (xyzcal_searchZ())
|
if (xyzcal_searchZ())
|
||||||
ret = xyzcal_scan_and_process();
|
ret = xyzcal_scan_and_process();
|
||||||
|
Loading…
Reference in New Issue
Block a user