1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-30 09:39:49 +02:00

Merge pull request #135 from bdring/Devt

Devt
This commit is contained in:
bdring
2019-05-01 16:35:07 -05:00
committed by GitHub
6 changed files with 1350 additions and 1073 deletions

View File

@@ -45,6 +45,8 @@
// won't affect operation except that there will be no output // won't affect operation except that there will be no output
// form the pins. Grbl will virtually move the axis. This could // form the pins. Grbl will virtually move the axis. This could
// be handy if you are using a servo, etc. for another axis. // be handy if you are using a servo, etc. for another axis.
#define CPU_MAP_NAME "CPU_MAP_ESP32"
#define X_STEP_PIN GPIO_NUM_12 #define X_STEP_PIN GPIO_NUM_12
#define X_DIRECTION_PIN GPIO_NUM_26 #define X_DIRECTION_PIN GPIO_NUM_26
#define X_RMT_CHANNEL 0 #define X_RMT_CHANNEL 0
@@ -112,6 +114,8 @@
// For laser mode, you do not need to change anything // For laser mode, you do not need to change anything
// Note: You can use all 3 modes at the same time if you want // Note: You can use all 3 modes at the same time if you want
#define CPU_MAP_NAME "CPU_MAP_PEN_LASER"
// Pick a board version // Pick a board version
//#define PEN_LASER_V1 //#define PEN_LASER_V1
#define PEN_LASER_V2 #define PEN_LASER_V2
@@ -209,6 +213,9 @@
#endif #endif
#ifdef CPU_MAP_MIDTBOT // Buildlog.net midtbot #ifdef CPU_MAP_MIDTBOT // Buildlog.net midtbot
#define CPU_MAP_NAME "CPU_MAP_MIDTBOT"
#define X_STEP_PIN GPIO_NUM_12 #define X_STEP_PIN GPIO_NUM_12
#define Y_STEP_PIN GPIO_NUM_14 #define Y_STEP_PIN GPIO_NUM_14
#define X_DIRECTION_PIN GPIO_NUM_26 #define X_DIRECTION_PIN GPIO_NUM_26
@@ -326,6 +333,8 @@
#endif #endif
#ifdef CPU_MAP_POLAR_COASTER // The Buildlog.net pen polar coaster controller V1 #ifdef CPU_MAP_POLAR_COASTER // The Buildlog.net pen polar coaster controller V1
#define CPU_MAP_NAME "CPU_MAP_POLAR_COASTER"
#define X_STEP_PIN GPIO_NUM_15 #define X_STEP_PIN GPIO_NUM_15
#define Y_STEP_PIN GPIO_NUM_2 #define Y_STEP_PIN GPIO_NUM_2
#define X_DIRECTION_PIN GPIO_NUM_25 #define X_DIRECTION_PIN GPIO_NUM_25
@@ -432,6 +441,8 @@
// For laser mode, you do not need to change anything // For laser mode, you do not need to change anything
// Note: You can use all 3 modes at the same time if you want // Note: You can use all 3 modes at the same time if you want
#define CPU_MAP_NAME "CPU_MAP_SERVO_AXIS"
// Pick a board version // Pick a board version
//#define PEN_LASER_V1 //#define PEN_LASER_V1
#define PEN_LASER_V2 #define PEN_LASER_V2
@@ -665,6 +676,8 @@
#ifdef CPU_MAP_MPCNC #ifdef CPU_MAP_MPCNC
// This is the CPU Map for the Buildlog.net MPCNC controller // This is the CPU Map for the Buildlog.net MPCNC controller
#define CPU_MAP_NAME "CPU_MAP_MPCNC"
// switch to the correct default settings // switch to the correct default settings
#ifdef DEFAULTS_GENERIC #ifdef DEFAULTS_GENERIC
#undef DEFAULTS_GENERIC #undef DEFAULTS_GENERIC
@@ -744,10 +757,12 @@
#endif #endif
#ifdef CPU_MAP_LOWRIDER #ifdef CPU_MAP_LOWRIDER // !!!!!!!!!!!!!!!!! Warning: Untested !!!!!!!!!!!!!!!!! //
// This is the CPU Map for the Buildlog.net MPCNC controller // This is the CPU Map for the Buildlog.net MPCNC controller
// used in lowrider mode. Low rider has (2) Z and one each of X and Y // used in lowrider mode. Low rider has (2) Z and one each of X and Y
// These will not match the silkscreen or schematic descriptions // These will not match the silkscreen or schematic descriptions
#define CPU_MAP_NAME "CPU_MAP_LOWRIDER"
#define USE_GANGED_AXES // allow two motors on an axis #define USE_GANGED_AXES // allow two motors on an axis
@@ -757,9 +772,9 @@
#define Y_STEP_B_PIN GPIO_NUM_21 // ganged motor #define Y_STEP_B_PIN GPIO_NUM_21 // ganged motor
#define Y_AXIS_SQUARING #define Y_AXIS_SQUARING
#define Z_STEP_PIN GPIO_NUM_12 #define Z_STEP_PIN GPIO_NUM_12
#define Z_STEP_B_PIN GPIO_NUM_22 #define Z_STEP_B_PIN GPIO_NUM_22
#define Y_AXIS_SQUARING #define Z_AXIS_SQUARING
#define X_DIRECTION_PIN GPIO_NUM_33 // use Z labeled connector #define X_DIRECTION_PIN GPIO_NUM_33 // use Z labeled connector
#define Y_DIRECTION_PIN GPIO_NUM_25 #define Y_DIRECTION_PIN GPIO_NUM_25
@@ -821,6 +836,7 @@
#endif #endif
// ================= common to all machines ================================ // ================= common to all machines ================================
// These are some ESP32 CPU Settings that the program needs, but are generally not changed // These are some ESP32 CPU Settings that the program needs, but are generally not changed

