Review power supply timeout.
- Move the variable from dda.c to pinio.c. - Reset the timeout on each power on, to guarantee a minimum PSU on time.
This commit is contained in:
parent
1cb40082e4
commit
3d1ebf1186
4
clock.c
4
clock.c
|
|
@ -25,14 +25,14 @@
|
|||
void clock_250ms() {
|
||||
#ifndef NO_AUTO_IDLE
|
||||
if (temp_all_zero()) {
|
||||
if (steptimeout > (30 * 4)) {
|
||||
if (psu_timeout > (30 * 4)) {
|
||||
power_off();
|
||||
}
|
||||
else {
|
||||
uint8_t save_reg = SREG;
|
||||
cli();
|
||||
CLI_SEI_BUG_MEMORY_BARRIER();
|
||||
steptimeout++;
|
||||
psu_timeout++;
|
||||
MEMORY_BARRIER();
|
||||
SREG = save_reg;
|
||||
}
|
||||
|
|
|
|||
8
dda.c
8
dda.c
|
|
@ -28,9 +28,6 @@
|
|||
#error STEPS_PER_MM_Y is gone, review your config.h and use STEPS_PER_M_Y
|
||||
#endif
|
||||
|
||||
/// step timeout
|
||||
volatile uint8_t steptimeout = 0;
|
||||
|
||||
/*
|
||||
position tracking
|
||||
*/
|
||||
|
|
@ -275,7 +272,6 @@ void dda_create(DDA *dda, TARGET *target) {
|
|||
}
|
||||
else {
|
||||
// get steppers ready to go
|
||||
steptimeout = 0;
|
||||
power_on();
|
||||
stepper_enable();
|
||||
x_enable();
|
||||
|
|
@ -483,7 +479,7 @@ void dda_start(DDA *dda) {
|
|||
// called from interrupt context: keep it simple!
|
||||
if ( ! dda->nullmove) {
|
||||
// get ready to go
|
||||
steptimeout = 0;
|
||||
psu_timeout = 0;
|
||||
if (dda->z_delta)
|
||||
z_enable();
|
||||
|
||||
|
|
@ -823,7 +819,7 @@ void dda_step(DDA *dda) {
|
|||
z_disable();
|
||||
}
|
||||
else
|
||||
steptimeout = 0;
|
||||
psu_timeout = 0;
|
||||
|
||||
#ifdef ACCELERATION_RAMPING
|
||||
// we don't hit maximum speed exactly with acceleration calculation, so limit it here
|
||||
|
|
|
|||
4
dda.h
4
dda.h
|
|
@ -221,10 +221,6 @@ typedef struct {
|
|||
variables
|
||||
*/
|
||||
|
||||
/// steptimeout is set to zero when we step, and increases over time so we can turn the motors off when they've been idle for a while
|
||||
/// It is also used inside and outside of interrupts, which is why it has been made volatile
|
||||
extern volatile uint8_t steptimeout;
|
||||
|
||||
/// startpoint holds the endpoint of the most recently created DDA, so we know where the next one created starts. could also be called last_endpoint
|
||||
extern TARGET startpoint;
|
||||
|
||||
|
|
|
|||
|
|
@ -704,7 +704,6 @@ void process_gcode_command() {
|
|||
y_enable();
|
||||
z_enable();
|
||||
e_enable();
|
||||
steptimeout = 0;
|
||||
break;
|
||||
|
||||
case 191:
|
||||
|
|
|
|||
5
pinio.c
5
pinio.c
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
static char ps_is_on = 0;
|
||||
|
||||
/// step/psu timeout
|
||||
volatile uint8_t psu_timeout = 0;
|
||||
|
||||
void power_on() {
|
||||
|
||||
if (ps_is_on == 0) {
|
||||
|
|
@ -13,6 +16,8 @@ void power_on() {
|
|||
#endif
|
||||
ps_is_on = 1;
|
||||
}
|
||||
|
||||
psu_timeout = 0;
|
||||
}
|
||||
|
||||
void power_off() {
|
||||
|
|
|
|||
7
pinio.h
7
pinio.h
|
|
@ -11,6 +11,13 @@
|
|||
Power
|
||||
*/
|
||||
|
||||
/// psu_timeout is set to zero when we step, and increases over time so we can
|
||||
/// turn the motors off when they've been idle for a while.
|
||||
/// A second function is to guarantee a minimum on time of the PSU.
|
||||
/// Timeout counting is done in clock.c.
|
||||
/// It is used inside and outside of interrupts, which is why it has been made volatile
|
||||
extern volatile uint8_t psu_timeout;
|
||||
|
||||
void power_on(void);
|
||||
void power_off(void);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue