Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Menu homing feedrate displays incorrectly #27513

Closed
1 task done
ellensp opened this issue Nov 5, 2024 · 8 comments
Closed
1 task done

[BUG] Menu homing feedrate displays incorrectly #27513

ellensp opened this issue Nov 5, 2024 · 8 comments

Comments

@ellensp
Copy link
Contributor

ellensp commented Nov 5, 2024

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

The Menu homing feedrate displays incorrectly

Bug Timeline

since #27456

Expected behavior

This menus should list each axis and its feedrate using " LSTR MSG_HOMING_FEEDRATE_N = _UxGT("@ Homing Feedrate");"

Screenshot from 2024-11-05 19-24-12

Actual behavior

This menus list the same axis over but lists the correct feedrate
I've seen 3 lines of the label X Homing Feedrate, and I have seen 3 lines of the label Y Homing Feedrate

Screenshot from 2024-11-05 17-19-00

Steps to Reproduce

  1. Install Emulator example config
  2. Add #define EDITABLE_HOMING_FEEDRATE
  3. Build and run
  4. look at the menu, note it is not displaying the axis label correctly.

Version of Marlin Firmware

Bugfix-2.1.x

Printer model

Simulated

Electronics

Simulated

LCD/Controller

REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

Sim Configuration.zip

@ellensp
Copy link
Contributor Author

ellensp commented Nov 5, 2024

a quick fix (but I dropped the Inch support)

diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp
index d7eeab3cb3..3042e2f7b5 100644
--- a/Marlin/src/lcd/menu/menu_configuration.cpp
+++ b/Marlin/src/lcd/menu/menu_configuration.cpp
@@ -408,22 +408,8 @@ void menu_advanced_settings();
     START_MENU();
     BACK_ITEM(MSG_HOMING_FEEDRATE);
 
-    #if ENABLED(MENUS_ALLOW_INCH_UNITS)
-      #define _EDIT_HOMING_FR(A) do{ \
-        const float maxfr = MMS_TO_MMM(planner.settings.max_feedrate_mm_s[_AXIS(A)]); \
-        editable.decimal = A##_AXIS_UNIT(homing_feedrate_mm_m.A); \
-        EDIT_ITEM(float5, MSG_HOMING_FEEDRATE_N, &editable.decimal, \
-          A##_AXIS_UNIT(10), A##_AXIS_UNIT(maxfr), []{ \
-          homing_feedrate_mm_m.A = parser.axis_value_to_mm(_AXIS(A), editable.decimal); \
-        }); \
-      }while(0);
-    #else
-      #define _EDIT_HOMING_FR(A) do{ \
-        EDIT_ITEM(float5, MSG_HOMING_FEEDRATE_N, &homing_feedrate_mm_m.A, 10, MMS_TO_MMM(planner.settings.max_feedrate_mm_s[_AXIS(A)])); \
-      }while(0);
-    #endif
-
-    MAIN_AXIS_MAP(_EDIT_HOMING_FR);
+    LOOP_NUM_AXES(a)
+      EDIT_ITEM_FAST_N(float5, a, MSG_HOMING_FEEDRATE_N, &homing_feedrate_mm_m[a], MMS_TO_MMM(planner.settings.min_feedrate_mm_s), MMS_TO_MMM(planner.settings.max_feedrate_mm_s[a]));
 
     END_MENU();
   }

@ellensp
Copy link
Contributor Author

ellensp commented Nov 5, 2024

refactor idea.

There a number of strings of the form _X, _Y, _Z,_E and _N

But if we have _N why do we have the rest when they could be created in code?
(Code may be larger that stored strings.. if so there best keep it as is)

@classicrocker883
Copy link
Contributor

I thought it was homing_feedrate_mm_m.a, not homing_feedrate_mm_m[a], how does that work?

@ellensp
Copy link
Contributor Author

ellensp commented Nov 6, 2024

union

template<typename T>
struct XYZval {
  union {
    #if NUM_AXES
      struct { NUM_AXIS_CODE(T x, T y, T z, T i, T j, T k, T u, T v, T w); };
      struct { NUM_AXIS_CODE(T X, T Y, T Z, T I, T J, T K, T U, T V, T W); };
      struct { NUM_AXIS_CODE(T a, T b, T c, T _i, T _j, T _k, T _u, T _v, T _w); };
      struct { NUM_AXIS_CODE(T A, T B, T C, T II, T JJ, T KK, T UU, T VV, T WW); };
    #endif
    T pos[NUM_AXES];
  };

and homing_feedrate_mm_m.a cannot work as a is an interger

no such things as homing_feedrate_mm_m.0 or homing_feedrate_mm_m.1 etc
its homing_feedrate_mm_m.x, homing_feedrate_mm_m.y etc

@classicrocker883
Copy link
Contributor

classicrocker883 commented Nov 8, 2024

or how about:

    #else
      #define _EDIT_HOMING_FR(A)  \
        EDIT_ITEM_FAST_N(float5, _AXIS(A), MSG_HOMING_FEEDRATE_N, &homing_feedrate_mm_m.A, MMS_TO_MMM(planner.settings.min_feedrate_mm_s), MMS_TO_MMM(planner.settings.max_feedrate_mm_s[_AXIS(A)]));
    #endif

    MAIN_AXIS_MAP(_EDIT_HOMING_FR);

this works, but for Z it shows 3000 when it should be 300?

edit: fixed above with .A

@ellensp
Copy link
Contributor Author

ellensp commented Nov 8, 2024

that uses &homing_feedrate_mm_m.x, so only the x homing feedrate value is is displayed and edited

@classicrocker883
Copy link
Contributor

thanks, with that edit it works perfectly

@ellensp
Copy link
Contributor Author

ellensp commented Nov 8, 2024

Extended it to also work in inch mode and PR created

@ellensp ellensp closed this as completed Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants