Skip to content

Commit

Permalink
Configurable XZ probing point on Z Offset menu (fixes bigtreetech#1363)…
Browse files Browse the repository at this point in the history
  • Loading branch information
digant73 authored Dec 24, 2020
1 parent 5e44b38 commit 7c43a71
Show file tree
Hide file tree
Showing 15 changed files with 245 additions and 135 deletions.
11 changes: 11 additions & 0 deletions Copy to SD Card root directory to update/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,17 @@ lcd_idle_delay:4
#
print_summary:1

#### XY Offset Probing Support
# Used by Z Offset menu when the Z offset tuning process is started.
# It allows to move the nozzle to the defined (on Marlin FW) XY probing point set for homing.
# The nozzle is moved applying the XY offset configured on Marlin FW.
# Disable it in case the XY probing point set for homing is not reacheable by the nozzle
# (e.g. due to HW limitations/constraints or printer specific configuration)
#
# Options: [enable: 1, disable: 0]
#
xy_offset_probing:1


#--------------------------------------------------------------------
# Custom Gcode Commands
Expand Down
10 changes: 6 additions & 4 deletions TFT/src/User/API/ProbeHeightControl.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ void probeHeightEnable(void)

if (curSoftwareEndstops) // if software endstops is enabled, disable it temporary
mustStoreCmd("M211 S0\n"); // disable software endstops to move nozzle minus Zero (Z0) if necessary

#ifdef RepRapFirmware
if(infoMachineSettings.isMarlinFirmware == 0)
if (infoMachineSettings.isMarlinFirmware == 0)
{
mustStoreCmd("M564 S0 H0\n");
}
Expand All @@ -29,12 +30,13 @@ void probeHeightDisable(void)
{
if (curSoftwareEndstops) // if software endstops was originally enabled, enable it again
mustStoreCmd("M211 S1\n"); // enable software endstops
#ifdef RepRapFirmware
if(infoMachineSettings.isMarlinFirmware == 0)

#ifdef RepRapFirmware
if (infoMachineSettings.isMarlinFirmware == 0)
{
mustStoreCmd("M564 S1 H1\n");
}
#endif
#endif
}

/* Start probe height */
Expand Down
21 changes: 15 additions & 6 deletions TFT/src/User/API/ProbeOffsetControl.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ void probeOffsetEnable(bool skipZOffset)
// Z offset gcode sequence start
mustStoreCmd("G28\n"); // home printer

probeHeightStop(); // raise nozzle
if (infoSettings.xy_offset_probing) // if HW allows nozzle to reach XY probing point
{
probeHeightStop(); // raise nozzle

mustStoreCmd("G91\n"); // set relative position mode
mustStoreCmd("G1 X%.2f Y%.2f F%d\n",
getParameter(P_PROBE_OFFSET, X_STEPPER),
getParameter(P_PROBE_OFFSET, Y_STEPPER),
infoSettings.axis_speed[infoSettings.move_speed]); // move nozzle to XY probing coordinates and set feedrate
mustStoreCmd("G91\n"); // set relative position mode

mustStoreCmd("G1 X%.2f Y%.2f F%d\n",
getParameter(P_PROBE_OFFSET, X_STEPPER),
getParameter(P_PROBE_OFFSET, Y_STEPPER),
infoSettings.axis_speed[infoSettings.move_speed]); // move nozzle to XY probing point and set feedrate
}
else
{
mustStoreCmd("G1 F%d\n",
infoSettings.axis_speed[infoSettings.move_speed]); // set feedrate
}

if (!skipZOffset)
{
Expand Down
1 change: 1 addition & 0 deletions TFT/src/User/API/Settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ void infoSettingsReset(void)
infoSettings.lcd_idle_brightness = DEFAULT_LCD_IDLE_BRIGHTNESS;
infoSettings.lcd_idle_timer = DEFAULT_LCD_IDLE_TIMER;
infoSettings.print_summary = DISPLAY_PRINT_SUMMARY;
infoSettings.xy_offset_probing = ENABLED;

// Start, End & Cancel G-codes
infoSettings.send_start_gcode = DISABLED;
Expand Down
3 changes: 2 additions & 1 deletion TFT/src/User/API/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ enum
#define CONFIG_SUPPPORT 20200810

#define FONT_FLASH_SIGN 20200908 //(YYYYMMDD) change if fonts require updating
#define CONFIG_FLASH_SIGN 20200908 //(YYYYMMDD) change if any keyword(s) in config.ini is added or removed
#define CONFIG_FLASH_SIGN 20201221 //(YYYYMMDD) change if any keyword(s) in config.ini is added or removed
#define LANGUAGE_FLASH_SIGN 20201007 //(YYYYMMDD) change if any keyword(s) in language pack is added or removed
#define ICON_FLASH_SIGN 20201028 //(YYYYMMDD) change if any icon(s) is added or removed

Expand Down Expand Up @@ -167,6 +167,7 @@ typedef struct
uint8_t lcd_idle_brightness;
uint8_t lcd_idle_timer;
uint8_t print_summary;
uint8_t xy_offset_probing;

// Start, End & Cancel G-codes
uint8_t send_start_gcode;
Expand Down
13 changes: 10 additions & 3 deletions TFT/src/User/API/SpeedControl.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ void loopSpeed(void)
{
if (lastSetPercent[i] != setPercent[i] && (OS_GetTimeMs() > nextSpeedTime))
{
if (storeCmd("%s S%d D%d\n",speedCmd[i], setPercent[i], heatGetCurrentTool()))
lastSetPercent[i] = setPercent[i];
if (send_waiting[i] == false)
{
send_waiting[i] = true;
send_waiting[i] = storeCmd("%s S%d D%d\n", speedCmd[i], percent[i], heatGetCurrentTool());
}
if (send_waiting[i] == true)
curPercent[i] = percent[i];
nextSpeedTime = OS_GetTimeMs() + NEXT_SPEED_WAIT; // avoid rapid fire, clogging the queue
}
}
Expand All @@ -55,6 +60,8 @@ void speedQuery(void)
{
if (infoHost.connected && !infoHost.wait && !queryWait)
{
queryWait = storeCmd("M220\nM221 D%d\n",heatGetCurrentTool());
storeCmd("M220\n");
storeCmd("M221 D%d\n", heatGetCurrentTool());
queryWait = true;
}
}
Loading

0 comments on commit 7c43a71

Please sign in to comment.