0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-02-18 15:21:25 +00:00

Status Screen flow adjustment (#26627)

This commit is contained in:
German Borisov 2024-01-19 22:17:36 +03:00 committed by GitHub
parent 9f7d5bbc86
commit 7d751a20b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 38 additions and 3 deletions

View file

@ -1474,6 +1474,7 @@
#if IS_ULTIPANEL
#define MANUAL_E_MOVES_RELATIVE // Display extruder move distance rather than "position"
#define ULTIPANEL_FEEDMULTIPLY // Encoder sets the feedrate multiplier on the Status Screen
//#define ULTIPANEL_FLOWPERCENT // Encoder sets the flow percentage on the Status Screen
#endif
#endif

View file

@ -972,6 +972,7 @@
#define DETECT_I2C_LCD_DEVICE 1
#endif
// Encoder behavior
#ifndef STD_ENCODER_PULSES_PER_STEP
#if ENABLED(TOUCH_SCREEN)
#define STD_ENCODER_PULSES_PER_STEP 2

View file

@ -4147,6 +4147,10 @@ static_assert(WITHIN(MULTISTEPPING_LIMIT, 1, 128) && IS_POWER_OF_2(MULTISTEPPING
#endif
#endif
#if ALL(ULTIPANEL_FEEDMULTIPLY, ULTIPANEL_FLOWPERCENT)
#error "Only enable ULTIPANEL_FEEDMULTIPLY or ULTIPANEL_FLOWPERCENT, but not both."
#endif
// Misc. Cleanup
#undef _TEST_PWM
#undef _NUM_AXES_STR

View file

@ -888,7 +888,12 @@ void MarlinUI::draw_status_screen() {
lcd_put_lchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
set_font(FONT_STATUSMENU);
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
#if ENABLED(ULTIPANEL_FLOWPERCENT)
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(planner.flow_percentage[active_extruder]));
#else
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
#endif
lcd_put_u8str(F("%"));
//

View file

@ -700,7 +700,7 @@ void MarlinUI::init() {
else
new_frm = old_frm;
}
else if ((old_frm < 100 && new_frm > 100) || (old_frm > 100 && new_frm < 100))
else if ((old_frm < 100) == (new_frm > 100)) // Crossing 100? Stick at 100.
new_frm = 100;
LIMIT(new_frm, SPEED_EDIT_MIN, SPEED_EDIT_MAX);
@ -720,7 +720,31 @@ void MarlinUI::init() {
#endif
}
#endif // ULTIPANEL_FEEDMULTIPLY
#elif ENABLED(ULTIPANEL_FLOWPERCENT)
const int16_t old_fp = planner.flow_percentage[active_extruder];
int16_t new_fp = old_fp + int16_t(encoderPosition);
// Dead zone at 100% flow percentage
if (old_fp == 100) {
if (int16_t(encoderPosition) > ENCODER_FEEDRATE_DEADZONE)
new_fp -= ENCODER_FEEDRATE_DEADZONE;
else if (int16_t(encoderPosition) < -(ENCODER_FEEDRATE_DEADZONE))
new_fp += ENCODER_FEEDRATE_DEADZONE;
else
new_fp = old_fp;
}
else if ((old_fp < 100) == (new_fp > 100)) // Crossing 100? Stick at 100.
new_fp = 100;
LIMIT(new_fp, FLOW_EDIT_MIN, FLOW_EDIT_MAX);
if (old_fp != new_fp) {
planner.set_flow(active_extruder, new_fp);
encoderPosition = 0;
}
#endif // ULTIPANEL_FLOWPERCENT
draw_status_screen();
}