Jyers / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. | Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
http://marlinfw.org
GNU General Public License v3.0
2.14k stars 387 forks source link

NOZZLE_PARK_POINT math not working? #2032

Closed Ergonomicmike closed 2 years ago

Ergonomicmike commented 2 years ago

Description

LCh-77/Marlin/tree/bugfix-2.1.x_JYERSUI-Enhanced Configuration.h for the Creality Ender 3 v2 v4.2.2 Creatliy UI.

A very small nit, which can be worked around simply by setting the correct values in the UI after the firmware has been flashed: The NOZZLE_PARK_POINT values are not adding and subtracting correctly.

Steps to Reproduce

In Configuration.h confirm that

#define Y_BED_SIZE 220
#define X_MIN_POS 0

(for the Ender 3 v2).

Compile.

Expected behavior:

The algebra in the code is

#define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 }

Since Y_MAX_POS is defined as Y_BED_SIZE, here 220 then

Nozzle Park in the UI should default to

0 + 10 = 10 220 - 10 = 210

to show 10, 210, 20 in the UI. (Z is hard set in the code.)

Actual behavior:

240,220,20

Additional Information

I did a search for the term "NOZZLE_PARK_POINT". The search term appears in a lot of files.

I found the problem. NOZZLE_PARK_POINT is defined again in jyenhanced.h with a hard 240,220.20.

I deleted that line and tried to compile. But I received an Error that DEF_NOZZLE_PARK_POINT was not declared in this scope.

Not knowing how to code, this is far as I can take it for now.

Ergonomicmike commented 2 years ago

Thank you. For now I simply changed the value in the hardcod in my jyenhanced.h file to correct values for the Ender 3 v2.

LCh-77 commented 2 years ago

Description

LCh-77/Marlin/tree/bugfix-2.1.x_JYERSUI-Enhanced Configuration.h for the Creality Ender 3 v2 v4.2.2 Creatliy UI.

A very small nit, which can be worked around simply by setting the correct values in the UI after the firmware has been flashed: The NOZZLE_PARK_POINT values are not adding and subtracting correctly.

Great find!, That bug is similar to this: https://github.com/mriscoc/Ender3V2S1/issues/316

// In configuration.h define your default park point (Line 2265):
#define NOZZLE_PARK_POINT { 0, 220, 40 } 

// In jyenhanced.h change the definition of DEF_NOZZLE_PARK_POINT (Line 42):
constexpr xyz_int_t DEF_NOZZLE_PARK_POINT = NOZZLE_PARK_POINT;

// In dwin.cpp change the assignation of default value (Line 6417): 
eeprom_settings.Park_point = DEF_NOZZLE_PARK_POINT;

I will correct the code now. Thank you!

As a side note, that will not fix the math calculation of the NOZZLE_PARK_POINT in reference to BED_SIZE because the parking point is calculated at compilation time, that is, if you change the bed size later, the parkpoint will NOT be updated.

LCh-77 commented 2 years ago

Mmm, you don't know how constexpr works... Jyers is the author of the firmware, others are mere contributors...

ttf3