Skip to content

Commit

Permalink
merging, pausing on external input
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Hechenberger committed Feb 12, 2012
1 parent ba0a399 commit 8328827
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def build():
BITRATE = "115200"

BUILDNAME = "LasaurGrbl"
OBJECTS = ["main", "serial", "gcode", "planner", "io_control", "stepper"]
OBJECTS = ["main", "serial", "gcode", "planner", "sense_control", "stepper"]

COMPILE = AVRGCCAPP + " -Wall -Os -DF_CPU=" + CLOCK + " -mmcu=" + DEVICE + " -I. -ffunction-sections"

Expand Down
2 changes: 1 addition & 1 deletion gcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "gcode.h"
#include "config.h"
#include "serial.h"
#include "io_control.h"
#include "sense_control.h"
#include "planner.h"
#include "stepper.h"

Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "config.h"
#include "planner.h"
#include "stepper.h"
#include "io_control.h"
#include "sense_control.h"
#include "gcode.h"
#include "serial.h"

Expand Down
6 changes: 3 additions & 3 deletions sense_control.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
io_control.h - controlling sensors and actuators
sense_control.h - sensing and controlling inputs and outputs
Part of LasaurGrbl
Copyright (c) 2011 Stefan Hechenberger
Expand All @@ -19,7 +19,7 @@
#include <util/delay.h>
#include <math.h>
#include <stdlib.h>
#include "io_control.h"
#include "sense_control.h"
#include "stepper.h"
#include "planner.h"

Expand Down Expand Up @@ -57,7 +57,7 @@ void control_init() {

//// limits overwrite control
LIMITS_OVERWRITE_DDR |= 1<<LIMITS_OVERWRITE_BIT; // define as output pin
control_limits_overwrite(false);
control_limits_overwrite(true); // do not use hardware logic to stop steppers
}


Expand Down
6 changes: 3 additions & 3 deletions sense_control.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
io_control.h - controlling sensors and actuators
sense_control.h - sensing and controlling inputs and outputs
Part of LasaurGrbl
Copyright (c) 2011 Stefan Hechenberger
Expand All @@ -15,8 +15,8 @@
GNU General Public License for more details.
*/

#ifndef io_control_h
#define io_control_h
#ifndef sense_control_h
#define sense_control_h

#include <stdbool.h>

Expand Down
10 changes: 8 additions & 2 deletions stepper.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
stepper.c - stepper motor driver
stepper.c - stepper motor pulse generation
Processes block from the queue generated by the planer and pulses
steppers accordingly via a dynamically adapted timer interrupt.
Part of LasaurGrbl
Expand Down Expand Up @@ -48,7 +48,7 @@
#include "stepper.h"
#include "config.h"
#include "planner.h"
#include "io_control.h"
#include "sense_control.h"


#define CYCLES_PER_MICROSECOND (F_CPU/1000000) //16000000/1000000 = 16
Expand Down Expand Up @@ -189,6 +189,12 @@ ISR(TIMER1_COMPA_vect) {
if (busy) { return; } // The busy-flag is used to avoid reentering this interrupt
if (stop_requested) { stepper_go_idle(); stop_requested = false; }

if (SENSE_ANY) {
// no power (e-stop), no chiller, door open, limit switch situation
// pause operation
return;
}

// pulse steppers
STEPPING_PORT = (STEPPING_PORT & ~DIRECTION_MASK) | (out_bits & DIRECTION_MASK);
STEPPING_PORT = (STEPPING_PORT & ~STEPPING_MASK) | out_bits;
Expand Down
2 changes: 1 addition & 1 deletion stepper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
stepper.c - stepper motor driver
stepper.c - stepper motor pulse generation
Processes block from the queue generated by the planer and pulses
steppers accordingly via a dynamically adapted timer interrupt.
Part of LasaurGrbl
Expand Down

0 comments on commit 8328827

Please sign in to comment.