Merge pull request #4011 from thinkyhead/rc_manual_move_cond
Wrap all items depending on ULTIPANEL
This commit is contained in:
commit
d50ba08246
2 changed files with 1591 additions and 1577 deletions
|
@ -29,6 +29,47 @@
|
|||
#include "stepper.h"
|
||||
#include "configuration_store.h"
|
||||
|
||||
int plaPreheatHotendTemp;
|
||||
int plaPreheatHPBTemp;
|
||||
int plaPreheatFanSpeed;
|
||||
|
||||
int absPreheatHotendTemp;
|
||||
int absPreheatHPBTemp;
|
||||
int absPreheatFanSpeed;
|
||||
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
||||
millis_t previous_lcd_status_ms = 0;
|
||||
#endif
|
||||
|
||||
uint8_t lcd_status_message_level;
|
||||
char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
|
||||
|
||||
#if ENABLED(DOGLCD)
|
||||
#include "dogm_lcd_implementation.h"
|
||||
#else
|
||||
#include "ultralcd_implementation_hitachi_HD44780.h"
|
||||
#endif
|
||||
|
||||
// The main status screen
|
||||
static void lcd_status_screen();
|
||||
|
||||
millis_t next_lcd_update_ms;
|
||||
|
||||
enum LCDViewAction {
|
||||
LCDVIEW_NONE,
|
||||
LCDVIEW_REDRAW_NOW,
|
||||
LCDVIEW_CALL_REDRAW_NEXT,
|
||||
LCDVIEW_CLEAR_CALL_REDRAW,
|
||||
LCDVIEW_CALL_NO_REDRAW
|
||||
};
|
||||
|
||||
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
|
||||
// place-holders for Ki and Kd edits
|
||||
float raw_Ki, raw_Kd;
|
||||
|
||||
/**
|
||||
* REVERSE_MENU_DIRECTION
|
||||
*
|
||||
|
@ -56,35 +97,6 @@ millis_t manual_move_start_time = 0;
|
|||
bool encoderRateMultiplierEnabled;
|
||||
int32_t lastEncoderMovementMillis;
|
||||
|
||||
int plaPreheatHotendTemp;
|
||||
int plaPreheatHPBTemp;
|
||||
int plaPreheatFanSpeed;
|
||||
|
||||
int absPreheatHotendTemp;
|
||||
int absPreheatHPBTemp;
|
||||
int absPreheatFanSpeed;
|
||||
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
||||
millis_t previous_lcd_status_ms = 0;
|
||||
#endif
|
||||
|
||||
// Function pointer to menu functions.
|
||||
typedef void (*menuFunc_t)();
|
||||
|
||||
uint8_t lcd_status_message_level;
|
||||
char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
|
||||
|
||||
#if ENABLED(DOGLCD)
|
||||
#include "dogm_lcd_implementation.h"
|
||||
#else
|
||||
#include "ultralcd_implementation_hitachi_HD44780.h"
|
||||
#endif
|
||||
|
||||
// The main status screen
|
||||
static void lcd_status_screen();
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
|
||||
#if HAS_POWER_SWITCH
|
||||
extern bool powersupply;
|
||||
#endif
|
||||
|
@ -116,11 +128,14 @@ static void lcd_status_screen();
|
|||
#include "mesh_bed_leveling.h"
|
||||
#endif
|
||||
|
||||
/* Different types of actions that can be used in menu items. */
|
||||
// Function pointer to menu functions.
|
||||
typedef void (*screenFunc_t)();
|
||||
|
||||
// Different types of actions that can be used in menu items.
|
||||
static void menu_action_back();
|
||||
static void menu_action_submenu(menuFunc_t data);
|
||||
static void menu_action_submenu(screenFunc_t data);
|
||||
static void menu_action_gcode(const char* pgcode);
|
||||
static void menu_action_function(menuFunc_t data);
|
||||
static void menu_action_function(screenFunc_t data);
|
||||
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
|
||||
static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
|
||||
static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
|
||||
|
@ -130,15 +145,15 @@ static void lcd_status_screen();
|
|||
static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
|
||||
static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
|
||||
static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
|
||||
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, screenFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, screenFunc_t callbackFunc);
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static void lcd_sdcard_menu();
|
||||
|
@ -270,85 +285,67 @@ static void lcd_status_screen();
|
|||
uint8_t lcd_sd_status;
|
||||
#endif
|
||||
|
||||
#endif // ULTIPANEL
|
||||
|
||||
typedef struct {
|
||||
menuFunc_t menu_function;
|
||||
#if ENABLED(ULTIPANEL)
|
||||
screenFunc_t menu_function;
|
||||
uint32_t encoder_position;
|
||||
#endif
|
||||
} menuPosition;
|
||||
|
||||
menuFunc_t currentMenu = lcd_status_screen; // pointer to the currently active menu handler
|
||||
screenFunc_t currentScreen = lcd_status_screen; // pointer to the currently active menu handler
|
||||
|
||||
menuPosition menu_history[10];
|
||||
uint8_t menu_history_depth = 0;
|
||||
menuPosition screen_history[10];
|
||||
uint8_t screen_history_depth = 0;
|
||||
|
||||
millis_t next_lcd_update_ms;
|
||||
bool ignore_click = false;
|
||||
bool wait_for_unclick;
|
||||
bool defer_return_to_status = false;
|
||||
|
||||
enum LCDViewAction {
|
||||
LCDVIEW_NONE,
|
||||
LCDVIEW_REDRAW_NOW,
|
||||
LCDVIEW_CALL_REDRAW_NEXT,
|
||||
LCDVIEW_CLEAR_CALL_REDRAW,
|
||||
LCDVIEW_CALL_NO_REDRAW
|
||||
};
|
||||
|
||||
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
|
||||
|
||||
// Variables used when editing values.
|
||||
const char* editLabel;
|
||||
void* editValue;
|
||||
int32_t minEditValue, maxEditValue;
|
||||
menuFunc_t callbackFunc; // call this after editing
|
||||
|
||||
// place-holders for Ki and Kd edits
|
||||
float raw_Ki, raw_Kd;
|
||||
screenFunc_t callbackFunc; // call this after editing
|
||||
|
||||
/**
|
||||
* General function to go directly to a menu
|
||||
* Remembers the previous position
|
||||
*/
|
||||
static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const uint32_t encoder = 0) {
|
||||
if (currentMenu != menu) {
|
||||
currentMenu = menu;
|
||||
static void lcd_goto_screen(screenFunc_t screen, const bool feedback = false, const uint32_t encoder = 0) {
|
||||
if (currentScreen != screen) {
|
||||
currentScreen = screen;
|
||||
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
||||
#if ENABLED(NEWPANEL)
|
||||
encoderPosition = encoder;
|
||||
if (feedback) lcd_quick_feedback();
|
||||
#endif
|
||||
if (menu == lcd_status_screen) {
|
||||
if (screen == lcd_status_screen) {
|
||||
defer_return_to_status = false;
|
||||
menu_history_depth = 0;
|
||||
screen_history_depth = 0;
|
||||
}
|
||||
#if ENABLED(LCD_PROGRESS_BAR)
|
||||
// For LCD_PROGRESS_BAR re-initialize custom characters
|
||||
lcd_set_custom_characters(menu == lcd_status_screen);
|
||||
lcd_set_custom_characters(screen == lcd_status_screen);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); }
|
||||
static void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
|
||||
|
||||
inline void lcd_save_previous_menu() {
|
||||
if (menu_history_depth < COUNT(menu_history)) {
|
||||
menu_history[menu_history_depth].menu_function = currentMenu;
|
||||
if (screen_history_depth < COUNT(screen_history)) {
|
||||
screen_history[screen_history_depth].menu_function = currentScreen;
|
||||
#if ENABLED(ULTIPANEL)
|
||||
menu_history[menu_history_depth].encoder_position = encoderPosition;
|
||||
screen_history[screen_history_depth].encoder_position = encoderPosition;
|
||||
#endif
|
||||
++menu_history_depth;
|
||||
++screen_history_depth;
|
||||
}
|
||||
}
|
||||
|
||||
static void lcd_goto_previous_menu(bool feedback=false) {
|
||||
if (menu_history_depth > 0) {
|
||||
--menu_history_depth;
|
||||
lcd_goto_menu(menu_history[menu_history_depth].menu_function, feedback
|
||||
if (screen_history_depth > 0) {
|
||||
--screen_history_depth;
|
||||
lcd_goto_screen(screen_history[screen_history_depth].menu_function, feedback
|
||||
#if ENABLED(ULTIPANEL)
|
||||
, menu_history[menu_history_depth].encoder_position
|
||||
, screen_history[screen_history_depth].encoder_position
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
@ -356,6 +353,13 @@ static void lcd_goto_previous_menu(bool feedback=false) {
|
|||
lcd_return_to_status();
|
||||
}
|
||||
|
||||
void lcd_ignore_click(bool b) {
|
||||
ignore_click = b;
|
||||
wait_for_unclick = false;
|
||||
}
|
||||
|
||||
#endif // ULTIPANEL
|
||||
|
||||
/**
|
||||
*
|
||||
* "Info Screen"
|
||||
|
@ -364,8 +368,11 @@ static void lcd_goto_previous_menu(bool feedback=false) {
|
|||
*/
|
||||
|
||||
static void lcd_status_screen() {
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
ENCODER_DIRECTION_NORMAL();
|
||||
encoderRateMultiplierEnabled = false;
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_PROGRESS_BAR)
|
||||
millis_t ms = millis();
|
||||
|
@ -421,10 +428,10 @@ static void lcd_status_screen() {
|
|||
}
|
||||
|
||||
if (current_click) {
|
||||
lcd_goto_menu(lcd_main_menu, true);
|
||||
lcd_goto_screen(lcd_main_menu, true);
|
||||
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
|
||||
#if ENABLED(LCD_PROGRESS_BAR)
|
||||
currentMenu == lcd_status_screen
|
||||
#if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
|
||||
currentScreen == lcd_status_screen
|
||||
#endif
|
||||
);
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
||||
|
@ -466,9 +473,9 @@ inline void line_to_current(AxisEnum axis) {
|
|||
#if ENABLED(DELTA)
|
||||
calculate_delta(current_position);
|
||||
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
|
||||
#else
|
||||
#else // !DELTA
|
||||
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
|
||||
#endif
|
||||
#endif // !DELTA
|
||||
}
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
@ -487,7 +494,7 @@ inline void line_to_current(AxisEnum axis) {
|
|||
stepper.quick_stop();
|
||||
#if DISABLED(DELTA) && DISABLED(SCARA)
|
||||
set_current_position_from_planner();
|
||||
#endif
|
||||
#endif // !DELTA && !SCARA
|
||||
clear_command_queue();
|
||||
card.sdprinting = false;
|
||||
card.closefile();
|
||||
|
@ -581,11 +588,11 @@ void lcd_set_home_offsets() {
|
|||
#if ENABLED(BABYSTEP_XY)
|
||||
static void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
|
||||
static void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); }
|
||||
static void lcd_babystep_x() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_x); }
|
||||
static void lcd_babystep_y() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_y); }
|
||||
static void lcd_babystep_x() { babysteps_done = 0; lcd_goto_screen(_lcd_babystep_x); }
|
||||
static void lcd_babystep_y() { babysteps_done = 0; lcd_goto_screen(_lcd_babystep_y); }
|
||||
#endif
|
||||
static void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEPPING_Z)); }
|
||||
static void lcd_babystep_z() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_z); }
|
||||
static void lcd_babystep_z() { babysteps_done = 0; lcd_goto_screen(_lcd_babystep_z); }
|
||||
|
||||
#endif //BABYSTEPPING
|
||||
|
||||
|
@ -963,7 +970,7 @@ void lcd_cooldown() {
|
|||
debounce_click = true; // ignore multiple "clicks" in a row
|
||||
mbl.set_zigzag_z(_lcd_level_bed_position++, current_position[Z_AXIS]);
|
||||
if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
|
||||
lcd_goto_menu(_lcd_level_bed_done, true);
|
||||
lcd_goto_screen(_lcd_level_bed_done, true);
|
||||
|
||||
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
|
||||
#if MIN_Z_HEIGHT_FOR_HOMING > 0
|
||||
|
@ -983,7 +990,7 @@ void lcd_cooldown() {
|
|||
#endif
|
||||
}
|
||||
else {
|
||||
lcd_goto_menu(_lcd_level_goto_next_point, true);
|
||||
lcd_goto_screen(_lcd_level_goto_next_point, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1024,7 +1031,7 @@ void lcd_cooldown() {
|
|||
*/
|
||||
static void _lcd_level_goto_next_point() {
|
||||
// Set the menu to display ahead of blocking call
|
||||
lcd_goto_menu(_lcd_level_bed_moving);
|
||||
lcd_goto_screen(_lcd_level_bed_moving);
|
||||
|
||||
// _mbl_goto_xy runs the menu loop until the move is done
|
||||
int8_t px, py;
|
||||
|
@ -1032,7 +1039,7 @@ void lcd_cooldown() {
|
|||
_mbl_goto_xy(mbl.get_probe_x(px), mbl.get_probe_y(py));
|
||||
|
||||
// After the blocking function returns, change menus
|
||||
lcd_goto_menu(_lcd_level_bed_get_z);
|
||||
lcd_goto_screen(_lcd_level_bed_get_z);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1045,7 +1052,7 @@ void lcd_cooldown() {
|
|||
_lcd_level_bed_position = 0;
|
||||
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
||||
planner.set_position_mm(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
lcd_goto_menu(_lcd_level_goto_next_point, true);
|
||||
lcd_goto_screen(_lcd_level_goto_next_point, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1069,7 @@ void lcd_cooldown() {
|
|||
#endif
|
||||
;
|
||||
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
|
||||
lcd_goto_menu(_lcd_level_bed_homing_done);
|
||||
lcd_goto_screen(_lcd_level_bed_homing_done);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1073,7 +1080,7 @@ void lcd_cooldown() {
|
|||
axis_homed[X_AXIS] = axis_homed[Y_AXIS] = axis_homed[Z_AXIS] = false;
|
||||
mbl.reset();
|
||||
enqueue_and_echo_commands_P(PSTR("G28"));
|
||||
lcd_goto_menu(_lcd_level_bed_homing);
|
||||
lcd_goto_screen(_lcd_level_bed_homing);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1861,7 +1868,7 @@ static void lcd_control_volumetric_menu() {
|
|||
* void menu_edit_callback_int3(); // edit int (interactively) with callback on completion
|
||||
* static void _menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
|
||||
* static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
|
||||
* static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callback); // edit int with callback
|
||||
* static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, screenFunc_t callback); // edit int with callback
|
||||
*
|
||||
* You can then use one of the menu macros to present the edit interface:
|
||||
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_multiplier, 10, 999)
|
||||
|
@ -1903,11 +1910,11 @@ static void lcd_control_volumetric_menu() {
|
|||
} \
|
||||
static void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
|
||||
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
|
||||
currentMenu = menu_edit_ ## _name; \
|
||||
currentScreen = menu_edit_ ## _name; \
|
||||
}\
|
||||
static void menu_action_setting_edit_callback_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue, menuFunc_t callback) { \
|
||||
static void menu_action_setting_edit_callback_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue, screenFunc_t callback) { \
|
||||
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
|
||||
currentMenu = menu_edit_callback_ ## _name; \
|
||||
currentScreen = menu_edit_callback_ ## _name; \
|
||||
callbackFunc = callback; \
|
||||
}
|
||||
menu_edit_type(int, int3, itostr3, 1);
|
||||
|
@ -1992,9 +1999,9 @@ void lcd_quick_feedback() {
|
|||
*
|
||||
*/
|
||||
static void menu_action_back() { lcd_goto_previous_menu(); }
|
||||
static void menu_action_submenu(menuFunc_t func) { lcd_save_previous_menu(); lcd_goto_menu(func); }
|
||||
static void menu_action_submenu(screenFunc_t func) { lcd_save_previous_menu(); lcd_goto_screen(func); }
|
||||
static void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); }
|
||||
static void menu_action_function(menuFunc_t func) { (*func)(); }
|
||||
static void menu_action_function(screenFunc_t func) { (*func)(); }
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
|
@ -2013,7 +2020,7 @@ static void menu_action_function(menuFunc_t func) { (*func)(); }
|
|||
#endif //SDSUPPORT
|
||||
|
||||
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) {UNUSED(pstr); *ptr = !(*ptr); }
|
||||
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) {
|
||||
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callback) {
|
||||
menu_action_setting_edit_bool(pstr, ptr);
|
||||
(*callback)();
|
||||
}
|
||||
|
@ -2158,13 +2165,12 @@ bool lcd_blink() {
|
|||
* No worries. This function is only called from the main thread.
|
||||
*/
|
||||
void lcd_update() {
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
static millis_t return_to_status_ms = 0;
|
||||
|
||||
manage_manual_move();
|
||||
#endif
|
||||
|
||||
|
||||
lcd_buttons_update();
|
||||
|
||||
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
|
||||
|
@ -2173,8 +2179,8 @@ void lcd_update() {
|
|||
if (sd_status != lcd_sd_status && lcd_detected()) {
|
||||
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
||||
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
|
||||
#if ENABLED(LCD_PROGRESS_BAR)
|
||||
currentMenu == lcd_status_screen
|
||||
#if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
|
||||
currentScreen == lcd_status_screen
|
||||
#endif
|
||||
);
|
||||
|
||||
|
@ -2272,7 +2278,11 @@ void lcd_update() {
|
|||
// We arrive here every ~100ms when idling often enough.
|
||||
// Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
|
||||
static int8_t lcd_status_update_delay = 1; // first update one loop delayed
|
||||
if (currentMenu == lcd_status_screen && !lcd_status_update_delay--) {
|
||||
if (
|
||||
#if ENABLED(ULTIPANEL)
|
||||
currentScreen == lcd_status_screen &&
|
||||
#endif
|
||||
!lcd_status_update_delay--) {
|
||||
lcd_status_update_delay = 9;
|
||||
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||
}
|
||||
|
@ -2301,17 +2311,25 @@ void lcd_update() {
|
|||
u8g.setColorIndex(dot_color); // Set color for the alive dot
|
||||
u8g.drawPixel(127, 63); // draw alive dot
|
||||
u8g.setColorIndex(1); // black on white
|
||||
(*currentMenu)();
|
||||
#if ENABLED(ULTIPANEL)
|
||||
(*currentScreen)();
|
||||
#else
|
||||
lcd_status_screen();
|
||||
#endif
|
||||
} while (u8g.nextPage());
|
||||
#else
|
||||
(*currentMenu)();
|
||||
#if ENABLED(ULTIPANEL)
|
||||
(*currentScreen)();
|
||||
#else
|
||||
lcd_status_screen();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
|
||||
// Return to Status Screen after a timeout
|
||||
if (currentMenu == lcd_status_screen || defer_return_to_status)
|
||||
if (currentScreen == lcd_status_screen || defer_return_to_status)
|
||||
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
||||
else if (ELAPSED(ms, return_to_status_ms))
|
||||
lcd_return_to_status();
|
||||
|
@ -2334,11 +2352,6 @@ void lcd_update() {
|
|||
}
|
||||
}
|
||||
|
||||
void lcd_ignore_click(bool b) {
|
||||
ignore_click = b;
|
||||
wait_for_unclick = false;
|
||||
}
|
||||
|
||||
void lcd_finishstatus(bool persist=false) {
|
||||
#if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
|
||||
UNUSED(persist);
|
||||
|
|
|
@ -61,8 +61,11 @@
|
|||
#define LCD_TIMEOUT_TO_STATUS 15000
|
||||
|
||||
#if ENABLED(ULTIPANEL)
|
||||
void lcd_buttons_update();
|
||||
extern volatile uint8_t buttons; //the last checked buttons in a bit array.
|
||||
void lcd_buttons_update();
|
||||
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
|
||||
bool lcd_clicked();
|
||||
void lcd_ignore_click(bool b=true);
|
||||
#else
|
||||
FORCE_INLINE void lcd_buttons_update() {}
|
||||
#endif
|
||||
|
@ -79,12 +82,10 @@
|
|||
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
||||
extern millis_t previous_lcd_status_ms;
|
||||
#endif
|
||||
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
|
||||
bool lcd_clicked();
|
||||
void lcd_ignore_click(bool b=true);
|
||||
|
||||
bool lcd_blink();
|
||||
|
||||
#if ENABLED(ULTIPANEL) && ENABLED(REPRAPWORLD_KEYPAD)
|
||||
#if ENABLED(REPRAPWORLD_KEYPAD)
|
||||
|
||||
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
|
||||
|
||||
|
@ -114,7 +115,7 @@
|
|||
#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)
|
||||
#define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)
|
||||
|
||||
#endif //ULTIPANEL && REPRAPWORLD_KEYPAD
|
||||
#endif // REPRAPWORLD_KEYPAD
|
||||
|
||||
#if ENABLED(NEWPANEL)
|
||||
|
||||
|
|
Reference in a new issue