Minor fix related to spindle_stop() crashing abort in certain cases.

- Updated spindle_stop() to fix abort bug and to be more in line with
v0.8.
This commit is contained in:
Sonny Jeon 2012-03-10 12:34:09 -07:00
parent 86cdae0060
commit d3be216931
5 changed files with 24 additions and 16 deletions

View File

@ -115,8 +115,8 @@
#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds)
// FOR ADVANCED USERS ONLY: Toggles XON/XOFF software flow control for serial communications.
// Officially not supported due to problems involving the Atmega8U2 USB-to-serial chips on current
// future Arduinos boards. The firmware on these chips do not support XON/XOFF flow control
// Officially not supported due to problems involving the Atmega8U2 USB-to-serial chips on all
// new and future Arduinos. The firmware on these chips do not support XON/XOFF flow control
// characters and the intermediate buffer in the chips cause latency and overflow problems with
// standard terminal programs. However, using specifically-programmed UI's to manage this latency
// problem has been confirmed to work, as well as, using older FTDI FT232RL-based Arduinos
@ -141,4 +141,12 @@
#define DECIMAL_MULTIPLIER 100
#endif
// Limit step rate for homing
#define LIMIT_STEP_RATE 1 // (mm/min)
// Debounce delay is the time delay the controller waits for a "good" signal from the limit switch.
// A delay of 3ms to 5ms is a good starting value.
#define LIMIT_DEBOUNCE_DELAY 5 // (milliseconds)
#endif

View File

@ -569,7 +569,7 @@ static int next_statement(char *letter, double *double_ptr, char *line, uint8_t
- Evaluation of expressions
- Variables
- Multiple home locations
- Multiple coordinate systems (Additional ones maybe added in config.h)
- Multiple coordinate systems (Up to 6 may be added via config.h)
- Probing
- Override control
- Tool changes

2
main.c
View File

@ -72,7 +72,7 @@ int main(void)
protocol_init(); // Clear incoming line data
plan_init(); // Clear block buffer and planner variables
gc_init(); // Set g-code parser to default state
spindle_init();
spindle_init();
limits_init();
st_reset(); // Clear stepper subsystem variables.

View File

@ -200,4 +200,4 @@ void serial_reset_read_buffer()
#if ENABLE_XONXOFF
flow_ctrl = XON_SENT;
#endif
}
}

View File

@ -3,6 +3,7 @@
Part of Grbl
Copyright (c) 2009-2011 Simen Svale Skogsrud
Copyright (c) 2012 Sungeun K. Jeon
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -27,22 +28,26 @@
#include <stdint.h>
// TODO: Deprecated. Need to update for new version.
static int current_direction;
static uint8_t current_direction;
void spindle_init()
{
current_direction = 0;
SPINDLE_ENABLE_DDR |= (1<<SPINDLE_ENABLE_BIT);
SPINDLE_DIRECTION_DDR |= (1<<SPINDLE_DIRECTION_BIT);
spindle_run(0, 0);
spindle_stop();
}
void spindle_stop()
{
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
}
void spindle_run(int direction, uint32_t rpm)
{
if (direction != current_direction) {
plan_synchronize();
if(direction) {
if (direction) {
if(direction > 0) {
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT);
} else {
@ -50,13 +55,8 @@ void spindle_run(int direction, uint32_t rpm)
}
SPINDLE_ENABLE_PORT |= 1<<SPINDLE_ENABLE_BIT;
} else {
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
spindle_stop();
}
current_direction = direction;
}
}
void spindle_stop()
{
spindle_run(0, 0);
}