Skip to content

Commit

Permalink
Consistent Probe XY offset type
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Nov 24, 2020
1 parent e9431b5 commit 296a2ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/gcode/calibrate/G76_M192_M871.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void GcodeSuite::G76() {

const xyz_pos_t parkpos = temp_comp.park_point,
probe_pos_xyz = xyz_pos_t(temp_comp.measure_point) + xyz_pos_t({ 0.0f, 0.0f, PTC_PROBE_HEATING_OFFSET }),
noz_pos_xyz = probe_pos_xyz - xy_pos_t(probe.offset_xy); // Nozzle position based on probe position
noz_pos_xyz = probe_pos_xyz - probe.offset_xy; // Nozzle position based on probe position

if (do_bed_cal || do_probe_cal) {
// Ensure park position is reachable
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Probe probe;
xyz_pos_t Probe::offset; // Initialized by settings.load()

#if HAS_PROBE_XY_OFFSET
const xyz_pos_t &Probe::offset_xy = Probe::offset;
const xy_pos_t &Probe::offset_xy = xy_pos_t(Probe::offset);

This comment has been minimized.

Copy link
@daleckystepan

daleckystepan Nov 25, 2020

Contributor

Here is the issue. Probe::offset is copied and then referenced instead of just referenced.

This comment has been minimized.

Copy link
@discip

discip Nov 26, 2020

Contributor

@daleckystepan
Are you addressing the issue pointed out by @Yannik25?
If so, would someone please correct this?

Could you please tell, what the correct code should look like, for the time being?
thanks in advance

This comment has been minimized.

Copy link
@tpruvot

tpruvot Nov 26, 2020

Contributor

This comment was marked as resolved.

Copy link
@swissnorp

swissnorp Nov 26, 2020

Contributor

I am no coder but may it would be worth testing replace
const xy_pos_t &Probe::offset_xy = xy_pos_t(Probe::offset);
by
const xy_pos_t &Probe::offset_xy = xy_pos_t(offset);

This comment has been minimized.

Copy link
@tpruvot

tpruvot Nov 26, 2020

Contributor

no, the goal here is to take the pointer/address of the offset struct/variable, maybe xy_pos_t() copy it in a temporary variable

#endif

#if ENABLED(Z_PROBE_SLED)
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/module/probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ class Probe {
FORCE_INLINE static bool good_bounds(const xy_pos_t &lf, const xy_pos_t &rb) {
return (
#if IS_KINEMATIC
can_reach(lf.x, 0) && can_reach(rb.x, 0) && can_reach(0, lf.y) && can_reach(0, rb.y)
can_reach(lf.x, 0) && can_reach(rb.x, 0) && can_reach(0, lf.y) && can_reach(0, rb.y)
#else
can_reach(lf) && can_reach(rb)
can_reach(lf) && can_reach(rb)
#endif
);
}

// Use offset_xy for read only access
// More optimal the XY offset is known to always be zero.
#if HAS_PROBE_XY_OFFSET
static const xyz_pos_t &offset_xy;
static const xy_pos_t &offset_xy;
#else
static constexpr xy_pos_t offset_xy = xy_pos_t({ 0, 0 }); // See #16767
#endif
Expand Down

4 comments on commit 296a2ad

@Yannik25
Copy link

@Yannik25 Yannik25 commented on 296a2ad Nov 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @thinkyhead
I have an Ender 3 with a cheetah v1.2b PCB.
I have pulled the latest bugfix-2.0.x from 25.11.2020 and with this commit, my offsets in all directions set from the BLTouch to the nozzle are ignored.
When I undo changes made to this commit, the offset is working again.

@discip
Copy link
Contributor

@discip discip commented on 296a2ad Nov 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is some one able to solve this please?

@leoavilagg
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perdon si mi mensaje esta fuera de contexto, pero este post lo visite para solucionar un problema con el m851 que no podia configurar en la eeprom, tengo un sensor sn04-n y con las siguientes lineas pude habilitarlo para editar:

en Configuration.h

#define FIX_MOUNTED_PROBE
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
#define AUTO_BED_LEVELING_BILINEAR
Z_MIN_PROBE_ENDSTOP_INVERTING TRUE
#define Z_AFTER_HOMING 15

@thisiskeithb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Issue Queue is for Marlin bug reports and development-related issues, and we prefer not to handle user-support questions here. (As noted on this page.) For best results getting help with configuration and troubleshooting, please use the following resources:

After seeking help from the community, if the consensus points to a bug in Marlin, then you should post a bug report.

Please sign in to comment.