File diff suppressed because it is too large Load Diff

View File

@@ -132,7 +132,9 @@ boolean readFileLine(char *line)
if (!(line_flags & LINE_FLAG_COMMENT_PARENTHESES)) { // semi colon inside parentheses do not mean anything if (!(line_flags & LINE_FLAG_COMMENT_PARENTHESES)) { // semi colon inside parentheses do not mean anything
line_flags |= LINE_FLAG_COMMENT_SEMICOLON; line_flags |= LINE_FLAG_COMMENT_SEMICOLON;
} }
} else if (c == '\n') { // found the newline, so mark the end and return true } else if (c == '%') {
// discard this character
} else if (c == '\n') { // found the newline, so mark the end and return true
line[index] = '\0'; line[index] = '\0';
return true; return true;
} else { // add characters to the line } else { // add characters to the line

View File

@@ -97,7 +97,6 @@ void protocol_main_loop()
sd_get_current_filename(temp); sd_get_current_filename(temp);
grbl_notifyf("SD print done", "%s print is successful", temp); grbl_notifyf("SD print done", "%s print is successful", temp);
closeFile(); // close file and clear SD ready/running flags closeFile(); // close file and clear SD ready/running flags
} }
} }
#endif #endif
@@ -186,7 +185,7 @@ void protocol_main_loop()
line[char_counter++] = c; // capture this character line[char_counter++] = c; // capture this character
// TODO: Install '%' feature // TODO: Install '%' feature
// } else if (c == '%') { } else if (c == '%') {
// Program start-end percent sign NOT SUPPORTED. // Program start-end percent sign NOT SUPPORTED.
// NOTE: This maybe installed to tell Grbl when a program is running vs manual input, // NOTE: This maybe installed to tell Grbl when a program is running vs manual input,
// where, during a program, the system auto-cycle start will continue to execute // where, during a program, the system auto-cycle start will continue to execute

View File

