From 0a46dfe0b91d58c8b40cf12252ac67516458bf00 Mon Sep 17 00:00:00 2001 From: Robert Grzesek Date: Tue, 25 Feb 2014 12:19:52 -0800 Subject: [PATCH] Minimal probing cycle working. Supports both G38.2 for error and G38.3 when no errors are desired. --- cpu_map.h | 3 +- gcode.c | 26 +++++++++++++ gcode.h | 6 ++- motion_control.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ motion_control.h | 5 +++ report.c | 51 +++++++++++++++++++++++++ report.h | 6 +++ stepper.c | 6 +++ system.c | 5 +++ system.h | 9 +++++ 10 files changed, 211 insertions(+), 3 deletions(-) diff --git a/cpu_map.h b/cpu_map.h index 9adee32..0538bbc 100644 --- a/cpu_map.h +++ b/cpu_map.h @@ -107,10 +107,11 @@ #define PIN_RESET 0 // Uno Analog Pin 0 #define PIN_FEED_HOLD 1 // Uno Analog Pin 1 #define PIN_CYCLE_START 2 // Uno Analog Pin 2 + #define PIN_PROBE 5 // Uno Analog Pin 5 #define PINOUT_INT PCIE1 // Pin change interrupt enable pin #define PINOUT_INT_vect PCINT1_vect #define PINOUT_PCMSK PCMSK1 // Pin change interrupt register - #define PINOUT_MASK ((1<\r\n")); } + +// Prints real-time data. This function grabs a real-time snapshot of the stepper subprogram + // and the actual location of the CNC machine. Users may change the following function to their + // specific needs. It is kept separate from the "normal" report_realtime_status() to allow customization. +void report_realtime_status_probe() +{ + // **Under construction** Bare-bones status report. Provides real-time machine position relative to + // the system power on location (0,0,0) and work coordinate position (G54 and G92 applied). + uint8_t i; + int32_t current_position[N_AXIS]; // Copy current state of the system position variable + memcpy(current_position,sys.position,sizeof(sys.position)); + float print_position[N_AXIS]; + + printPgmString(PSTR("line_number; + } + printInteger(ln); +#endif + + printPgmString(PSTR(">\r\n")); +} diff --git a/report.h b/report.h index 92984df..f05bc42 100644 --- a/report.h +++ b/report.h @@ -36,6 +36,7 @@ #define STATUS_ALARM_LOCK 12 #define STATUS_SOFT_LIMIT_ERROR 13 #define STATUS_OVERFLOW 14 +#define STATUS_PROBE_ERROR 15 // Define Grbl alarm codes. Less than zero to distinguish alarm error from status error. #define ALARM_LIMIT_ERROR -1 @@ -69,6 +70,11 @@ void report_grbl_settings(); // Prints realtime status report void report_realtime_status(); +// Prints realtime position status report at the end of a probe cycle +// This is in leiu of saving the probe position to internal variables like an +// EMC machine +void report_realtime_status_probe(); + // Prints Grbl persistent coordinate parameters void report_gcode_parameters(); diff --git a/stepper.c b/stepper.c index bfe1f74..370d798 100644 --- a/stepper.c +++ b/stepper.c @@ -282,6 +282,12 @@ ISR(TIMER1_COMPA_vect) { // SPINDLE_ENABLE_PORT ^= 1<