Browse Source

🚸 Improve Tramming Wizard usability (#22672)

Jason Smith 3 years ago
parent
commit
485a186467
No account linked to committer's email address

+ 1
- 0
Marlin/src/lcd/extui/example/example.cpp View File

@@ -120,6 +120,7 @@ namespace ExtUI {
120 120
     void onPidTuning(const result_t rst) {
121 121
       // Called for temperature PID tuning result
122 122
       switch (rst) {
123
+        case PID_STARTED:          break;
123 124
         case PID_BAD_EXTRUDER_NUM: break;
124 125
         case PID_TEMP_TOO_HIGH:    break;
125 126
         case PID_TUNING_TIMEOUT:   break;

+ 16
- 12
Marlin/src/lcd/menu/menu_tramming.cpp View File

@@ -39,8 +39,10 @@
39 39
 //#define DEBUG_OUT 1
40 40
 #include "../../core/debug_out.h"
41 41
 
42
-float z_measured[G35_PROBE_COUNT] = { 0 };
42
+static float z_measured[G35_PROBE_COUNT];
43
+static bool z_isvalid[G35_PROBE_COUNT];
43 44
 static uint8_t tram_index = 0;
45
+static int8_t reference_index; // = 0
44 46
 
45 47
 #if HAS_LEVELING
46 48
   #include "../../feature/bedlevel/bedlevel.h"
@@ -50,32 +52,31 @@ static bool probe_single_point() {
50 52
   do_blocking_move_to_z(TERN(BLTOUCH, Z_CLEARANCE_DEPLOY_PROBE, Z_CLEARANCE_BETWEEN_PROBES));
51 53
   // Stow after each point with BLTouch "HIGH SPEED" mode for push-pin safety
52 54
   const float z_probed_height = probe.probe_at_point(tramming_points[tram_index], TERN(BLTOUCH_HS_MODE, PROBE_PT_STOW, PROBE_PT_RAISE), 0, true);
53
-  DEBUG_ECHOLNPAIR("probe_single_point: ", z_probed_height, "mm");
54 55
   z_measured[tram_index] = z_probed_height;
56
+  if (reference_index < 0) reference_index = tram_index;
55 57
   move_to_tramming_wait_pos();
56 58
 
57
-  return !isnan(z_probed_height);
59
+  DEBUG_ECHOLNPAIR("probe_single_point(", tram_index, ") = ", z_probed_height, "mm");
60
+  return (z_isvalid[tram_index] = !isnan(z_probed_height));
58 61
 }
59 62
 
60
-static void _menu_single_probe(const uint8_t point) {
61
-  tram_index = point;
62
-  DEBUG_ECHOLNPAIR("Screen: single probe screen Arg:", point);
63
+static void _menu_single_probe() {
64
+  DEBUG_ECHOLNPAIR("Screen: single probe screen Arg:", tram_index);
63 65
   START_MENU();
64 66
   STATIC_ITEM(MSG_BED_TRAMMING, SS_LEFT);
65
-  STATIC_ITEM(MSG_LAST_VALUE_SP, SS_LEFT, ftostr42_52(z_measured[0] - z_measured[point])); // Print diff
67
+  STATIC_ITEM(MSG_LAST_VALUE_SP, SS_LEFT, z_isvalid[tram_index] ? ftostr42_52(z_measured[reference_index] - z_measured[tram_index]) : "---");
66 68
   ACTION_ITEM(MSG_UBL_BC_INSERT2, []{ if (probe_single_point()) ui.refresh(); });
67
-  ACTION_ITEM(MSG_BUTTON_DONE, []{ ui.goto_previous_screen(); }); // Back
69
+  ACTION_ITEM(MSG_BUTTON_DONE, []{ ui.goto_previous_screen(); });
68 70
   END_MENU();
69 71
 }
70 72
 
71 73
 static void tramming_wizard_menu() {
72
-  DEBUG_ECHOLNPAIR("Screen: tramming_wizard_menu");
73 74
   START_MENU();
74 75
   STATIC_ITEM(MSG_SELECT_ORIGIN);
75 76
 
76 77
   // Draw a menu item for each tramming point
77
-  LOOP_L_N(i, G35_PROBE_COUNT)
78
-    SUBMENU_N_P(i, (char*)pgm_read_ptr(&tramming_point_name[i]), []{ _menu_single_probe(MenuItemBase::itemIndex); });
78
+  for (tram_index = 0; tram_index < G35_PROBE_COUNT; tram_index++)
79
+    SUBMENU_P((char*)pgm_read_ptr(&tramming_point_name[tram_index]), _menu_single_probe);
79 80
 
80 81
   ACTION_ITEM(MSG_BUTTON_DONE, []{
81 82
     probe.stow(); // Stow before exiting Tramming Wizard
@@ -87,9 +88,12 @@ static void tramming_wizard_menu() {
87 88
 // Init the wizard and enter the submenu
88 89
 void goto_tramming_wizard() {
89 90
   DEBUG_ECHOLNPAIR("Screen: goto_tramming_wizard", 1);
90
-  tram_index = 0;
91 91
   ui.defer_status_screen();
92 92
 
93
+  // Initialize measured point flags
94
+  ZERO(z_isvalid);
95
+  reference_index = -1;
96
+
93 97
   // Inject G28, wait for homing to complete,
94 98
   set_all_unhomed();
95 99
   queue.inject_P(TERN(CAN_SET_LEVELING_AFTER_G28, PSTR("G28L0"), G28_STR));

+ 1
- 1
buildroot/tests/DUE View File

@@ -15,7 +15,7 @@ opt_set MOTHERBOARD BOARD_RAMPS4DUE_EFB \
15 15
         TEMP_SENSOR_CHAMBER 3 TEMP_CHAMBER_PIN 6 HEATER_CHAMBER_PIN 45
16 16
 opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS \
17 17
            FIX_MOUNTED_PROBE Z_SAFE_HOMING CODEPENDENT_XY_HOMING \
18
-           ASSISTED_TRAMMING ASSISTED_TRAMMING_WIZARD REPORT_TRAMMING_MM ASSISTED_TRAMMING_WAIT_POSITION \
18
+           ASSISTED_TRAMMING REPORT_TRAMMING_MM ASSISTED_TRAMMING_WAIT_POSITION \
19 19
            EEPROM_SETTINGS SDSUPPORT BINARY_FILE_TRANSFER \
20 20
            BLINKM PCA9533 PCA9632 RGB_LED RGB_LED_R_PIN RGB_LED_G_PIN RGB_LED_B_PIN LED_CONTROL_MENU \
21 21
            NEOPIXEL_LED NEOPIXEL_PIN CASE_LIGHT_ENABLE CASE_LIGHT_USE_NEOPIXEL CASE_LIGHT_USE_RGB_LED CASE_LIGHT_MENU \

+ 1
- 0
buildroot/tests/LPC1768 View File

@@ -42,6 +42,7 @@ opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EEB \
42 42
 opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \
43 43
            FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY PID_EXTRUSION_SCALING SOUND_MENU_ITEM \
44 44
            NOZZLE_AS_PROBE AUTO_BED_LEVELING_BILINEAR PREHEAT_BEFORE_LEVELING G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
45
+           ASSISTED_TRAMMING ASSISTED_TRAMMING_WIZARD REPORT_TRAMMING_MM ASSISTED_TRAMMING_WAIT_POSITION \
45 46
            BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \
46 47
            PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \
47 48
            Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \

Loading…
Cancel
Save