// Grbl global settings print out. // NOTE: The numbering scheme here must correlate to storing in settings.c void report_grbl_settings() { printPgmString((const char *)("$0=")); printFloat(settings.steps_per_mm[X_AXIS]); printPgmString((const char *)(" (x, step/mm)\r\n$1=")); printFloat(settings.steps_per_mm[Y_AXIS]); printPgmString((const char *)(" (y, step/mm)\r\n$2=")); printFloat(settings.steps_per_mm[Z_AXIS]); printPgmString((const char *)(" (z, step/mm)\r\n$3=")); printInteger(settings.pulse_microseconds); printPgmString((const char *)(" (step pulse, usec)\r\n$4=")); printFloat(settings.default_feed_rate); printPgmString((const char *)(" (default feed, mm/min)\r\n$5=")); printFloat(settings.default_seek_rate); printPgmString((const char *)(" (default seek, mm/min)\r\n$6=")); printInteger(settings.invert_mask); printPgmString((const char *)(" (step port invert mask, int:")); print_uint8_base2(settings.invert_mask); printPgmString((const char *)(")\r\n$7=")); printInteger(settings.stepper_idle_lock_time); printPgmString((const char *)(" (step idle delay, msec)\r\n$8=")); printFloat(settings.acceleration/(60*60)); // Convert from mm/min^2 for human readability printPgmString((const char *)(" (acceleration, mm/sec^2)\r\n$9=")); printFloat(settings.junction_deviation); printPgmString((const char *)(" (junction deviation, mm)\r\n$10=")); printFloat(settings.mm_per_arc_segment); printPgmString((const char *)(" (arc, mm/segment)\r\n$11=")); printInteger(settings.n_arc_correction); printPgmString((const char *)(" (n-arc correction, int)\r\n$12=")); printInteger(settings.decimal_places); printPgmString((const char *)(" (n-decimals, int)\r\n$13=")); printInteger(bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)); printPgmString((const char *)(" (report inches, bool)\r\n$14=")); printInteger(bit_istrue(settings.flags,BITFLAG_AUTO_START)); printPgmString((const char *)(" (auto start, bool)\r\n$15=")); printInteger(bit_istrue(settings.flags,BITFLAG_INVERT_ST_ENABLE)); printPgmString((const char *)(" (invert step enable, bool)\r\n$16=")); printInteger(bit_istrue(settings.flags,BITFLAG_HARD_LIMIT_ENABLE)); printPgmString((const char *)(" (hard limits, bool)\r\n$17=")); printInteger(bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)); printPgmString((const char *)(" (homing cycle, bool)\r\n$18=")); printInteger(settings.homing_dir_mask); printPgmString((const char *)(" (homing dir invert mask, int:")); print_uint8_base2(settings.homing_dir_mask); printPgmString((const char *)(")\r\n$19=")); printFloat(settings.homing_feed_rate); printPgmString((const char *)(" (homing feed, mm/min)\r\n$20=")); printFloat(settings.homing_seek_rate); printPgmString((const char *)(" (homing seek, mm/min)\r\n$21=")); printInteger(settings.homing_debounce_delay); printPgmString((const char *)(" (homing debounce, msec)\r\n$22=")); printFloat(settings.homing_pulloff); printPgmString((const char *)(" (homing pull-off, mm)\r\n")); }
// Grbl global settings print out. // NOTE: The numbering scheme here must correlate to storing in settings.c void report_grbl_settings() { // Print Grbl settings. printPgmString(PSTR("$0=")); print_uint8_base10(settings.pulse_microseconds); printPgmString(PSTR(" (step pulse, usec)\r\n$1=")); print_uint8_base10(settings.stepper_idle_lock_time); printPgmString(PSTR(" (step idle delay, msec)\r\n$2=")); print_uint8_base10(settings.step_invert_mask); printPgmString(PSTR(" (step port invert mask:")); print_uint8_base2(settings.step_invert_mask); printPgmString(PSTR(")\r\n$3=")); print_uint8_base10(settings.dir_invert_mask); printPgmString(PSTR(" (dir port invert mask:")); print_uint8_base2(settings.dir_invert_mask); printPgmString(PSTR(")\r\n$4=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_INVERT_ST_ENABLE)); printPgmString(PSTR(" (step enable invert, bool)\r\n$5=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_INVERT_LIMIT_PINS)); printPgmString(PSTR(" (limit pins invert, bool)\r\n$6=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_INVERT_PROBE_PIN)); printPgmString(PSTR(" (probe pin invert, bool)\r\n$10=")); print_uint8_base10(settings.status_report_mask); printPgmString(PSTR(" (status report mask:")); print_uint8_base2(settings.status_report_mask); printPgmString(PSTR(")\r\n$11=")); printFloat_SettingValue(settings.junction_deviation); printPgmString(PSTR(" (junction deviation, mm)\r\n$12=")); printFloat_SettingValue(settings.arc_tolerance); printPgmString(PSTR(" (arc tolerance, mm)\r\n$13=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)); printPgmString(PSTR(" (report inches, bool)\r\n$14=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_AUTO_START)); printPgmString(PSTR(" (auto start, bool)\r\n$20=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_SOFT_LIMIT_ENABLE)); printPgmString(PSTR(" (soft limits, bool)\r\n$21=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_HARD_LIMIT_ENABLE)); printPgmString(PSTR(" (hard limits, bool)\r\n$22=")); print_uint8_base10(bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)); printPgmString(PSTR(" (homing cycle, bool)\r\n$23=")); print_uint8_base10(settings.homing_dir_mask); printPgmString(PSTR(" (homing dir invert mask:")); print_uint8_base2(settings.homing_dir_mask); printPgmString(PSTR(")\r\n$24=")); printFloat_SettingValue(settings.homing_feed_rate); printPgmString(PSTR(" (homing feed, mm/min)\r\n$25=")); printFloat_SettingValue(settings.homing_seek_rate); printPgmString(PSTR(" (homing seek, mm/min)\r\n$26=")); print_uint8_base10(settings.homing_debounce_delay); printPgmString(PSTR(" (homing debounce, msec)\r\n$27=")); printFloat_SettingValue(settings.homing_pulloff); printPgmString(PSTR(" (homing pull-off, mm)\r\n")); // Print axis settings uint8_t idx, set_idx; uint8_t val = AXIS_SETTINGS_START_VAL; for (set_idx=0; set_idx<AXIS_N_SETTINGS; set_idx++) { for (idx=0; idx<N_AXIS; idx++) { printPgmString(PSTR("$")); print_uint8_base10(val+idx); printPgmString(PSTR("=")); switch (set_idx) { case 0: printFloat_SettingValue(settings.steps_per_mm[idx]); break; case 1: printFloat_SettingValue(settings.max_rate[idx]); break; case 2: printFloat_SettingValue(settings.acceleration[idx]/(60*60)); break; case 3: printFloat_SettingValue(-settings.max_travel[idx]); break; } printPgmString(PSTR(" (")); switch (idx) { case X_AXIS: printPgmString(PSTR("x")); break; case Y_AXIS: printPgmString(PSTR("y")); break; case Z_AXIS: printPgmString(PSTR("z")); break; } switch (set_idx) { case 0: printPgmString(PSTR(", step/mm")); break; case 1: printPgmString(PSTR(" max rate, mm/min")); break; case 2: printPgmString(PSTR(" accel, mm/sec^2")); break; case 3: printPgmString(PSTR(" max travel, mm")); break; } printPgmString(PSTR(")\r\n")); } val += AXIS_SETTINGS_INCREMENT; } }
// Grbl global settings print out. // NOTE: The numbering scheme here must correlate to storing in settings.c void report_grbl_settings() { printPgmString(PSTR("$0=")); printFloat(settings.steps_per_mm[X_AXIS]); printPgmString(PSTR(" (x, step/mm)\r\n$1=")); printFloat(settings.steps_per_mm[Y_AXIS]); printPgmString(PSTR(" (y, step/mm)\r\n$2=")); printFloat(settings.steps_per_mm[Z_AXIS]); printPgmString(PSTR(" (z, step/mm)\r\n$3=")); printFloat(settings.max_rate[X_AXIS]); printPgmString(PSTR(" (x max rate, mm/min)\r\n$4=")); printFloat(settings.max_rate[Y_AXIS]); printPgmString(PSTR(" (y max rate, mm/min)\r\n$5=")); printFloat(settings.max_rate[Z_AXIS]); printPgmString(PSTR(" (z max rate, mm/min)\r\n$6=")); printFloat(settings.acceleration[X_AXIS]/(60*60)); // Convert from mm/min^2 for human readability printPgmString(PSTR(" (x accel, mm/sec^2)\r\n$7=")); printFloat(settings.acceleration[Y_AXIS]/(60*60)); // Convert from mm/min^2 for human readability printPgmString(PSTR(" (y accel, mm/sec^2)\r\n$8=")); printFloat(settings.acceleration[Z_AXIS]/(60*60)); // Convert from mm/min^2 for human readability printPgmString(PSTR(" (z accel, mm/sec^2)\r\n$9=")); printFloat(-settings.max_travel[X_AXIS]); // Grbl internally store this as negative. printPgmString(PSTR(" (x max travel, mm)\r\n$10=")); printFloat(-settings.max_travel[Y_AXIS]); // Grbl internally store this as negative. printPgmString(PSTR(" (y max travel, mm)\r\n$11=")); printFloat(-settings.max_travel[Z_AXIS]); // Grbl internally store this as negative. printPgmString(PSTR(" (z max travel, mm)\r\n$12=")); printInteger(settings.pulse_microseconds); printPgmString(PSTR(" (step pulse, usec)\r\n$13=")); printFloat(settings.default_feed_rate); printPgmString(PSTR(" (default feed, mm/min)\r\n$14=")); printInteger(settings.step_invert_mask); printPgmString(PSTR(" (step port invert mask:")); print_uint8_base2(settings.step_invert_mask); printPgmString(PSTR(")\r\n$15=")); printInteger(settings.dir_invert_mask); printPgmString(PSTR(" (dir port invert mask:")); print_uint8_base2(settings.dir_invert_mask); printPgmString(PSTR(")\r\n$16=")); printInteger(settings.stepper_idle_lock_time); printPgmString(PSTR(" (step idle delay, msec)\r\n$17=")); printFloat(settings.junction_deviation); printPgmString(PSTR(" (junction deviation, mm)\r\n$18=")); printFloat(settings.arc_tolerance); printPgmString(PSTR(" (arc tolerance, mm)\r\n$19=")); printInteger(settings.decimal_places); printPgmString(PSTR(" (n-decimals, int)\r\n$20=")); printInteger(bit_istrue(settings.flags,BITFLAG_REPORT_INCHES)); printPgmString(PSTR(" (report inches, bool)\r\n$21=")); printInteger(bit_istrue(settings.flags,BITFLAG_AUTO_START)); printPgmString(PSTR(" (auto start, bool)\r\n$22=")); printInteger(bit_istrue(settings.flags,BITFLAG_INVERT_ST_ENABLE)); printPgmString(PSTR(" (invert step enable, bool)\r\n$23=")); printInteger(bit_istrue(settings.flags,BITFLAG_INVERT_LIMIT_PINS)); printPgmString(PSTR(" (invert limit pins, bool)\r\n$24=")); printInteger(bit_istrue(settings.flags,BITFLAG_SOFT_LIMIT_ENABLE)); printPgmString(PSTR(" (soft limits, bool)\r\n$25=")); printInteger(bit_istrue(settings.flags,BITFLAG_HARD_LIMIT_ENABLE)); printPgmString(PSTR(" (hard limits, bool)\r\n$26=")); printInteger(bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)); printPgmString(PSTR(" (homing cycle, bool)\r\n$27=")); printInteger(settings.homing_dir_mask); printPgmString(PSTR(" (homing dir invert mask:")); print_uint8_base2(settings.homing_dir_mask); printPgmString(PSTR(")\r\n$28=")); printFloat(settings.homing_feed_rate); printPgmString(PSTR(" (homing feed, mm/min)\r\n$29=")); printFloat(settings.homing_seek_rate); printPgmString(PSTR(" (homing seek, mm/min)\r\n$30=")); printInteger(settings.homing_debounce_delay); printPgmString(PSTR(" (homing debounce, msec)\r\n$31=")); printFloat(settings.homing_pulloff); printPgmString(PSTR(" (homing pull-off, mm)\r\n")); }
void settings_dump() { printPgmString(PSTR("$0 = ")); printFloat(settings.steps_per_mm[X_AXIS]); printPgmString(PSTR(" (steps/mm x)\r\n$1 = ")); printFloat(settings.steps_per_mm[Y_AXIS]); printPgmString(PSTR(" (steps/mm y)\r\n$2 = ")); printFloat(settings.steps_per_mm[Z_AXIS]); printPgmString(PSTR(" (steps/mm z)\r\n$3 = ")); printInteger(settings.pulse_microseconds); printPgmString(PSTR(" (microseconds step pulse)\r\n$4 = ")); printFloat(settings.default_feed_rate); printPgmString(PSTR(" (mm/min default feed rate)\r\n$5 = ")); printFloat(settings.default_seek_rate); printPgmString(PSTR(" (mm/min default seek rate)\r\n$6 = ")); printFloat(settings.mm_per_arc_segment); printPgmString(PSTR(" (mm/arc segment)\r\n$7 = ")); printInteger(settings.invert_mask); printPgmString(PSTR(" (step port invert mask. binary = ")); print_uint8_base2(settings.invert_mask); printPgmString(PSTR(")\r\n$8 = ")); printFloat(settings.acceleration/(60*60)); // Convert from mm/min^2 for human readability printPgmString(PSTR(" (acceleration in mm/sec^2)\r\n$9 = ")); printFloat(settings.junction_deviation); printPgmString(PSTR(" (cornering junction deviation in mm)"));//\r\n$10 = ")); // printInteger(settings.auto_start); // printPgmString(PSTR(" (auto-start boolean)")); printPgmString(PSTR("\r\n'$x=value' to set parameter or just '$' to dump current settings\r\n")); }
void settings_dump() { printPgmString(PSTR("$VERSION = ")); printPgmString(PSTR(GRBL_VERSION " " GRBL_AXIS)); printPgmString(PSTR("\r\n")); printPgmString(PSTR("$0 = ")); printFloat(settings.steps_per_mm[X_AXIS]); printPgmString(PSTR(" (steps/mm x)\r\n")); printPgmString(PSTR("$1 = ")); printFloat(settings.steps_per_mm[Y_AXIS]); printPgmString(PSTR(" (steps/mm y)\r\n")); printPgmString(PSTR("$2 = ")); printFloat(settings.steps_per_mm[Z_AXIS]); printPgmString(PSTR(" (steps/mm z)\r\n")); /// 845 : axis X, Y, Z, U, V, W /// axis U, V, W #if (AXIS_T_TYPE == LINEAR) printPgmString(PSTR("$3 = ")); printFloat(settings.steps_per_mm[T_AXIS]); #if AXIS_T == AXIS_U printPgmString(PSTR(" (steps/mm u)\r\n")); #elif AXIS_T == AXIS_V printPgmString(PSTR(" (steps/mm v)\r\n")); #elif AXIS_T == AXIS_W printPgmString(PSTR(" (steps/mm w)\r\n")); #endif #else /// axis A, B, C printPgmString(PSTR("$3 = ")); printFloat(settings.steps_per_degree[T_AXIS]); #if AXIS_T == AXIS_A printPgmString(PSTR(" (steps/deg. a)\r\n")); #elif AXIS_T == AXIS_B printPgmString(PSTR(" (steps/deg. b)\r\n")); #elif AXIS_T == AXIS_C printPgmString(PSTR(" (steps/deg. C)\r\n")); #endif #endif printPgmString(PSTR("$4 = ")); printInteger(settings.pulse_microseconds); printPgmString(PSTR(" (microseconds step pulse)\r\n")); printPgmString(PSTR("$5 = ")); printFloat(settings.default_feed_rate); printPgmString(PSTR(" (mm/min default feed rate)\r\n")); printPgmString(PSTR("$6 = ")); printFloat(settings.default_seek_rate); printPgmString(PSTR(" (mm/min default seek rate)\r\n")); printPgmString(PSTR("$7 = ")); printFloat(settings.mm_per_arc_segment); printPgmString(PSTR(" (mm/arc segment)\r\n")); printPgmString(PSTR("$8 = ")); printInteger(settings.invert_mask_stepdir); printPgmString(PSTR(" (step port invert mask. binary = ")); print_uint8_base2(settings.invert_mask_stepdir); printPgmString(PSTR(")\r\n")); printPgmString(PSTR("$9 = ")); printInteger(settings.invert_mask_limit); printPgmString(PSTR(" (step port invert mask limit. binary = ")); print_uint8_base2(settings.invert_mask_limit); printPgmString(PSTR(")\r\n")); printPgmString(PSTR("$10 = ")); printFloat(settings.acceleration/(60*60)); printPgmString(PSTR(" (acceleration in mm/sec^2)\r\n")); printPgmString(PSTR("$11 = ")); printFloat(settings.junction_deviation); printPgmString(PSTR(" (cornering junction deviation in mm)\r\n")); printPgmString(PSTR("$12 = ")); printInteger(settings.spindle_pwm); printPgmString(PSTR(" (PWM on Spindle: 0 = disabled, 1 = enabled)\r\n")); printPgmString(PSTR("$13 = ")); printFloat(settings.default_spindle); printPgmString(PSTR(" (default spindle speed in RPM)\r\n")); printPgmString(PSTR("$14 = ")); printFloat(settings.max_spindle); printPgmString(PSTR(" (maximum spindle speed in RPM)\r\n")); printPgmString(PSTR("$1000 = ")); printInteger(st_is_enabled()); printPgmString(PSTR(" (steppers: 0 = disabled, 1 = enabled)\r\n")); printPgmString(PSTR("\r\n'$x=value' to set parameter or just '$' to dump current settings\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, 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_realtime_status() { // **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). Eventually // to be added are distance to go on block, processed block id, and feed rate. Also a settings bitmask // for a user to select the desired real-time data. 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]; // Report current machine state switch (sys.state) { case STATE_IDLE: printPgmString(PSTR("<Idle")); break; case STATE_MOTION_CANCEL: // Report run state. case STATE_CYCLE: printPgmString(PSTR("<Run")); break; case STATE_HOLD: printPgmString(PSTR("<Hold")); 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_SAFETY_DOOR: printPgmString(PSTR("<Door")); break; } // If reporting a position, convert the current step count (current_position) to millimeters. if (bit_istrue(settings.status_report_mask,(BITFLAG_RT_STATUS_MACHINE_POSITION | BITFLAG_RT_STATUS_WORK_POSITION))) { system_convert_array_steps_to_mpos(print_position,current_position); } // Report machine position if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_MACHINE_POSITION)) { printPgmString(PSTR(",MPos:")); for (idx=0; idx< N_AXIS; idx++) { printFloat_CoordValue(print_position[idx]); if (idx < (N_AXIS-1)) { printPgmString(PSTR(",")); } } } // Report work position if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_WORK_POSITION)) { printPgmString(PSTR(",WPos:")); for (idx=0; idx< N_AXIS; idx++) { // Apply work coordinate offsets and tool length offset to current position. print_position[idx] -= gc_state.coord_system[idx]+gc_state.coord_offset[idx]; if (idx == TOOL_LENGTH_OFFSET_AXIS) { print_position[idx] -= gc_state.tool_length_offset; } printFloat_CoordValue(print_position[idx]); if (idx < (N_AXIS-1)) { printPgmString(PSTR(",")); } } } // Returns the number of active blocks are in the planner buffer. if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_PLANNER_BUFFER)) { printPgmString(PSTR(",Buf:")); print_uint8_base10(plan_get_block_buffer_count()); } // Report serial read buffer status if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_SERIAL_RX)) { printPgmString(PSTR(",RX:")); print_uint8_base10(serial_get_rx_buffer_count()); } #ifdef USE_LINE_NUMBERS // Report current line number printPgmString(PSTR(",Ln:")); int32_t ln=0; plan_block_t * pb = plan_get_current_block(); if(pb != NULL) { ln = pb->line_number; } printInteger(ln); #endif #ifdef REPORT_REALTIME_RATE // Report realtime rate printPgmString(PSTR(",F:")); printFloat_RateValue(st_get_realtime_rate()); #endif if (bit_istrue(settings.status_report_mask,BITFLAG_RT_STATUS_LIMIT_PINS)) { printPgmString(PSTR(",Lim:")); print_unsigned_int8(limits_get_state(),2,N_AXIS); } #ifdef REPORT_CONTROL_PIN_STATE printPgmString(PSTR(",Ctl:")); print_uint8_base2(CONTROL_PIN & CONTROL_MASK); #endif printPgmString(PSTR(">\r\n")); }