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) #define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds)
// FOR ADVANCED USERS ONLY: Toggles XON/XOFF software flow control for serial communications. // 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 // Officially not supported due to problems involving the Atmega8U2 USB-to-serial chips on all
// future Arduinos boards. The firmware on these chips do not support XON/XOFF flow control // 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 // 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 // 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 // problem has been confirmed to work, as well as, using older FTDI FT232RL-based Arduinos
@ -141,4 +141,12 @@
#define DECIMAL_MULTIPLIER 100 #define DECIMAL_MULTIPLIER 100
#endif #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 #endif

View File

@ -569,7 +569,7 @@ static int next_statement(char *letter, double *double_ptr, char *line, uint8_t
- Evaluation of expressions - Evaluation of expressions
- Variables - Variables
- Multiple home locations - 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 - Probing
- Override control - Override control
- Tool changes - Tool changes

View File

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