Skip to content

Commit 7d751a2

Browse files
✨ Status Screen flow adjustment (MarlinFirmware#26627)
1 parent 9f7d5bb commit 7d751a2

File tree

5 files changed

+38
-3
lines changed

5 files changed

+38
-3
lines changed

Marlin/Configuration_adv.h

+1
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,7 @@
14741474
#if IS_ULTIPANEL
14751475
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
14761476
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
1477+
//#define ULTIPANEL_FLOWPERCENT // Encoder sets the flow percentage on the Status Screen
14771478
#endif
14781479
#endif
14791480

Marlin/src/inc/Conditionals_LCD.h

+1
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@
972972
#define DETECT_I2C_LCD_DEVICE 1
973973
#endif
974974

975+
// Encoder behavior
975976
#ifndef STD_ENCODER_PULSES_PER_STEP
976977
#if ENABLED(TOUCH_SCREEN)
977978
#define STD_ENCODER_PULSES_PER_STEP 2

Marlin/src/inc/SanityCheck.h

+4
Original file line numberDiff line numberDiff line change
@@ -4147,6 +4147,10 @@ static_assert(WITHIN(MULTISTEPPING_LIMIT, 1, 128) && IS_POWER_OF_2(MULTISTEPPING
41474147
#endif
41484148
#endif
41494149

4150+
#if ALL(ULTIPANEL_FEEDMULTIPLY, ULTIPANEL_FLOWPERCENT)
4151+
#error "Only enable ULTIPANEL_FEEDMULTIPLY or ULTIPANEL_FLOWPERCENT, but not both."
4152+
#endif
4153+
41504154
// Misc. Cleanup
41514155
#undef _TEST_PWM
41524156
#undef _NUM_AXES_STR

Marlin/src/lcd/dogm/status_screen_DOGM.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,12 @@ void MarlinUI::draw_status_screen() {
888888
lcd_put_lchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
889889

890890
set_font(FONT_STATUSMENU);
891-
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
891+
892+
#if ENABLED(ULTIPANEL_FLOWPERCENT)
893+
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(planner.flow_percentage[active_extruder]));
894+
#else
895+
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
896+
#endif
892897
lcd_put_u8str(F("%"));
893898

894899
//

Marlin/src/lcd/marlinui.cpp

+26-2
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ void MarlinUI::init() {
700700
else
701701
new_frm = old_frm;
702702
}
703-
else if ((old_frm < 100 && new_frm > 100) || (old_frm > 100 && new_frm < 100))
703+
else if ((old_frm < 100) == (new_frm > 100)) // Crossing 100? Stick at 100.
704704
new_frm = 100;
705705

706706
LIMIT(new_frm, SPEED_EDIT_MIN, SPEED_EDIT_MAX);
@@ -720,7 +720,31 @@ void MarlinUI::init() {
720720
#endif
721721
}
722722

723-
#endif // ULTIPANEL_FEEDMULTIPLY
723+
#elif ENABLED(ULTIPANEL_FLOWPERCENT)
724+
725+
const int16_t old_fp = planner.flow_percentage[active_extruder];
726+
int16_t new_fp = old_fp + int16_t(encoderPosition);
727+
728+
// Dead zone at 100% flow percentage
729+
if (old_fp == 100) {
730+
if (int16_t(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
731+
new_fp -= ENCODER_FEEDRATE_DEADZONE;
732+
else if (int16_t(encoderPosition) < -(ENCODER_FEEDRATE_DEADZONE))
733+
new_fp += ENCODER_FEEDRATE_DEADZONE;
734+
else
735+
new_fp = old_fp;
736+
}
737+
else if ((old_fp < 100) == (new_fp > 100)) // Crossing 100? Stick at 100.
738+
new_fp = 100;
739+
740+
LIMIT(new_fp, FLOW_EDIT_MIN, FLOW_EDIT_MAX);
741+
742+
if (old_fp != new_fp) {
743+
planner.set_flow(active_extruder, new_fp);
744+
encoderPosition = 0;
745+
}
746+
747+
#endif // ULTIPANEL_FLOWPERCENT
724748

725749
draw_status_screen();
726750
}

0 commit comments

Comments
 (0)