Browse Source

Support DISTINCT_E_FACTORS in LCD Motion Menu

Scott Lahteine 7 years ago
parent
commit
4bafdf4b66
1 changed files with 85 additions and 3 deletions
  1. 85
    3
      Marlin/ultralcd.cpp

+ 85
- 3
Marlin/ultralcd.cpp View File

@@ -1850,7 +1850,35 @@ void kill_screen(const char* lcd_msg) {
1850 1850
   void lcd_control_temperature_preheat_material2_settings_menu() { _lcd_control_temperature_preheat_settings_menu(1); }
1851 1851
 
1852 1852
   void _reset_acceleration_rates() { planner.reset_acceleration_rates(); }
1853
+  #if ENABLED(DISTINCT_E_FACTORS)
1854
+    void _reset_e_acceleration_rate(const uint8_t e) { if (e == active_extruder) _reset_acceleration_rates(); }
1855
+    void _reset_e0_acceleration_rate() { _reset_e_acceleration_rate(0); }
1856
+    void _reset_e1_acceleration_rate() { _reset_e_acceleration_rate(1); }
1857
+    #if E_STEPPERS > 2
1858
+      void _reset_e2_acceleration_rate() { _reset_e_acceleration_rate(2); }
1859
+      #if E_STEPPERS > 3
1860
+        void _reset_e3_acceleration_rate() { _reset_e_acceleration_rate(3); }
1861
+      #endif
1862
+    #endif
1863
+  #endif
1864
+
1853 1865
   void _planner_refresh_positioning() { planner.refresh_positioning(); }
1866
+  #if ENABLED(DISTINCT_E_FACTORS)
1867
+    void _planner_refresh_e_positioning(const uint8_t e) {
1868
+      if (e == active_extruder)
1869
+        _planner_refresh_positioning();
1870
+      else
1871
+        planner.steps_to_mm[i] = 1.0 / planner.axis_steps_per_mm[i];
1872
+    }
1873
+    void _planner_refresh_e0_positioning() { _reset_e_acceleration_rate(0); }
1874
+    void _planner_refresh_e1_positioning() { _reset_e_acceleration_rate(1); }
1875
+    #if E_STEPPERS > 2
1876
+      void _planner_refresh_e2_positioning() { _reset_e_acceleration_rate(2); }
1877
+      #if E_STEPPERS > 3
1878
+        void _planner_refresh_e3_positioning() { _reset_e_acceleration_rate(3); }
1879
+      #endif
1880
+    #endif
1881
+  #endif
1854 1882
 
1855 1883
   /**
1856 1884
    *
@@ -1876,22 +1904,76 @@ void kill_screen(const char* lcd_msg) {
1876 1904
       MENU_ITEM_EDIT(float52, MSG_VZ_JERK, &planner.max_jerk[Z_AXIS], 0.1, 990);
1877 1905
     #endif
1878 1906
     MENU_ITEM_EDIT(float3, MSG_VE_JERK, &planner.max_jerk[E_AXIS], 1, 990);
1907
+
1908
+    //
1909
+    // M203 Settings
1910
+    //
1879 1911
     MENU_ITEM_EDIT(float3, MSG_VMAX MSG_X, &planner.max_feedrate_mm_s[X_AXIS], 1, 999);
1880 1912
     MENU_ITEM_EDIT(float3, MSG_VMAX MSG_Y, &planner.max_feedrate_mm_s[Y_AXIS], 1, 999);
1881 1913
     MENU_ITEM_EDIT(float3, MSG_VMAX MSG_Z, &planner.max_feedrate_mm_s[Z_AXIS], 1, 999);
1882
-    MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.max_feedrate_mm_s[E_AXIS], 1, 999);
1914
+
1915
+    #if ENABLED(DISTINCT_E_FACTORS)
1916
+      MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.max_feedrate_mm_s[E_AXIS + active_extruder], 1, 999);
1917
+      MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E1, &planner.max_feedrate_mm_s[E_AXIS], 1, 999);
1918
+      MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E2, &planner.max_feedrate_mm_s[E_AXIS + 1], 1, 999);
1919
+      #if E_STEPPERS > 2
1920
+        MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E3, &planner.max_feedrate_mm_s[E_AXIS + 2], 1, 999);
1921
+        #if E_STEPPERS > 3
1922
+          MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E3, &planner.max_feedrate_mm_s[E_AXIS + 3], 1, 999);
1923
+        #endif
1924
+      #endif
1925
+    #else
1926
+      MENU_ITEM_EDIT(float3, MSG_VMAX MSG_E, &planner.max_feedrate_mm_s[E_AXIS], 1, 999);
1927
+    #endif
1928
+
1883 1929
     MENU_ITEM_EDIT(float3, MSG_VMIN, &planner.min_feedrate_mm_s, 0, 999);
1884 1930
     MENU_ITEM_EDIT(float3, MSG_VTRAV_MIN, &planner.min_travel_feedrate_mm_s, 0, 999);
1931
+
1932
+    //
1933
+    // M201 Settings
1934
+    //
1885 1935
     MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_X, &planner.max_acceleration_mm_per_s2[X_AXIS], 100, 99000, _reset_acceleration_rates);
1886 1936
     MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Y, &planner.max_acceleration_mm_per_s2[Y_AXIS], 100, 99000, _reset_acceleration_rates);
1887 1937
     MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_Z, &planner.max_acceleration_mm_per_s2[Z_AXIS], 10, 99000, _reset_acceleration_rates);
1888
-    MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_acceleration_rates);
1938
+
1939
+    #if ENABLED(DISTINCT_E_FACTORS)
1940
+      MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS + active_extruder], 100, 99000, _reset_acceleration_rates);
1941
+      MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E1, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_e0_acceleration_rate);
1942
+      MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E2, &planner.max_acceleration_mm_per_s2[E_AXIS + 1], 100, 99000, _reset_e1_acceleration_rate);
1943
+      #if E_STEPPERS > 2
1944
+        MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E3, &planner.max_acceleration_mm_per_s2[E_AXIS + 2], 100, 99000, _reset_e2_acceleration_rate);
1945
+        #if E_STEPPERS > 3
1946
+          MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E4, &planner.max_acceleration_mm_per_s2[E_AXIS + 3], 100, 99000, _reset_e3_acceleration_rate);
1947
+        #endif
1948
+      #endif
1949
+    #else
1950
+      MENU_ITEM_EDIT_CALLBACK(long5, MSG_AMAX MSG_E, &planner.max_acceleration_mm_per_s2[E_AXIS], 100, 99000, _reset_acceleration_rates);
1951
+    #endif
1952
+
1889 1953
     MENU_ITEM_EDIT(float5, MSG_A_RETRACT, &planner.retract_acceleration, 100, 99000);
1890 1954
     MENU_ITEM_EDIT(float5, MSG_A_TRAVEL, &planner.travel_acceleration, 100, 99000);
1955
+
1956
+    //
1957
+    // M92 Settings
1958
+    //
1891 1959
     MENU_ITEM_EDIT_CALLBACK(float62, MSG_XSTEPS, &planner.axis_steps_per_mm[X_AXIS], 5, 9999, _planner_refresh_positioning);
1892 1960
     MENU_ITEM_EDIT_CALLBACK(float62, MSG_YSTEPS, &planner.axis_steps_per_mm[Y_AXIS], 5, 9999, _planner_refresh_positioning);
1893 1961
     MENU_ITEM_EDIT_CALLBACK(float62, MSG_ZSTEPS, &planner.axis_steps_per_mm[Z_AXIS], 5, 9999, _planner_refresh_positioning);
1894
-    MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning);
1962
+
1963
+    #if ENABLED(DISTINCT_E_FACTORS)
1964
+      MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS + active_extruder], 5, 9999, _planner_refresh_positioning);
1965
+      MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS MSG_E1, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_e0_positioning);
1966
+      MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS MSG_E2, &planner.axis_steps_per_mm[E_AXIS + 1], 5, 9999, _planner_refresh_e1_positioning);
1967
+      #if E_STEPPERS > 2
1968
+        MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS MSG_E3, &planner.axis_steps_per_mm[E_AXIS + 2], 5, 9999, _planner_refresh_e2_positioning);
1969
+        #if E_STEPPERS > 3
1970
+          MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS MSG_E4, &planner.axis_steps_per_mm[E_AXIS + 3], 5, 9999, _planner_refresh_e3_positioning);
1971
+        #endif
1972
+      #endif
1973
+    #else
1974
+      MENU_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning);
1975
+    #endif
1976
+
1895 1977
     #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
1896 1978
       MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &stepper.abort_on_endstop_hit);
1897 1979
     #endif

Loading…
Cancel
Save