diff --git a/config.h b/config.h index 9a55119..601457e 100644 --- a/config.h +++ b/config.h @@ -148,6 +148,12 @@ // NOTE: Will eventually be added to Grbl settings in v1.0. // #define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable. +// Enable input pin states feedback in status reports. The data is presented as a binary value with +// the bits in the appropriate input pin ports being 0(low) or 1(high). Useful for setting up a new +// CNC machine, but do not recommend keeping this option by default, as it will consume CPU resources +// with little to no benefit during normal operation. +// #define REPORT_INPUT_PIN_STATES // Default disabled. Uncomment to enable. + // --------------------------------------------------------------------------------------- // ADVANCED CONFIGURATION OPTIONS: @@ -167,6 +173,11 @@ // step smoothing. See stepper.c for more details on the AMASS system works. #define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING // Default enabled. Comment to disable. +// Sets the maximum step rate allowed to be written as a Grbl setting. This value is strictly limited +// by the CPU speed and will change if something other than an AVR running at 16MHz is used. +// NOTE: For now disabled, will enable if flash space permits. +// #define MAX_STEP_RATE_HZ 30000 // Hz + // By default, Grbl sets all input pins to normal-high operation with their internal pull-up resistors // enabled. This simplifies the wiring for users by requiring only a switch connected to ground, // although its recommended that users take the extra step of wiring in low-pass filter to reduce diff --git a/report.c b/report.c index fd47e90..6e0d2da 100644 --- a/report.c +++ b/report.c @@ -75,6 +75,8 @@ void report_status_message(uint8_t status_code) printPgmString(PSTR("Homing not enabled")); break; case STATUS_OVERFLOW: printPgmString(PSTR("Line overflow")); break; + // case STATUS_MAX_STEP_RATE_EXCEEDED: + // printPgmString(PSTR("Step rate > 30kHz")); break; // Common g-code parser errors. case STATUS_GCODE_MODAL_GROUP_VIOLATION: @@ -449,5 +451,12 @@ void report_realtime_status() printFloat_RateValue(st_get_realtime_rate()); #endif + #ifdef REPORT_INPUT_PIN_STATES + printPgmString(PSTR(",Lim:")); + print_uint8_base2(LIMIT_PIN & LIMIT_MASK); + printPgmString(PSTR(",Ctl:")); + print_uint8_base2(CONTROL_PIN & CONTROL_MASK); + #endif + printPgmString(PSTR(">\r\n")); } diff --git a/report.h b/report.h index e770469..c0916aa 100644 --- a/report.h +++ b/report.h @@ -33,6 +33,7 @@ #define STATUS_ALARM_LOCK 9 #define STATUS_SOFT_LIMIT_ERROR 10 #define STATUS_OVERFLOW 11 +// #define STATUS_MAX_STEP_RATE_EXCEEDED 12 #define STATUS_GCODE_UNSUPPORTED_COMMAND 20 #define STATUS_GCODE_MODAL_GROUP_VIOLATION 21 diff --git a/settings.c b/settings.c index 56e2fab..a81e0e8 100644 --- a/settings.c +++ b/settings.c @@ -200,8 +200,14 @@ uint8_t settings_store_global_setting(uint8_t parameter, float value) { if (parameter < N_AXIS) { // Valid axis setting found. switch (set_idx) { - case 0: settings.steps_per_mm[parameter] = value; break; - case 1: settings.max_rate[parameter] = value; break; + case 0: + // if (value*settings.max_rate[parameter] > (MAX_STEP_RATE_HZ*60.0)) { return(STATUS_MAX_STEP_RATE_EXCEEDED); } + settings.steps_per_mm[parameter] = value; + break; + case 1: + // if (value*settings.steps_per_mm[parameter] > (MAX_STEP_RATE_HZ*60.0)) { return(STATUS_MAX_STEP_RATE_EXCEEDED); } + settings.max_rate[parameter] = value; + break; case 2: settings.acceleration[parameter] = value*60*60; break; // Convert to mm/min^2 for grbl internal use. case 3: settings.max_travel[parameter] = -value; break; // Store as negative for grbl internal use. }