Disable bed PWM while probing bed.
This commit is contained in:
parent
3aa380e348
commit
570b5989f4
|
|
@ -61,6 +61,8 @@ enum class States : uint8_t {
|
||||||
///! Inner states of the finite automaton
|
///! Inner states of the finite automaton
|
||||||
static States state = States::ZERO_START;
|
static States state = States::ZERO_START;
|
||||||
|
|
||||||
|
bool bedPWMDisabled = 0;
|
||||||
|
|
||||||
///! Fast PWM counter is used in the RISE and FALL states (62.5kHz)
|
///! Fast PWM counter is used in the RISE and FALL states (62.5kHz)
|
||||||
static uint8_t slowCounter = 0;
|
static uint8_t slowCounter = 0;
|
||||||
///! Slow PWM counter is used in the ZERO and ONE states (62.5kHz/8 or 64)
|
///! Slow PWM counter is used in the ZERO and ONE states (62.5kHz/8 or 64)
|
||||||
|
|
@ -93,6 +95,7 @@ ISR(TIMER0_OVF_vect) // timer compare interrupt service routine
|
||||||
{
|
{
|
||||||
switch(state){
|
switch(state){
|
||||||
case States::ZERO_START:
|
case States::ZERO_START:
|
||||||
|
if (bedPWMDisabled) break;
|
||||||
pwm = soft_pwm_bed << 1;// expecting soft_pwm_bed to be 7bit!
|
pwm = soft_pwm_bed << 1;// expecting soft_pwm_bed to be 7bit!
|
||||||
if( pwm != 0 ){
|
if( pwm != 0 ){
|
||||||
state = States::ZERO; // do nothing, let it tick once again after the 30Hz period
|
state = States::ZERO; // do nothing, let it tick once again after the 30Hz period
|
||||||
|
|
@ -144,6 +147,9 @@ ISR(TIMER0_OVF_vect) // timer compare interrupt service routine
|
||||||
// if slowInc==2, soft_pwm == 251 will be the first to do short drops to zero. 252 will keep full heating
|
// if slowInc==2, soft_pwm == 251 will be the first to do short drops to zero. 252 will keep full heating
|
||||||
return; // want full duty for the next ONE cycle again - so keep on heating and just wait for the next timer ovf
|
return; // want full duty for the next ONE cycle again - so keep on heating and just wait for the next timer ovf
|
||||||
}
|
}
|
||||||
|
if (bedPWMDisabled){
|
||||||
|
return;
|
||||||
|
}
|
||||||
// otherwise moving towards FALL
|
// otherwise moving towards FALL
|
||||||
// @@TODO it looks like ONE_TO_FALL isn't necessary, there are no artefacts at all
|
// @@TODO it looks like ONE_TO_FALL isn't necessary, there are no artefacts at all
|
||||||
state = States::ONE;//_TO_FALL;
|
state = States::ONE;//_TO_FALL;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ float world2machine_shift[2];
|
||||||
#define WEIGHT_FIRST_ROW_Y_HIGH (0.3f)
|
#define WEIGHT_FIRST_ROW_Y_HIGH (0.3f)
|
||||||
#define WEIGHT_FIRST_ROW_Y_LOW (0.0f)
|
#define WEIGHT_FIRST_ROW_Y_LOW (0.0f)
|
||||||
|
|
||||||
|
extern bool bedPWMDisabled;
|
||||||
|
|
||||||
|
|
||||||
// Scaling of the real machine axes against the programmed dimensions in the firmware.
|
// Scaling of the real machine axes against the programmed dimensions in the firmware.
|
||||||
|
|
@ -946,6 +947,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
bool high_deviation_occured = false;
|
bool high_deviation_occured = false;
|
||||||
|
bedPWMDisabled = 1;
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
FORCE_HIGH_POWER_START;
|
FORCE_HIGH_POWER_START;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1044,6 +1046,7 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
FORCE_HIGH_POWER_END;
|
FORCE_HIGH_POWER_END;
|
||||||
#endif
|
#endif
|
||||||
|
bedPWMDisabled = 0;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
@ -1053,6 +1056,7 @@ error:
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
FORCE_HIGH_POWER_END;
|
FORCE_HIGH_POWER_END;
|
||||||
#endif
|
#endif
|
||||||
|
bedPWMDisabled = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue