diff --git a/grbl/config.h b/grbl_lcd/config.h similarity index 99% rename from grbl/config.h rename to grbl_lcd/config.h index bffc41fbc..21aa15451 100644 --- a/grbl/config.h +++ b/grbl_lcd/config.h @@ -212,7 +212,7 @@ // Inverts the spindle enable pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful // for some pre-built electronic boards. -// #define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable. +#define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable. // Inverts the selected coolant pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful // for some pre-built electronic boards. diff --git a/grbl/coolant_control.c b/grbl_lcd/coolant_control.c similarity index 100% rename from grbl/coolant_control.c rename to grbl_lcd/coolant_control.c diff --git a/grbl/coolant_control.h b/grbl_lcd/coolant_control.h similarity index 100% rename from grbl/coolant_control.h rename to grbl_lcd/coolant_control.h diff --git a/grbl/print.c b/grbl_lcd/cprint.c similarity index 100% rename from grbl/print.c rename to grbl_lcd/cprint.c diff --git a/grbl/print.h b/grbl_lcd/cprint.h similarity index 97% rename from grbl/print.h rename to grbl_lcd/cprint.h index 31e0a576c..35ab99fe8 100644 --- a/grbl/print.h +++ b/grbl_lcd/cprint.h @@ -19,8 +19,8 @@ along with Grbl. If not, see . */ -#ifndef print_h -#define print_h +#ifndef cprint_h +#define cprint_h void printString(const char *s); diff --git a/grbl/cpu_map.h b/grbl_lcd/cpu_map.h similarity index 84% rename from grbl/cpu_map.h rename to grbl_lcd/cpu_map.h index 6cef4d9c3..d5b6ab79f 100644 --- a/grbl/cpu_map.h +++ b/grbl_lcd/cpu_map.h @@ -90,14 +90,18 @@ #define CONTROL_DDR DDRK #define CONTROL_PIN PINK #define CONTROL_PORT PORTK - #define CONTROL_RESET_BIT 0 // MEGA2560 Analog Pin 8 - #define CONTROL_FEED_HOLD_BIT 1 // MEGA2560 Analog Pin 9 - #define CONTROL_CYCLE_START_BIT 2 // MEGA2560 Analog Pin 10 - #define CONTROL_SAFETY_DOOR_BIT 3 // MEGA2560 Analog Pin 11 + #define CONTROL_RESET_BIT 0 // MEGA2560 Analog Pin 8 + #define CONTROL_FEED_HOLD_BIT 1 // MEGA2560 Analog Pin 9 + #define CONTROL_CYCLE_START_BIT 2 // MEGA2560 Analog Pin 10 + #define CONTROL_SAFETY_DOOR_BIT 3 // MEGA2560 Analog Pin 11 + #define CONTROL_HOME_BIT 4 // MEGA2560 Analog Pin 12 + #define CONTROL_FEED_BIT 5 // MEGA2560 Analog Pin 13 + #define CONTROL_SET_SPINDLE_BIT 6 // MEGA2560 Analog Pin 14 #define CONTROL_INT PCIE2 // Pin change interrupt enable pin #define CONTROL_INT_vect PCINT2_vect #define CONTROL_PCMSK PCMSK2 // Pin change interrupt register - #define CONTROL_MASK ((1< #include // Do not alter this file! diff --git a/grbl/examples/grblUpload/license.txt b/grbl_lcd/examples/grblUpload/license.txt similarity index 100% rename from grbl/examples/grblUpload/license.txt rename to grbl_lcd/examples/grblUpload/license.txt diff --git a/grbl/gcode.c b/grbl_lcd/gcode.c similarity index 100% rename from grbl/gcode.c rename to grbl_lcd/gcode.c diff --git a/grbl/gcode.h b/grbl_lcd/gcode.h similarity index 100% rename from grbl/gcode.h rename to grbl_lcd/gcode.h diff --git a/grbl/grbl.h b/grbl_lcd/grbl.h similarity index 98% rename from grbl/grbl.h rename to grbl_lcd/grbl.h index fc8b8884a..9a49db8d2 100644 --- a/grbl/grbl.h +++ b/grbl_lcd/grbl.h @@ -21,6 +21,7 @@ #ifndef grbl_h #define grbl_h + // Grbl versioning system #define GRBL_VERSION "1.1f" #define GRBL_VERSION_BUILD "20170802" @@ -37,6 +38,7 @@ #include #include #include +#include // Define the Grbl system include files. NOTE: Do not alter organization. #include "config.h" @@ -52,7 +54,7 @@ #include "limits.h" #include "motion_control.h" #include "planner.h" -#include "print.h" +#include "cprint.h" #include "probe.h" #include "protocol.h" #include "report.h" @@ -61,6 +63,7 @@ #include "stepper.h" #include "jog.h" #include "sleep.h" +#include "lcd.h" // --------------------------------------------------------------------------------------- // COMPILE-TIME ERROR CHECKING OF DEFINE VALUES: diff --git a/grbl/jog.c b/grbl_lcd/jog.c similarity index 100% rename from grbl/jog.c rename to grbl_lcd/jog.c diff --git a/grbl/jog.h b/grbl_lcd/jog.h similarity index 100% rename from grbl/jog.h rename to grbl_lcd/jog.h diff --git a/grbl_lcd/lcd.cpp b/grbl_lcd/lcd.cpp new file mode 100644 index 000000000..0c2bd3299 --- /dev/null +++ b/grbl_lcd/lcd.cpp @@ -0,0 +1,359 @@ + +#include +#include "lcd.h" +#include +//#include + +//#ifdef __cplusplus +//extern "C" { +//#endif + + + +// initialize the library by associating any needed LCD interface pin +// with the arduino pin number it is connected to +//const int rs = 22, en = 24, d4 = 26, d5 = 28, d6 = 30, d7 = 32; +//LiquidCrystal lcd(rs, en, d4, d5, d6, d7); + +//const int rs = 52, rw = 50, en = 48, d4 = 46, d5 = 44, d6 = 42, d7 = 40; +//LiquidCrystal lcd(rs, rw, en, d4, d5, d6, d7); + +//const int rs = 52, en = 53, d4 = 50, d5 = 51, d6 = 48, d7 = 49; +//const int rs = A0, en = A1, d4 = A2, d5 = A3, d6 = A4, d7 = A5; +const int rs = 54, en = 55, d4 = 56, d5 = 57, d6 = 58, d7 = 59; +LiquidCrystal lcd(rs, en, d4, d5, d6, d7); + + +//extern "C"{ +void setup_lcd() { + lcd.begin(20, 4); + + lcd.setCursor(0, 1); + lcd.print(000.00); + lcd.setCursor(7, 1); + lcd.print(000.00); + lcd.setCursor(14, 1); + lcd.print(000.00); + + + lcd.setCursor(0, 3); + lcd.print("STEP:"); + lcd.setCursor(14, 3); + lcd.print("SF:"); + lcd.setCursor(0, 0); + lcd.print("******"); + lcd.setCursor(7, 0); + lcd.print("F:"); + lcd.setCursor(13, 0); + lcd.print("S:"); +} + + void SetUpLCD() +{ + setup_lcd(); +} + + void SetCursorLCD(uint8_t i, uint8_t r) +{ + lcd.setCursor(i, r); +} + + +void PrintMillsLCD(int of, uint8_t cn) +{ + char str[20]; + + sprintf(str,"%-7d", cn); + lcd.setCursor(10+of, 3); + lcd.print(str); + //lcd.print(" "); + //lcd.setCursor(12+of, 3); + //lcd.print(cn); +} + +void PrintXyzPinsLCD(int of, float f) +{ + lcd.setCursor(10+of, 3); + //lcd.print(" "); + //lcd.setCursor(12+of, 3); + lcd.print(f); +} + + +void PrintComandLCD(char* st) +{ + char str[20]; + + sprintf(str,"%-6s", st); + lcd.setCursor(0, 3); + lcd.print(str); + //lcd.print(" "); + //lcd.setCursor(0, 3); + //lcd.print(st); +} + +void PrintComandCountLCD(int cnt) +{ + char str[7]; + + sprintf(str,"%-6d", cnt); + lcd.setCursor(9, 3); + lcd.print(str); +} + +void PrintComandWcoLCD(float x, float y, float z) +{ + lcd.setCursor(0, 3); + lcd.print(x); + lcd.setCursor(3, 3); + lcd.print(" "); + lcd.setCursor(4, 3); + lcd.print(y); + lcd.setCursor(7, 3); + lcd.print(" "); + lcd.setCursor(8, 3); + lcd.print(z); +} + +void PrintFStepLCD(int idx){ + lcd.setCursor(9, 3); + lcd.print("STP:"); + lcd.setCursor(10, 3); + lcd.print(idx); +} + +void PrintStepLCD(int idx) +{ + lcd.setCursor(0, 3); + lcd.print("STP:"); + lcd.setCursor(4, 3); + switch (idx){ + case 0: + lcd.print("0.01"); + break; + case 1: + lcd.print("0.10"); + break; + case 2: + lcd.print("1.00"); + break; + } + lcd.setCursor(8, 3); + lcd.print(" "); +} + + void PrintLCD(double pos) +{ + lcd.print(pos); +} + + void PrintFeedLCD(float f) +{ + char str[20]; + + sprintf(str,"F:%-3i", (int)f); + + //sprintf(str,"F:%f", f); + lcd.setCursor(7, 0); + + lcd.print(str); + //lcd.setCursor(9, 0); + //lcd.print(f); + lcd.setCursor(13, 0); + lcd.print(" S:"); +} + + + void PrintPwmLCD(uint16_t f) +{ + char str[20]; + + sprintf(str,"%-.4d", f); + lcd.setCursor(16, 0); + lcd.print(str); + + + //lcd.print(" "); + //lcd.setCursor(16, 0); + //lcd.print(f); +} + + void PrintSpindleLCD(float f) +{ + char str[420]; + + sprintf(str,"%-4i", (int)f); + lcd.setCursor(16, 0); + lcd.print(str); + //lcd.print(" "); + //lcd.setCursor(16, 0); + //lcd.print(f); +} + + void PrintStatusLCD(char* st) +{ + lcd.setCursor(0, 0); + lcd.print(st); +} + + void PrintPosLCD(float x, float y, float z) +{ + lcd.setCursor(0, 1); + lcd.print(x); + lcd.setCursor(7, 1); + lcd.print(y); + lcd.setCursor(14, 1); + lcd.print(z); + lcd.setCursor(19, 1); + lcd.print("W"); +} + + void PrintPosLCDX(float x) +{ + lcd.setCursor(0, 1); + lcd.print(x); +} + + void PrintPosLCDY(float y) +{ + lcd.setCursor(7, 1); + lcd.print(y); +} + +void PrintPosLCDXX(float x) +{ + lcd.setCursor(0, 3); + lcd.print(" "); + lcd.setCursor(0, 3); + lcd.print(x); +} + + void PrintPosLCDYY(float y) +{ + lcd.setCursor(7, 3); + lcd.print(" "); + lcd.setCursor(7, 3); + lcd.print(y); +} + + void PrintPosLCDZ(float z) +{ + lcd.setCursor(14, 1); + lcd.print(z); +} + + void PrintWcoLCD(float x, float y, float z) +{ + lcd.setCursor(0, 2); + lcd.print(x); + lcd.setCursor(7, 2); + lcd.print(y); + lcd.setCursor(14, 2); + lcd.print(z); + lcd.setCursor(19, 2); + lcd.print("M"); +} + +void PrintSfeedLCD(int f) +{ + char str[20]; + + sprintf(str,"%-.3d", f); + lcd.setCursor(17, 3); + lcd.print(str); + + + //lcd.print(" "); + //lcd.setCursor(16, 0); + //lcd.print(f); +} + + +//} +/* +extern "C" void SetUpLCD() +{ + setup_lcd(); +} + +extern "C" void SetCursorLCD(uint8_t i, uint8_t r) +{ + lcd.setCursor(i, r); +} + +extern "C" void PrintLCD(double pos) +{ + lcd.print(pos); +} + +extern "C" void PrintFeedLCD(float f) +{ + lcd.setCursor(9, 0); + lcd.print(f); + lcd.setCursor(13, 0); + lcd.print(" S:"); +} + + +extern "C" void PrintPwmLCD(uint16_t f) +{ + lcd.setCursor(16, 0); + lcd.print(" "); + lcd.print(f); +} + +extern "C" void PrintSpindleLCD(float f) +{ + lcd.setCursor(16, 0); + lcd.print(" "); + lcd.print(f); +} + +extern "C" void PrintStatusLCD(char* st) +{ + lcd.setCursor(0, 0); + lcd.print(st); +} + +extern "C" void PrintPosLCD(float x, float y, float z) +{ + lcd.setCursor(0, 1); + lcd.print(x); + lcd.setCursor(7, 1); + lcd.print(y); + lcd.setCursor(14, 1); + lcd.print(z); +} + +extern "C" void PrintPosLCDX(float x) +{ + lcd.setCursor(0, 1); + lcd.print(x); +} + +extern "C" void PrintPosLCDY(float y) +{ + lcd.setCursor(7, 1); + lcd.print(y); +} + +extern "C" void PrintPosLCDZ(float z) +{ + lcd.setCursor(14, 1); + lcd.print(z); +} + +extern "C" void PrintWcoLCD(float x, float y, float z) +{ + lcd.setCursor(0, 2); + lcd.print(x); + lcd.setCursor(7, 2); + lcd.print(y); + lcd.setCursor(14, 2); + lcd.print(z); +} +*/ + +//#ifdef __cplusplus +//} +//#endif diff --git a/grbl_lcd/lcd.h b/grbl_lcd/lcd.h new file mode 100644 index 000000000..cbc64fcc3 --- /dev/null +++ b/grbl_lcd/lcd.h @@ -0,0 +1,75 @@ +#ifndef lcd_h +#define lcd_h + +#ifdef __cplusplus + extern "C" { +#endif + +void setup_lcd(); + +//extern "C" void SetUpLCD() +//{ + //void setup_lcd(); +//} + + +/* +extern "C" { +void SetUpLCD(); +void SetCursorLCD(uint8_t i, uint8_t r); +void PrintLCD(double pos); +void PrintFeedLCD(float f); +void PrintPwmLCD(uint16_t f); +void PrintSpindleLCD(float f); +void PrintStatusLCD(char* st); +void PrintPosLCD(float x, float y, float z); +void PrintPosLCDX(float x); +void PrintPosLCDY(float y); +void PrintPosLCDZ(float z); +void PrintWcoLCD(float x, float y, float z); +} +*/ + +/* +extern "C" void SetUpLCD(); +extern "C" void SetCursorLCD(uint8_t i, uint8_t r); +extern "C" void PrintLCD(double pos); +extern "C" void PrintFeedLCD(float f); +extern "C" void PrintPwmLCD(uint16_t f); +extern "C" void PrintSpindleLCD(float f); +extern "C" void PrintStatusLCD(char* st); +extern "C" void PrintPosLCD(float x, float y, float z); +extern "C" void PrintPosLCDX(float x); +extern "C" void PrintPosLCDY(float y); +extern "C" void PrintPosLCDZ(float z); +extern "C" void PrintWcoLCD(float x, float y, float z); +*/ + +void SetUpLCD(); +void SetCursorLCD(uint8_t i, uint8_t r); +void PrintLCD(double pos); +void PrintFeedLCD(float f); +void PrintPwmLCD(uint16_t f); +void PrintSpindleLCD(float f); +void PrintStatusLCD(char* st); +void PrintPosLCD(float x, float y, float z); +void PrintPosLCDX(float x); +void PrintPosLCDY(float y); +void PrintPosLCDZ(float z); +void PrintWcoLCD(float x, float y, float z); +void PrintComandLCD(char* st); +void PrintComandCountLCD(int cnt); +void PrintComandWcoLCD(float x, float y, float z); +void PrintMillsLCD(int of, uint8_t cn); +void PrintXyzPinsLCD(int of, float f); +void PrintSfeedLCD(int f); +void PrintStepLCD(int idx); +void PrintFStepLCD(int idx); +void PrintPosLCDXX(float x); +void PrintPosLCDYY(float y); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/grbl/limits.c b/grbl_lcd/limits.c similarity index 100% rename from grbl/limits.c rename to grbl_lcd/limits.c diff --git a/grbl/limits.h b/grbl_lcd/limits.h similarity index 100% rename from grbl/limits.h rename to grbl_lcd/limits.h diff --git a/grbl/main.c b/grbl_lcd/main.c similarity index 69% rename from grbl/main.c rename to grbl_lcd/main.c index 2b5438720..bc7af2987 100644 --- a/grbl/main.c +++ b/grbl_lcd/main.c @@ -31,6 +31,18 @@ volatile uint8_t sys_rt_exec_state; // Global realtime executor bitflag variab volatile uint8_t sys_rt_exec_alarm; // Global realtime executor bitflag variable for setting various alarms. volatile uint8_t sys_rt_exec_motion_override; // Global realtime executor bitflag variable for motion-based overrides. volatile uint8_t sys_rt_exec_accessory_override; // Global realtime executor bitflag variable for spindle/coolant overrides. +volatile uint8_t sys_rt_exec_axis; // added Global realtime executor bitflag variable for axis movement. +volatile uint8_t sys_rt_exec_position; // added Global realtime executor bitflag variable for homing and zeroing. + +volatile uint8_t main_count; +volatile uint8_t protocol_count; +volatile uint8_t step_per_click; + +volatile uint8_t nX; +volatile uint8_t nY; +volatile uint8_t bX; +volatile uint8_t bY; + #ifdef DEBUG volatile uint8_t sys_rt_exec_debug; #endif @@ -39,6 +51,36 @@ volatile uint8_t sys_rt_exec_accessory_override; // Global realtime executor bit int main(void) { // Initialize system upon power-up. + + //added + pinMode(xUpPin, INPUT_PULLUP); + pinMode(xDownPin, INPUT_PULLUP); + pinMode(yUpPin, INPUT_PULLUP); + pinMode(yDownPin, INPUT_PULLUP); + pinMode(zUpPin, INPUT_PULLUP); + pinMode(zDownPin, INPUT_PULLUP); + pinMode(xySetPin, INPUT_PULLUP); + pinMode(zSetPin, INPUT_PULLUP); + pinMode(StepSetPin, INPUT_PULLUP); + pinMode(zHometPin, INPUT_PULLUP); + pinMode(xyHomePin, INPUT_PULLUP); + pinMode(goXyPin, INPUT_PULLUP); + + pinMode(lcd_rs, OUTPUT); + pinMode(lcd_en, OUTPUT); + pinMode(lcd_d4, OUTPUT); + pinMode(lcd_d5, OUTPUT); + pinMode(lcd_d6, OUTPUT); + pinMode(lcd_d7, OUTPUT); + + pinMode(encoderXaPin, INPUT_PULLUP); + pinMode(encoderXbPin, INPUT_PULLUP); + pinMode(encoderYaPin, INPUT_PULLUP); + pinMode(encoderYbPin, INPUT_PULLUP); + pinMode(encoderSetX0, INPUT_PULLUP); + pinMode(encoderSetY0, INPUT_PULLUP); + + //end added serial_init(); // Setup serial baud rate and interrupts settings_init(); // Load Grbl settings from EEPROM stepper_init(); // Configure stepper pins and interrupt timers @@ -66,10 +108,22 @@ int main(void) if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; } #endif + SetUpLCD(); + + PrintPosLCD(000.00, 000.00, 000.00); + PrintWcoLCD(000.00, 000.00, 000.00); + + main_count = 0; + protocol_count = 0; + // Grbl initialization loop upon power-up or a system abort. For the latter, all processes // will return to this loop to be cleanly re-initialized. for(;;) { + main_count++; + //PrintMillsLCD(0, main_count); + + //memset(sys_position,0,sizeof(sys_position)); // Clear machine position. // Reset system variables. uint8_t prior_state = sys.state; memset(&sys, 0, sizeof(system_t)); // Clear system struct variable. @@ -83,6 +137,28 @@ int main(void) sys_rt_exec_alarm = 0; sys_rt_exec_motion_override = 0; sys_rt_exec_accessory_override = 0; + step_per_click = 0; + + sys_rt_exec_axis = 0; // added + sys_rt_exec_position = 0; // added + + sys.sfeed_rate = 250; + sys.cmd_count = 0; + sys.cmd_count_enable = 0; + //sys.step_per_click = 0.01; + + sys.encoderXPinALast = LOW; + sys.nX = LOW; + sys.encoderYPinALast = LOW; + sys.nY = LOW; + + sys.bX = 0; + sys.bY = 0; + sys.step_click = 0.001; + sys.encoderXFPos = 0.0; + sys.encoderYFPos = 0.0; + + // Reset Grbl primary systems. serial_reset_read_buffer(); // Clear serial read buffer diff --git a/grbl/motion_control.c b/grbl_lcd/motion_control.c similarity index 100% rename from grbl/motion_control.c rename to grbl_lcd/motion_control.c diff --git a/grbl/motion_control.h b/grbl_lcd/motion_control.h similarity index 100% rename from grbl/motion_control.h rename to grbl_lcd/motion_control.h diff --git a/grbl/nuts_bolts.c b/grbl_lcd/nuts_bolts.c similarity index 100% rename from grbl/nuts_bolts.c rename to grbl_lcd/nuts_bolts.c diff --git a/grbl/nuts_bolts.h b/grbl_lcd/nuts_bolts.h similarity index 100% rename from grbl/nuts_bolts.h rename to grbl_lcd/nuts_bolts.h diff --git a/grbl/planner.c b/grbl_lcd/planner.c similarity index 100% rename from grbl/planner.c rename to grbl_lcd/planner.c diff --git a/grbl/planner.h b/grbl_lcd/planner.h similarity index 100% rename from grbl/planner.h rename to grbl_lcd/planner.h diff --git a/grbl/probe.c b/grbl_lcd/probe.c similarity index 100% rename from grbl/probe.c rename to grbl_lcd/probe.c diff --git a/grbl/probe.h b/grbl_lcd/probe.h similarity index 100% rename from grbl/probe.h rename to grbl_lcd/probe.h diff --git a/grbl/protocol.c b/grbl_lcd/protocol.c similarity index 74% rename from grbl/protocol.c rename to grbl_lcd/protocol.c index b21485147..16de731ff 100644 --- a/grbl/protocol.c +++ b/grbl_lcd/protocol.c @@ -52,6 +52,8 @@ void protocol_main_loop() if (sys.state & (STATE_ALARM | STATE_SLEEP)) { report_feedback_message(MESSAGE_ALARM_LOCK); sys.state = STATE_ALARM; // Ensure alarm state is set. + //PrintComandLCD("ALARM "); //added + PrintStatusLCD("ALARM "); //added } else { // Check if the safety door is open. sys.state = STATE_IDLE; @@ -71,8 +73,29 @@ void protocol_main_loop() uint8_t line_flags = 0; uint8_t char_counter = 0; uint8_t c; + + //added + float pin_x = 0.0; + float pin_y = 0.0; + float pin_z = 0.0; + int pin_pressed = 0; + char* axis_move_buttons = "G91G1X+0.01Y+0.01Z+0.01F250"; + char* axis_goto_buttons = "G90G1X+0.01Y+0.01F250"; + char axis_goto_str [30]; + char* axis_goto_buttons0 = "G90G1X"; + char* axis_goto_buttons1 = "Y"; + char* axis_goto_buttons2 = "F"; + + char floatX[8]; + char floatY[8]; + char intFeed[4]; + + //end added for (;;) { + uint8_t rt_exec_m = 0; // Temp variable to avoid calling volatile multiple times. + //protocol_count++; + //PrintMillsLCD(4, protocol_count); // Process one line of incoming serial data, as the data becomes available. Performs an // initial filtering by removing spaces and comments and capitalizing all letters. while((c = serial_read()) != SERIAL_NO_DATA) { @@ -101,12 +124,17 @@ void protocol_main_loop() report_status_message(STATUS_SYSTEM_GC_LOCK); } else { // Parse and execute g-code block. + //PrintComandLCD(line); report_status_message(gc_execute_line(line)); } // Reset tracking data for next line. line_flags = 0; char_counter = 0; + + // added , seems in case of fast serial data no LCD status reported, will try to put it here + report_lcd_status(); + // end added } else { @@ -150,13 +178,275 @@ void protocol_main_loop() } } - + //added + if(c == SERIAL_NO_DATA){ + if(sys.cmd_count_enable){ + sys.cmd_count++; + if(sys.cmd_count >= CMD_COUNT_MAX){ + sys.cmd_count = 0; + sys.cmd_count_enable = 0; + } + } + + protocol_read_xencoder(); + protocol_read_yencoder(); + if(!sys.cmd_count){ + //PrintComandLCD(" "); + rt_exec_m = sys_rt_exec_position; // Copy volatile sys_rt_exec_alarm. + if (rt_exec_m) { + if (sys.state != STATE_HOLD){ + if (rt_exec_m & EXEC_SET_HOME){ + //PrintComandLCD("HOME"); + report_status_message(gc_execute_line("G90G0Z5")); + report_status_message(gc_execute_line("G0X0Y0")); + report_status_message(gc_execute_line("G90G1Z0F25")); + + system_clear_exec_position_flag(EXEC_SET_HOME); + } + if (rt_exec_m & EXEC_SET_FEED){ + //PrintComandLCD("SFEED"); + if(sys.sfeed_rate == 250) sys.sfeed_rate = 50; else sys.sfeed_rate += 50; + + system_clear_exec_position_flag(EXEC_SET_FEED); + } + if (rt_exec_m & EXEC_SET_SPINDLE){ + if(spindle_get_state()){ + //PrintComandLCD("SPON "); + report_status_message(gc_execute_line( "M5S0")); + }else { + //PrintComandLCD("SPOFF "); + report_status_message(gc_execute_line( "M3S30000")); + } + system_clear_exec_position_flag(EXEC_SET_SPINDLE); + } + } + } + + //if(!sys.cmd_count){ + //protocol_read_axispins(); + pin_x = 0.0; + pin_y = 0.0; + pin_z = 0.0; + pin_pressed = 0; + pin_pressed = protocol_read_axisxyz(&pin_x, &pin_y, &pin_z); + if(pin_pressed){ + //axis_move_buttons "G91G1X+0.01Y+0.01Z+0.01F250"; + if(pin_x < 0) axis_move_buttons[6] = '-'; else axis_move_buttons[6] = '+'; + if(pin_y < 0) axis_move_buttons[12] = '-'; else axis_move_buttons[12] = '+'; + if(pin_z < 0) axis_move_buttons[18] = '-'; else axis_move_buttons[18] = '+'; + if(!pin_x){ + axis_move_buttons[7] = '0'; + axis_move_buttons[9] = '0'; + axis_move_buttons[10] = '0'; + }else{ + switch(step_per_click){ + case 0: + axis_move_buttons[7] = '0'; + axis_move_buttons[9] = '0'; + axis_move_buttons[10] = '1'; + break; + case 1: + axis_move_buttons[7] = '0'; + axis_move_buttons[9] = '1'; + axis_move_buttons[10] = '0'; + break; + case 2: + axis_move_buttons[7] = '1'; + axis_move_buttons[9] = '0'; + axis_move_buttons[10] = '0'; + break; + } + + //axis_move_buttons[10] = '1'; + } + if(!pin_y){ + axis_move_buttons[13] = '0'; + axis_move_buttons[15] = '0'; + axis_move_buttons[16] = '0'; + }else{ + switch(step_per_click){ + case 0: + axis_move_buttons[13] = '0'; + axis_move_buttons[15] = '0'; + axis_move_buttons[16] = '1'; + break; + case 1: + axis_move_buttons[13] = '0'; + axis_move_buttons[15] = '1'; + axis_move_buttons[16] = '0'; + break; + case 2: + axis_move_buttons[13] = '1'; + axis_move_buttons[15] = '0'; + axis_move_buttons[16] = '0'; + break; + } + //axis_move_buttons[16] = '1'; + } + if(!pin_z){ + axis_move_buttons[19] = '0'; + axis_move_buttons[21] = '0'; + axis_move_buttons[22] = '0'; + }else{ + switch(step_per_click){ + case 0: + axis_move_buttons[19] = '0'; + axis_move_buttons[21] = '0'; + axis_move_buttons[22] = '1'; + break; + case 1: + axis_move_buttons[19] = '0'; + axis_move_buttons[21] = '1'; + axis_move_buttons[22] = '0'; + break; + case 2: + axis_move_buttons[19] = '1'; + axis_move_buttons[21] = '0'; + axis_move_buttons[22] = '0'; + break; + } + //axis_move_buttons[22] = '1'; + } + axis_move_buttons[24] = '0'; + switch (sys.sfeed_rate){ + case 50: + axis_move_buttons[24] = '0'; + axis_move_buttons[25] = '5'; + axis_move_buttons[26] = '0'; + break; + case 100: + axis_move_buttons[24] = '1'; + axis_move_buttons[25] = '0'; + axis_move_buttons[26] = '0'; + break; + case 150: + axis_move_buttons[24] = '1'; + axis_move_buttons[25] = '5'; + axis_move_buttons[26] = '0'; + break; + case 200: + axis_move_buttons[24] = '2'; + axis_move_buttons[25] = '0'; + axis_move_buttons[26] = '0'; + break; + case 250: + axis_move_buttons[24] = '2'; + axis_move_buttons[25] = '5'; + axis_move_buttons[26] = '0'; + break; + } + + //PrintComandLCD(&axis_move_buttons[6]); + report_status_message(gc_execute_line(axis_move_buttons)); + sys.cmd_count += CMD_COUNT_MIN; + }else{ + pin_pressed = protocol_read_axissetxy(); + if(pin_pressed){ + report_status_message(gc_execute_line("G92X0Y0")); + }else{ + pin_pressed = protocol_read_axissetz(); + if(pin_pressed){ + report_status_message(gc_execute_line("G92Z0")); + }else{ + pin_pressed = protocol_read_setstep(); + if(pin_pressed){ + if(step_per_click >= 2){ + step_per_click = 0; + }else{ + step_per_click += 1; + } + PrintStepLCD(step_per_click); + switch(step_per_click){ + case 0: + sys.step_click = 0.01; + break; + case 1: + sys.step_click = 0.1; + break; + case 2: + sys.step_click = 1.0; + break; + } + //PrintFStepLCD(step_per_click); + }else{ + pin_pressed = protocol_read_xyzhome(); + if(pin_pressed){ + switch (pin_pressed){ + case 1: + report_status_message(gc_execute_line("G90G1Z0F25")); + //PrintComandLCD("ZHOME"); + break; + case 2: + report_status_message(gc_execute_line("G90G0Z5")); + report_status_message(gc_execute_line("G90G0X0Y0")); + //PrintComandLCD("XYHOME"); + break; + case 3: + report_status_message(gc_execute_line("G90G0Z5")); + report_status_message(gc_execute_line("G0X0Y0")); + report_status_message(gc_execute_line("G90G1Z0F25")); + //PrintComandLCD("XYZHOM"); + break; + } + }else{ + pin_pressed = protocol_read_goxy(); + if(pin_pressed){ + //PrintComandLCD("GOXY"); + axis_goto_str[0] = '\0'; + //floatX; + //floatY; + //intFeed; + //char* axis_goto_buttons0 = "G90G1X"; + //char* axis_goto_buttons1 = "Y"; + //char* axis_goto_buttons2 = "F"; + //axis_goto_str + + //sprintf(floatX, "%i", sys.encoderXFPos); + dtostrf(sys.encoderXFPos, 3, 2, floatX); + dtostrf(sys.encoderYFPos, 3, 2, floatY); + strcat(axis_goto_str, axis_goto_buttons0); + strcat(axis_goto_str, floatX); + strcat(axis_goto_str, axis_goto_buttons1); + strcat(axis_goto_str, floatY); + strcat(axis_goto_str, axis_goto_buttons2); + sprintf(intFeed, "%-.4d", sys.sfeed_rate); + strcat(axis_goto_str, intFeed); + //PrintComandLCD(floatX); + //PrintComandLCD(axis_goto_str); + report_status_message(gc_execute_line(axis_goto_str)); + //"G90G1X+0.01Y+0.01F250"; + }else{ + pin_pressed = protocol_read_xencoder0(); + if(pin_pressed){ + sys.encoderXFPos = 0.0; + PrintPosLCDXX(sys.encoderXFPos); + }else{ + pin_pressed = protocol_read_yencoder0(); + if(pin_pressed){ + sys.encoderYFPos = 0.0; + PrintPosLCDYY(sys.encoderYFPos); + } + } + } + } + } + } + } + } + sys.cmd_count_enable = 1; + } + } + //end added + // If there are no more characters in the serial read buffer to be processed and executed, // this indicates that g-code streaming has either filled the planner buffer or has // completed. In either case, auto-cycle start, if enabled, any queued moves. protocol_auto_cycle_start(); - + protocol_execute_realtime(); // Runtime command check point. + + //Print status to LCD + report_lcd_status(); if (sys.abort) { return; } // Bail to main() program loop to reset system. #ifdef SLEEP_ENABLE @@ -219,6 +509,8 @@ void protocol_execute_realtime() // NOTE: Do not alter this unless you know exactly what you are doing! void protocol_exec_rt_system() { + uint8_t rt_exec_m = 0; // added + uint8_t rt_exec; // Temp variable to avoid calling volatile multiple times. rt_exec = sys_rt_exec_alarm; // Copy volatile sys_rt_exec_alarm. if (rt_exec) { // Enter only if any bit flag is true @@ -247,6 +539,8 @@ void protocol_exec_rt_system() // Execute system abort. if (rt_exec & EXEC_RESET) { + //PrintComandLCD("RESET "); + PrintStatusLCD("RESET"); sys.abort = true; // Only place this is set true. return; // Nothing else to do but exit. } @@ -482,7 +776,38 @@ void protocol_exec_rt_system() } } } - + + + //added + /* + rt_exec_m = sys_rt_exec_position; // Copy volatile sys_rt_exec_alarm. + if (rt_exec_m) { + if (sys.state != STATE_HOLD){ + if (rt_exec_m & EXEC_GO_HOME){ + //PrintComandLCD("HOME"); + report_status_message(gc_execute_line( "G90G0X0Y0Z0")); + system_clear_exec_position_flag(EXEC_GO_HOME); + } + if (rt_exec_m & EXEC_SET_ZERO){ + //PrintComandLCD("SFEED"); + if(sys.sfeed_rate == 250) sys.sfeed_rate = 50; else sys.sfeed_rate += 50; + system_clear_exec_position_flag(EXEC_SET_ZERO); + } + if (rt_exec_m & EXEC_SET_SPINDLE){ + if(spindle_get_state()){ + //PrintComandLCD("SPON "); + report_status_message(gc_execute_line( "M5S0")); + }else { + //PrintComandLCD("SPOFF "); + report_status_message(gc_execute_line( "M3S30000")); + } + system_clear_exec_position_flag(EXEC_SET_SPINDLE); + } + } + } + */ + //end added + #ifdef DEBUG if (sys_rt_exec_debug) { report_realtime_debug(); @@ -497,6 +822,212 @@ void protocol_exec_rt_system() } +//added +/* + #define xUpPin 53 // + #define xDownPin 51 // + #define yUpPin 49 // + #define yDownPin 47 // + #define zUpPin 45 // + #define zDownPin 43 // + #define xySetPin 41 // + #define zSetPin 39 // +*/ +void protocol_read_axispins() +{ + uint8_t pinValue = 0; + int val = 0; + + val = digitalRead(xUpPin); + pinValue += val; + + val = digitalRead(xDownPin); + pinValue += ((val & 0x1)<<1); + + val = digitalRead(yUpPin); + pinValue += ((val & 0x1)<<2); + + val = digitalRead(yDownPin); + pinValue += ((val & 0x1)<<3); + + val = digitalRead(zUpPin); + pinValue += ((val & 0x1)<<4); + + val = digitalRead(zDownPin); + pinValue += ((val & 0x1)<<5); + + val = digitalRead(xySetPin); + pinValue += ((val & 0x1)<<6); + + val = digitalRead(zSetPin); + pinValue += ((val & 0x1)<<7); + + //PrintMillsLCD(0, pinValue); +} + +int protocol_read_axisxyz(float* x, float* y, float* z) +{ + uint8_t pinValue = 0; + int val = 0; + + val = digitalRead(xUpPin); + if(!val){ + pinValue++; + *x = 1; + } + + val = digitalRead(xDownPin); + if(!val){ + pinValue++; + *x = -1; + } + + val = digitalRead(yUpPin); + if(!val){ + pinValue++; + *y = 1; + } + + val = digitalRead(yDownPin); + if(!val){ + pinValue++; + *y = -1; + } + + val = digitalRead(zUpPin); + if(!val){ + pinValue++; + *z = 1; + } + + val = digitalRead(zDownPin); + if(!val){ + pinValue++; + *z = -1; + } + + return pinValue; +} + +int protocol_read_axissetxy() +{ + int pinValue = 0; + int val = 0; + + val = digitalRead(xySetPin); + if(!val) pinValue = 1; + + return pinValue; +} + +int protocol_read_axissetz() +{ + int pinValue = 0; + int val = 0; + + val = digitalRead(zSetPin); + if(!val) pinValue = 1; + + return pinValue; +} + +int protocol_read_goxy() +{ + int pinValue = 0; + int val = 0; + + val = digitalRead(goXyPin); + if(!val) pinValue = 1; + + return pinValue; +} + + + +int protocol_read_setstep() +{ + int pinValue = 0; + int val = 0; + + val = digitalRead(StepSetPin); + if(!val) pinValue = 1; + + return pinValue; +} + +protocol_read_xencoder0() +{ + int pinValue = 0; + int val = 0; + + val = digitalRead(encoderSetX0); + if(!val) pinValue = 1; + + return pinValue; +} + +protocol_read_yencoder0() +{ + int pinValue = 0; + int val = 0; + + val = digitalRead(encoderSetY0); + if(!val) pinValue = 1; + + return pinValue; +} + +int protocol_read_xyzhome() +{ + int pinValue = 0; + int val = 0; + int val1 = 0; + + val = digitalRead(xyHomePin); + if(!val){ + pinValue = 1; + } + val1 = digitalRead(zHometPin); + if(!val1){ + pinValue = 2; + if(!val) pinValue = 3; + } + + return pinValue; +} + +int protocol_read_xencoder() +{ + sys.nX = digitalRead(encoderXaPin); + if ((sys.encoderXPinALast == LOW) && (sys.nX == HIGH)) { + //PrintComandLCD("X-ENCDER"); + if (digitalRead(encoderXbPin) == LOW) { + sys.encoderXFPos = sys.encoderXFPos - sys.step_click; + } else { + sys.encoderXFPos = sys.encoderXFPos + sys.step_click; + } + + PrintPosLCDXX(sys.encoderXFPos); + } + sys.encoderXPinALast = sys.nX; +} + +int protocol_read_yencoder() +{ + sys.nY = digitalRead(encoderYaPin); + if ((sys.encoderYPinALast == LOW) && (sys.nY == HIGH)) { + //PrintComandLCD("Y-ENCDER"); + if (digitalRead(encoderYbPin) == LOW) { + sys.encoderYFPos = sys.encoderYFPos - sys.step_click; + } else { + sys.encoderYFPos = sys.encoderYFPos + sys.step_click; + } + PrintPosLCDYY(sys.encoderYFPos); + } + sys.encoderYPinALast = sys.nY; +} + +//end added // Handles Grbl system suspend procedures, such as feed hold, safety door, and parking motion. // The system will enter this loop, create local variables for suspend tasks, and return to diff --git a/grbl/protocol.h b/grbl_lcd/protocol.h similarity index 61% rename from grbl/protocol.h rename to grbl_lcd/protocol.h index 56acba30f..11a4e9d68 100644 --- a/grbl/protocol.h +++ b/grbl_lcd/protocol.h @@ -41,4 +41,34 @@ void protocol_auto_cycle_start(); // Block until all buffered steps are executed void protocol_buffer_synchronize(); +//added read digital pins for axis moving +void protocol_read_axispins(); + +//added read digital pins for axis moving +int protocol_read_axisxyz(float* x, float* y, float* z); +//added read digital pins for axis moving +int protocol_read_axissetxy(); +//added read digital pins for axis moving +int protocol_read_axissetz(); +//added read digital pins for pwm settings +int protocol_read_setstep(); +//added read digital pins for pwm settings +int protocol_read_goxy(); +//added read digital pins for pwm settings +int protocol_read_xyzhome(); +//added read digital pins for pwm settings +int protocol_read_xencoder(); +//added read digital pins for pwm settings +int protocol_read_yencoder(); +int protocol_read_xencoder0(); +int protocol_read_yencoder0(); + +extern volatile uint8_t step_per_click; + +extern volatile uint8_t protocol_count; + +extern volatile uint8_t nX; +extern volatile uint8_t nY; +extern volatile uint8_t bX; +extern volatile uint8_t bY; #endif diff --git a/grbl/report.c b/grbl_lcd/report.c similarity index 80% rename from grbl/report.c rename to grbl_lcd/report.c index 07598494a..a94ce0cc1 100644 --- a/grbl/report.c +++ b/grbl_lcd/report.c @@ -452,19 +452,38 @@ void report_realtime_status() // Report current machine state and sub-states serial_write('<'); switch (sys.state) { - case STATE_IDLE: printPgmString(PSTR("Idle")); break; - case STATE_CYCLE: printPgmString(PSTR("Run")); break; + case STATE_IDLE: + printPgmString(PSTR("Idle")); + //PrintStatusLCD("Idle "); + break; + case STATE_CYCLE: + printPgmString(PSTR("Run")); + //PrintStatusLCD("Run "); + break; case STATE_HOLD: if (!(sys.suspend & SUSPEND_JOG_CANCEL)) { printPgmString(PSTR("Hold:")); if (sys.suspend & SUSPEND_HOLD_COMPLETE) { serial_write('0'); } // Ready to resume else { serial_write('1'); } // Actively holding + //PrintStatusLCD("Hold "); break; } // Continues to print jog state during jog cancel. - case STATE_JOG: printPgmString(PSTR("Jog")); break; - case STATE_HOMING: printPgmString(PSTR("Home")); break; - case STATE_ALARM: printPgmString(PSTR("Alarm")); break; - case STATE_CHECK_MODE: printPgmString(PSTR("Check")); break; + case STATE_JOG: + printPgmString(PSTR("Jog")); + //PrintStatusLCD("Jog "); + break; + case STATE_HOMING: + printPgmString(PSTR("Home")); + //PrintStatusLCD("Home "); + break; + case STATE_ALARM: + printPgmString(PSTR("Alarm")); + //PrintStatusLCD("Alarm "); + break; + case STATE_CHECK_MODE: + printPgmString(PSTR("Check")); + //PrintStatusLCD("Check "); + break; case STATE_SAFETY_DOOR: printPgmString(PSTR("Door:")); if (sys.suspend & SUSPEND_INITIATE_RESTORE) { @@ -480,8 +499,12 @@ void report_realtime_status() serial_write('2'); // Retracting } } + //PrintStatusLCD("Door "); break; - case STATE_SLEEP: printPgmString(PSTR("Sleep")); break; + case STATE_SLEEP: + printPgmString(PSTR("Sleep")); + //PrintStatusLCD("Sleep "); + break; } float wco[N_AXIS]; @@ -500,11 +523,14 @@ void report_realtime_status() // Report machine position if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_POSITION_TYPE)) { printPgmString(PSTR("|MPos:")); + //PrintPosLCD((float)print_position[0], (float)print_position[1],(float)print_position[2]); } else { printPgmString(PSTR("|WPos:")); + PrintPosLCD((float)print_position[0], (float)print_position[1],(float)print_position[2]); } + //PrintPosLCD((float)print_position[0], (float)print_position[1],(float)print_position[2]); report_util_axis_values(print_position); - + // Returns planner and serial read buffer states. #ifdef REPORT_FIELD_BUFFER_STATE if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_BUFFER_STATE)) { @@ -534,6 +560,11 @@ void report_realtime_status() serial_write(','); printFloat(sys.spindle_speed,N_DECIMAL_RPMVALUE); #endif + //PrintFeedLCD(st_get_realtime_rate()); + //PrintSpindleLCD(sys.spindle_speed); + + + #ifdef REPORT_FIELD_PIN_STATE uint8_t lim_pin_state = limits_get_state(); @@ -567,6 +598,7 @@ void report_realtime_status() if (sys.report_ovr_counter == 0) { sys.report_ovr_counter = 1; } // Set override on next report. printPgmString(PSTR("|WCO:")); report_util_axis_values(wco); + //PrintWcoLCD(wco[0], wco[1],wco[2]); } #endif @@ -608,3 +640,133 @@ void report_realtime_status() } #endif + +// Prints real-time data to LCD. 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, but the desired real-time data report must be as short as possible. This is + // requires as it minimizes the computational overhead and allows grbl to keep running smoothly, + // especially during g-code programs with fast, short line segments and high frequency reports (5-20Hz). +void report_lcd_status() +{ + uint8_t idx; + 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]; + float wpos_position[N_AXIS]; + system_convert_array_steps_to_mpos(print_position,current_position); + + //PrintComandLCD(" "); //added + // Report current machine state and sub-states + switch (sys.state) { + case STATE_IDLE: + PrintStatusLCD("Idle "); + break; + case STATE_CYCLE: + PrintStatusLCD("Run "); + break; + case STATE_HOLD: + if (!(sys.suspend & SUSPEND_JOG_CANCEL)) { + PrintStatusLCD("Hold "); + break; + } // Continues to print jog state during jog cancel. + case STATE_JOG: + PrintStatusLCD("Jog "); + break; + case STATE_HOMING: + PrintStatusLCD("Home "); + break; + case STATE_ALARM: + PrintStatusLCD("Alarm "); + break; + case STATE_CHECK_MODE: + PrintStatusLCD("Check "); + break; + case STATE_SAFETY_DOOR: + PrintStatusLCD("Door "); + break; + case STATE_SLEEP: + PrintStatusLCD("Sleep "); + break; + } + + float wco[N_AXIS]; + for (idx=0; idx< N_AXIS; idx++) { + // Apply work coordinate offsets and tool length offset to current position. + wco[idx] = gc_state.coord_system[idx]+gc_state.coord_offset[idx]; + if (idx == TOOL_LENGTH_OFFSET_AXIS) { wco[idx] += gc_state.tool_length_offset; } + wpos_position[idx] = print_position[idx] - wco[idx]; + } + + PrintPosLCD((float)wpos_position[0], (float)wpos_position[1],(float)wpos_position[2]); + PrintWcoLCD((float)print_position[0], (float)print_position[1],(float)print_position[2]); + //PrintComandWcoLCD(wco[0], wco[1], wco[2]); + + PrintFeedLCD(st_get_realtime_rate()); + PrintSpindleLCD(sys.spindle_speed); + PrintSfeedLCD(sys.sfeed_rate); + +} + +void report_lcd_status_fast() +{ + uint8_t idx; + 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]; + float wpos_position[N_AXIS]; + system_convert_array_steps_to_mpos(print_position,current_position); + + // Report current machine state and sub-states + switch (sys.state) { + case STATE_IDLE: + PrintStatusLCD("Idle "); + break; + case STATE_CYCLE: + PrintStatusLCD("Run "); + break; + case STATE_HOLD: +/* + if (!(sys.suspend & SUSPEND_JOG_CANCEL)) { + PrintStatusLCD("Hold "); + break; + } // Continues to print jog state during jog cancel. +*/ + PrintStatusLCD("Hold "); + break; + case STATE_JOG: + PrintStatusLCD("Jog "); + break; + case STATE_HOMING: + PrintStatusLCD("Home "); + break; + case STATE_ALARM: + PrintStatusLCD("Alarm "); + break; + case STATE_CHECK_MODE: + PrintStatusLCD("Check "); + break; + case STATE_SAFETY_DOOR: + PrintStatusLCD("Door "); + break; + case STATE_SLEEP: + PrintStatusLCD("Sleep "); + break; + } + + float wco[N_AXIS]; + for (idx=0; idx< N_AXIS; idx++) { + // Apply work coordinate offsets and tool length offset to current position. + wco[idx] = gc_state.coord_system[idx]+gc_state.coord_offset[idx]; + if (idx == TOOL_LENGTH_OFFSET_AXIS) { wco[idx] += gc_state.tool_length_offset; } + wpos_position[idx] = print_position[idx] - wco[idx]; + } + + //PrintPosLCD((float)wpos_position[0], (float)wpos_position[1],(float)wpos_position[2]); + PrintWcoLCD((float)print_position[0], (float)print_position[1],(float)print_position[2]); + //PrintComandWcoLCD(wco[0], wco[1], wco[2]); + + PrintFeedLCD(st_get_realtime_rate()); + PrintSpindleLCD(sys.spindle_speed); + //PrintSfeedLCD(sys.sfeed_rate); + +} diff --git a/grbl/report.h b/grbl_lcd/report.h similarity index 98% rename from grbl/report.h rename to grbl_lcd/report.h index f1480026a..f92209fc8 100644 --- a/grbl/report.h +++ b/grbl_lcd/report.h @@ -124,6 +124,10 @@ void report_execute_startup_message(char *line, uint8_t status_code); // Prints build info and user info void report_build_info(char *line); +// Prints realtime status to LCD +void report_lcd_status(); +void report_lcd_status_fast(); + #ifdef DEBUG void report_realtime_debug(); #endif diff --git a/grbl/serial.c b/grbl_lcd/serial.c similarity index 100% rename from grbl/serial.c rename to grbl_lcd/serial.c diff --git a/grbl/serial.h b/grbl_lcd/serial.h similarity index 100% rename from grbl/serial.h rename to grbl_lcd/serial.h diff --git a/grbl/settings.c b/grbl_lcd/settings.c similarity index 100% rename from grbl/settings.c rename to grbl_lcd/settings.c diff --git a/grbl/settings.h b/grbl_lcd/settings.h similarity index 100% rename from grbl/settings.h rename to grbl_lcd/settings.h diff --git a/grbl/sleep.c b/grbl_lcd/sleep.c similarity index 100% rename from grbl/sleep.c rename to grbl_lcd/sleep.c diff --git a/grbl/sleep.h b/grbl_lcd/sleep.h similarity index 100% rename from grbl/sleep.h rename to grbl_lcd/sleep.h diff --git a/grbl/spindle_control.c b/grbl_lcd/spindle_control.c similarity index 100% rename from grbl/spindle_control.c rename to grbl_lcd/spindle_control.c diff --git a/grbl/spindle_control.h b/grbl_lcd/spindle_control.h similarity index 100% rename from grbl/spindle_control.h rename to grbl_lcd/spindle_control.h diff --git a/grbl/stepper.c b/grbl_lcd/stepper.c similarity index 96% rename from grbl/stepper.c rename to grbl_lcd/stepper.c index d0fc3aa71..f9838b650 100644 --- a/grbl/stepper.c +++ b/grbl_lcd/stepper.c @@ -391,8 +391,11 @@ ISR(TIMER1_COMPA_vect) // Enable step pulse reset timer so that The Stepper Port Reset Interrupt can reset the signal after // exactly settings.pulse_microseconds microseconds, independent of the main Timer1 prescaler. - TCNT0 = st.step_pulse_time; // Reload Timer0 counter - TCCR0B = (1<