Add runout menu, small fixes

This commit is contained in:
InsanityAutomation
2022-03-15 12:24:29 -04:00
parent bdca8681a0
commit f3d29fdcb1
3 changed files with 56 additions and 6 deletions
+2 -2
View File
@@ -103,7 +103,7 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Handle a block completion. RunoutResponseDelayed uses this to
// add up the length of filament moved while the filament is out.
static void block_completed(const block_t * const b) {
if (enabled) {
if (enabled[active_extruder]) {
response.block_completed(b);
sensor.block_completed(b);
}
@@ -111,7 +111,7 @@ class TFilamentMonitor : public FilamentMonitorBase {
// Give the response a chance to update its counter.
static void run() {
if (enabled && !filament_ran_out && (printingIsActive() || did_pause_print)) {
if (enabled[active_extruder] && mode[active_extruder]!=0 && !filament_ran_out && (printingIsActive() || did_pause_print)) {
cli(); // Prevent RunoutResponseDelayed::block_completed from accumulating here
response.run();
sensor.run();
+5
View File
@@ -694,6 +694,11 @@ namespace Language_en {
LSTR MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Nozzle: ");
LSTR MSG_RUNOUT_SENSOR = _UxGT("Runout Sensor");
LSTR MSG_RUNOUT_DISTANCE_MM = _UxGT("Runout Dist mm");
LSTR MSG_RUNOUT_MODE = _UxGT("Runout Mode");
LSTR MSG_RUNOUT_MODE_HIGH = _UxGT("Sensor High");
LSTR MSG_RUNOUT_MODE_LOW = _UxGT("Sensor Low");
LSTR MSG_RUNOUT_MODE_MOTION = _UxGT("Motion Encoder");
LSTR MSG_RUNOUT_MODE_NONE = _UxGT("No Sensor");
LSTR MSG_RUNOUT_ENABLE = _UxGT("Enable Runout");
LSTR MSG_RUNOUT_ACTIVE = _UxGT("Runout Active");
LSTR MSG_INVERT_EXTRUDER = _UxGT("Invert Extruder");
+49 -4
View File
@@ -100,6 +100,54 @@ void menu_backlash();
#endif
#if HAS_FILAMENT_SENSOR
#define RUNOUT_EDIT_ITEMS(F) do{ \
EDIT_ITEM_N(bool, F, MSG_RUNOUT_MODE_NONE, &runout.enabled[F]); \
ACTION_ITEM_N(F, MSG_RUNOUT_MODE_NONE, []{ set_runout_mode_none(F);}); \
ACTION_ITEM_N(F, MSG_RUNOUT_MODE_HIGH, []{ set_runout_mode_high(F);}); \
ACTION_ITEM_N(F, MSG_RUNOUT_MODE_LOW, []{ set_runout_mode_low(F);}); \
ACTION_ITEM_N(F, MSG_RUNOUT_MODE_MOTION, []{ set_runout_mode_motion(F);}); \
editable.decimal = runout.runout_distance(F); \
EDIT_ITEM_FAST_N(float3, F, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 999, \
[]{ runout.set_runout_distance(editable.decimal, F); }, true \
); \
}while(0)
void set_runout_mode_none(uint8_t e) { runout.mode[e] = 0; }
void set_runout_mode_high(uint8_t e) { runout.mode[e] = 1; }
void set_runout_mode_low(uint8_t e) { runout.mode[e] = 2; }
void set_runout_mode_motion(uint8_t e) { runout.mode[e] = 7; }
void menu_runout_config() {
START_MENU();
BACK_ITEM(MSG_CONFIGURATION);
RUNOUT_EDIT_ITEMS(0);
#if NUM_RUNOUT_SENSORS > 1
RUNOUT_EDIT_ITEMS(1);
#endif
#if NUM_RUNOUT_SENSORS > 2
RUNOUT_EDIT_ITEMS(2);
#endif
#if NUM_RUNOUT_SENSORS > 3
RUNOUT_EDIT_ITEMS(3);
#endif
#if NUM_RUNOUT_SENSORS > 4
RUNOUT_EDIT_ITEMS(4);
#endif
#if NUM_RUNOUT_SENSORS > 5
RUNOUT_EDIT_ITEMS(5);
#endif
#if NUM_RUNOUT_SENSORS > 6
RUNOUT_EDIT_ITEMS(6);
#endif
#if NUM_RUNOUT_SENSORS > 7
RUNOUT_EDIT_ITEMS(7);
#endif
END_MENU();
}
#endif
#if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
//
// Advanced Settings > Filament
@@ -154,10 +202,7 @@ void menu_backlash();
#endif
#if HAS_FILAMENT_SENSOR
editable.decimal = runout.runout_distance();
EDIT_ITEM_FAST(float3, MSG_RUNOUT_DISTANCE_MM, &editable.decimal, 1, 999,
[]{ runout.set_runout_distance(editable.decimal); }, true
);
SUBMENU(MSG_RUNOUT_MODE, menu_runout_config);
#endif
END_MENU();