Wrap all items depending on ULTIPANEL
This commit is contained in:
parent
bf8710d522
commit
45ea8749d3
@ -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,7 +128,10 @@ 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 (*menuFunc_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_gcode(const char* pgcode);
|
||||
@ -270,13 +285,9 @@ static void lcd_status_screen();
|
||||
uint8_t lcd_sd_status;
|
||||
#endif
|
||||
|
||||
#endif // ULTIPANEL
|
||||
|
||||
typedef struct {
|
||||
menuFunc_t menu_function;
|
||||
#if ENABLED(ULTIPANEL)
|
||||
uint32_t encoder_position;
|
||||
#endif
|
||||
} menuPosition;
|
||||
|
||||
menuFunc_t currentMenu = lcd_status_screen; // pointer to the currently active menu handler
|
||||
@ -284,30 +295,16 @@ menuFunc_t currentMenu = lcd_status_screen; // pointer to the currently active m
|
||||
menuPosition menu_history[10];
|
||||
uint8_t menu_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;
|
||||
|
||||
/**
|
||||
* General function to go directly to a menu
|
||||
* Remembers the previous position
|
||||
@ -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();
|
||||
@ -423,7 +430,7 @@ static void lcd_status_screen() {
|
||||
if (current_click) {
|
||||
lcd_goto_menu(lcd_main_menu, true);
|
||||
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
|
||||
#if ENABLED(LCD_PROGRESS_BAR)
|
||||
#if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
|
||||
currentMenu == lcd_status_screen
|
||||
#endif
|
||||
);
|
||||
@ -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();
|
||||
@ -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,7 +2179,7 @@ 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)
|
||||
#if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
|
||||
currentMenu == 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)
|
||||
currentMenu == lcd_status_screen &&
|
||||
#endif
|
||||
!lcd_status_update_delay--) {
|
||||
lcd_status_update_delay = 9;
|
||||
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||
}
|
||||
@ -2301,10 +2311,18 @@ 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
|
||||
#if ENABLED(ULTIPANEL)
|
||||
(*currentMenu)();
|
||||
#else
|
||||
lcd_status_screen();
|
||||
#endif
|
||||
} while (u8g.nextPage());
|
||||
#else
|
||||
#if ENABLED(ULTIPANEL)
|
||||
(*currentMenu)();
|
||||
#else
|
||||
lcd_status_screen();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user