|
@@ -77,6 +77,9 @@ static bool old_y_max_endstop=false;
|
77
|
77
|
static bool old_z_min_endstop=false;
|
78
|
78
|
static bool old_z_max_endstop=false;
|
79
|
79
|
|
|
80
|
+static bool bussy_error=false;
|
|
81
|
+unsigned char OCR1A_error=12345;
|
|
82
|
+
|
80
|
83
|
volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
|
81
|
84
|
volatile char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
|
82
|
85
|
|
|
@@ -160,6 +163,16 @@ asm volatile ( \
|
160
|
163
|
#define ENABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 |= (1<<OCIE1A)
|
161
|
164
|
#define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~(1<<OCIE1A)
|
162
|
165
|
|
|
166
|
+void checkStepperErrors()
|
|
167
|
+{
|
|
168
|
+ if(bussy_error) {
|
|
169
|
+ SERIAL_ERROR_START
|
|
170
|
+ SERIAL_ERROR(OCR1A_error);
|
|
171
|
+ SERIAL_ERRORLNPGM(" ISR overtaking itself.");
|
|
172
|
+ bussy_error = false;
|
|
173
|
+ }
|
|
174
|
+}
|
|
175
|
+
|
163
|
176
|
void checkHitEndstops()
|
164
|
177
|
{
|
165
|
178
|
if( endstop_x_hit || endstop_y_hit || endstop_z_hit) {
|
|
@@ -264,9 +277,8 @@ inline void trapezoid_generator_reset() {
|
264
|
277
|
ISR(TIMER1_COMPA_vect)
|
265
|
278
|
{
|
266
|
279
|
if(busy){
|
267
|
|
- SERIAL_ERROR_START
|
268
|
|
- SERIAL_ERROR(*(unsigned short *)OCR1A);
|
269
|
|
- SERIAL_ERRORLNPGM(" ISR overtaking itself.");
|
|
280
|
+ OCR1A_error = OCR1A;
|
|
281
|
+ bussy_error = true;
|
270
|
282
|
OCR1A = 0x30000;
|
271
|
283
|
return;
|
272
|
284
|
} // The busy-flag is used to avoid reentering this interrupt
|