diff --git a/Grbl_Esp32/defaults.h b/Grbl_Esp32/defaults.h index f33447f3..3d7514f4 100644 --- a/Grbl_Esp32/defaults.h +++ b/Grbl_Esp32/defaults.h @@ -292,10 +292,29 @@ #define DEFAULT_C_MICROSTEPS 16 // $165 micro steps (extended set) #endif +// ========== Stallguard (SPI Drivers ) ================ - - - - - +#ifndef DEFAULT_X_STALLGUARD + #define DEFAULT_X_STALLGUARD 16 // $170 stallguard (extended set) #endif +#ifndef DEFAULT_Y_STALLGUARD + #define DEFAULT_Y_STALLGUARD 16 // $171 stallguard (extended set) +#endif +#ifndef DEFAULT_Z_STALLGUARD + #define DEFAULT_Z_STALLGUARD 16 // $172 stallguard (extended set) +#endif +#ifndef DEFAULT_A_STALLGUARD + #define DEFAULT_A_STALLGUARD 16 // $173 stallguard (extended set) +#endif +#ifndef DEFAULT_B_STALLGUARD + #define DEFAULT_B_STALLGUARD 16 // $174 stallguard (extended set) +#endif +#ifndef DEFAULT_C_STALLGUARD + #define DEFAULT_C_STALLGUARD 16 // $175 stallguard (extended set) +#endif + + + + + +#endif \ No newline at end of file diff --git a/Grbl_Esp32/polar_coaster.h b/Grbl_Esp32/polar_coaster.h index f53faa79..fdbd6a7d 100644 --- a/Grbl_Esp32/polar_coaster.h +++ b/Grbl_Esp32/polar_coaster.h @@ -64,6 +64,16 @@ #define ENABLE_CONTROL_SW_DEBOUNCE #endif +#ifdef CONTROL_SW_DEBOUNCE_PERIOD + #undef CONTROL_SW_DEBOUNCE_PERIOD +#endif +#define CONTROL_SW_DEBOUNCE_PERIOD 100 // really long debounce + +#ifdef INVERT_CONTROL_PIN_MASK + #undef INVERT_CONTROL_PIN_MASK +#endif +#define INVERT_CONTROL_PIN_MASK B11111111 + #define MACRO_BUTTON_0_PIN GPIO_NUM_13 #define MACRO_BUTTON_1_PIN GPIO_NUM_12 #define MACRO_BUTTON_2_PIN GPIO_NUM_14 diff --git a/Grbl_Esp32/report.cpp b/Grbl_Esp32/report.cpp index 282b2e80..73a85b5e 100644 --- a/Grbl_Esp32/report.cpp +++ b/Grbl_Esp32/report.cpp @@ -284,7 +284,7 @@ void report_grbl_help(uint8_t client) { void report_grbl_settings(uint8_t client) { // Print Grbl settings. char setting[20]; - char rpt[1000]; + char rpt[1000]; rpt[0] = '\0'; @@ -326,7 +326,16 @@ void report_grbl_settings(uint8_t client) { sprintf(setting, "$33=%5.3f\r\n", settings.spindle_pwm_freq); strcat(rpt, setting); sprintf(setting, "$34=%3.3f\r\n", settings.spindle_pwm_off_value); strcat(rpt, setting); sprintf(setting, "$35=%3.3f\r\n", settings.spindle_pwm_min_value); strcat(rpt, setting); - sprintf(setting, "$36=%3.3f\r\n", settings.spindle_pwm_max_value); strcat(rpt, setting); + sprintf(setting, "$36=%3.3f\r\n", settings.spindle_pwm_max_value); strcat(rpt, setting); + + for (uint8_t index = 0; index A_AXIS) settings.steps_per_mm[A_AXIS] = DEFAULT_A_STEPS_PER_MM; @@ -131,6 +133,7 @@ void settings_restore(uint8_t restore_flag) { settings.current[A_AXIS] = DEFAULT_A_CURRENT; settings.hold_current[A_AXIS] = DEFAULT_A_HOLD_CURRENT; settings.microsteps[A_AXIS] = DEFAULT_A_MICROSTEPS; + settings.stallguard[A_AXIS] = DEFAULT_Z_STALLGUARD; #endif #if (N_AXIS > B_AXIS) @@ -141,6 +144,7 @@ void settings_restore(uint8_t restore_flag) { settings.current[B_AXIS] = DEFAULT_B_CURRENT; settings.hold_current[B_AXIS] = DEFAULT_B_HOLD_CURRENT; settings.microsteps[B_AXIS] = DEFAULT_B_MICROSTEPS; + settings.stallguard[B_AXIS] = DEFAULT_Z_STALLGUARD; #endif #if (N_AXIS > C_AXIS) @@ -151,9 +155,15 @@ void settings_restore(uint8_t restore_flag) { settings.current[C_AXIS] = DEFAULT_C_CURRENT; settings.hold_current[C_AXIS] = DEFAULT_C_HOLD_CURRENT; settings.microsteps[C_AXIS] = DEFAULT_C_MICROSTEPS; + settings.stallguard[C_AXIS] = DEFAULT_Z_STALLGUARD; #endif - + // TODO figure out a clean way to add actual default values + for (uint8_t index = 0; index= 100 for axis settings. Up to 255. #define AXIS_SETTINGS_INCREMENT 10 // Must be greater than the number of axis settings +#define USER_SETTING_COUNT 5 // for user to define for their machine + // Global persistent settings (Stored from byte EEPROM_ADDR_GLOBAL onwards) typedef struct { // Axis settings @@ -93,6 +95,7 @@ typedef struct { float current[N_AXIS]; // $140... run current (extended set) float hold_current[N_AXIS]; // $150 percent of run current (extended set) uint16_t microsteps[N_AXIS]; // $160... (extended set) + uint8_t stallguard[N_AXIS]; // $170... (extended set) // Remaining Grbl settings uint8_t pulse_microseconds; @@ -118,6 +121,10 @@ typedef struct { float homing_seek_rate; uint16_t homing_debounce_delay; float homing_pulloff; + + int16_t machine_int16[USER_SETTING_COUNT]; // settings starting at 80 to be defined by the user + float machine_float[USER_SETTING_COUNT]; // settings starting at 80 to be defined by the user + } settings_t; extern settings_t settings; @@ -150,4 +157,3 @@ uint8_t get_direction_pin_mask(uint8_t i); void settings_spi_driver_init(); #endif - diff --git a/doc/csv/setting_codes_en_US.csv b/doc/csv/setting_codes_en_US.csv index 2fdcb7d5..55362625 100644 --- a/doc/csv/setting_codes_en_US.csv +++ b/doc/csv/setting_codes_en_US.csv @@ -21,6 +21,12 @@ "30","Maximum spindle speed","RPM","Maximum spindle speed. Sets PWM to 100% duty cycle." "31","Minimum spindle speed","RPM","Minimum spindle speed. Sets PWM to 0.4% or lowest duty cycle." "32","Laser-mode enable","boolean","Enables laser mode. Consecutive G1/2/3 commands will not halt when spindle speed is changed." +"33","Spindle PWM Freq","16-bit","Spindle PWM Freq" +"34","Spindle PWM Off Value","16-bit","Spindle PWM Off Value" +"35","Spindle PWM Min Value","16-bit","Spindle PWM Min Value" +"36","Spindle PWM Max Value","16-bit","Spindle PWM Max Value" +"80-84","User integer Values","unsigned 16-bit","Reserved for custom machine use" +"90-94","User Floating point value","float","Reserved for custom machine use" "100","X-axis travel resolution","step/mm","X-axis travel resolution in steps per millimeter." "101","Y-axis travel resolution","step/mm","Y-axis travel resolution in steps per millimeter." "102","Z-axis travel resolution","step/mm","Z-axis travel resolution in steps per millimeter." @@ -36,3 +42,5 @@ "140-145","Motor run current","Amps","Motor run current for SPI (Trinamic) type motors" "150-155","Motor hold current","Percent","Hold current in percent of run current for SPI (Trinamic) type motors" "160-165","Motor microstepping","micros/step","Number of microsteps per step for SPI (Trinamic) type motors" +"170-175","Motor Stallguard Value","0-255","Value of Stallguard setting for SPI (Trinamic) type motors" +