@@ -197,9 +197,16 @@ void report_status_message(uint8_t status_code, uint8_t client)
#ifdef ENABLE_SD_CARD #ifdef ENABLE_SD_CARD
// do we need to stop a running SD job? // do we need to stop a running SD job?
if (get_sd_state(false) == SDCARD_BUSY_PRINTING) { if (get_sd_state(false) == SDCARD_BUSY_PRINTING) {
grbl_notifyf("SD print error", "Error:%d during SD file at line: %d", status_code, sd_get_current_line_number()); if (status_code == STATUS_GCODE_UNSUPPORTED_COMMAND) {
grbl_sendf(CLIENT_ALL, "error:%d in SD file at line %d\r\n", status_code, sd_get_current_line_number()); grbl_sendf(client, "error:%d\r\n", status_code); // most senders seem to tolerate this error and keep on going
closeFile(); grbl_sendf(CLIENT_ALL, "error:%d in SD file at line %d\r\n", status_code, sd_get_current_line_number());
// don't close file
}
else {
grbl_notifyf("SD print error", "Error:%d during SD file at line: %d", status_code, sd_get_current_line_number());
grbl_sendf(CLIENT_ALL, "error:%d in SD file at line %d\r\n", status_code, sd_get_current_line_number());
closeFile();
}
return; return;
} }
#endif #endif
@@ -259,6 +266,9 @@ void report_feedback_message(uint8_t message_code) // OK to send to all clients
void report_init_message(uint8_t client) void report_init_message(uint8_t client)
{ {
grbl_send(client,"\r\nGrbl " GRBL_VERSION " ['$' for help]\r\n"); grbl_send(client,"\r\nGrbl " GRBL_VERSION " ['$' for help]\r\n");
#ifdef CPU_MAP_NAME
grbl_send(client,"[MSG:Using cpu_map..." CPU_MAP_NAME "]\r\n");
#endif
} }
// Grbl help message // Grbl help message

View File

@@ -261,10 +261,13 @@ void IRAM_ATTR onStepperDriverTimer(void *para) // ISR It is time to take a ste
// Segment buffer empty. Shutdown. // Segment buffer empty. Shutdown.
st_go_idle(); st_go_idle();
#ifdef VARIABLE_SPINDLE #ifdef VARIABLE_SPINDLE
// Ensure pwm is set properly upon completion of rate-controlled motion. if (!(sys.state & STATE_JOG)) { // added to prevent ... jog after probing crash
if (st.exec_block->is_pwm_rate_adjusted) { // Ensure pwm is set properly upon completion of rate-controlled motion.
spindle_set_speed(SPINDLE_PWM_OFF_VALUE); if (st.exec_block->is_pwm_rate_adjusted) {
spindle_set_speed(SPINDLE_PWM_OFF_VALUE);
}
} }
#endif #endif
system_set_exec_state_flag(EXEC_CYCLE_STOP); // Flag main program for cycle end system_set_exec_state_flag(EXEC_CYCLE_STOP); // Flag main program for cycle end
return; // Nothing to do but exit. return; // Nothing to do but exit.
@@ -431,6 +434,7 @@ void stepper_init()
} }
#ifdef USE_RMT_STEPS
void initRMT() void initRMT()
{ {
rmt_item32_t rmtItem[2]; rmt_item32_t rmtItem[2];
@@ -514,6 +518,7 @@ void initRMT()
} }
#endif
// enabled. Startup init and limits call this function but shouldn't start the cycle. // enabled. Startup init and limits call this function but shouldn't start the cycle.
void st_wake_up() void st_wake_up()
@@ -649,7 +654,7 @@ void set_stepper_pins_on(uint8_t onMask)
} }
#endif #endif
#ifdef USE_RMT_STEPS
// Set stepper pulse output pins // Set stepper pulse output pins
inline IRAM_ATTR static void stepperRMT_Outputs() inline IRAM_ATTR static void stepperRMT_Outputs()
{ {
@@ -698,6 +703,7 @@ inline IRAM_ATTR static void stepperRMT_Outputs()
} }
#endif #endif
} }
#endif
// Stepper shutdown // Stepper shutdown
void st_go_idle() void st_go_idle()