|
@ -25,10 +25,6 @@ int absPreheatFanSpeed; |
|
|
unsigned long message_millis = 0; |
|
|
unsigned long message_millis = 0; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef ULTIPANEL |
|
|
|
|
|
static float manual_feedrate[] = MANUAL_FEEDRATE; |
|
|
|
|
|
#endif // ULTIPANEL
|
|
|
|
|
|
|
|
|
|
|
|
/* !Configuration settings */ |
|
|
/* !Configuration settings */ |
|
|
|
|
|
|
|
|
//Function pointer to menu functions.
|
|
|
//Function pointer to menu functions.
|
|
@ -38,193 +34,197 @@ uint8_t lcd_status_message_level; |
|
|
char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG; |
|
|
char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG; |
|
|
|
|
|
|
|
|
#ifdef DOGLCD |
|
|
#ifdef DOGLCD |
|
|
#include "dogm_lcd_implementation.h" |
|
|
#include "dogm_lcd_implementation.h" |
|
|
#else |
|
|
#else |
|
|
#include "ultralcd_implementation_hitachi_HD44780.h" |
|
|
#include "ultralcd_implementation_hitachi_HD44780.h" |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
/* Different menus */ |
|
|
// The main status screen
|
|
|
static void lcd_status_screen(); |
|
|
static void lcd_status_screen(); |
|
|
#ifdef ULTIPANEL |
|
|
|
|
|
extern bool powersupply; |
|
|
|
|
|
static void lcd_main_menu(); |
|
|
|
|
|
static void lcd_tune_menu(); |
|
|
|
|
|
static void lcd_prepare_menu(); |
|
|
|
|
|
static void lcd_move_menu(); |
|
|
|
|
|
static void lcd_control_menu(); |
|
|
|
|
|
static void lcd_control_temperature_menu(); |
|
|
|
|
|
static void lcd_control_temperature_preheat_pla_settings_menu(); |
|
|
|
|
|
static void lcd_control_temperature_preheat_abs_settings_menu(); |
|
|
|
|
|
static void lcd_control_motion_menu(); |
|
|
|
|
|
static void lcd_control_volumetric_menu(); |
|
|
|
|
|
#ifdef DOGLCD |
|
|
|
|
|
static void lcd_set_contrast(); |
|
|
|
|
|
#endif |
|
|
|
|
|
#ifdef FWRETRACT |
|
|
|
|
|
static void lcd_control_retract_menu(); |
|
|
|
|
|
#endif |
|
|
|
|
|
static void lcd_sdcard_menu(); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DELTA_CALIBRATION_MENU |
|
|
#ifdef ULTIPANEL |
|
|
static void lcd_delta_calibrate_menu(); |
|
|
|
|
|
#endif // DELTA_CALIBRATION_MENU
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(MANUAL_BED_LEVELING) |
|
|
|
|
|
#include "mesh_bed_leveling.h" |
|
|
|
|
|
static void _lcd_level_bed(); |
|
|
|
|
|
static void _lcd_level_bed_homing(); |
|
|
|
|
|
static void lcd_level_bed(); |
|
|
|
|
|
#endif // MANUAL_BED_LEVELING
|
|
|
|
|
|
|
|
|
|
|
|
static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
|
|
|
extern bool powersupply; |
|
|
|
|
|
static float manual_feedrate[] = MANUAL_FEEDRATE; |
|
|
/* Different types of actions that can be used in menu items. */ |
|
|
static void lcd_main_menu(); |
|
|
static void menu_action_back(menuFunc_t data); |
|
|
static void lcd_tune_menu(); |
|
|
static void menu_action_submenu(menuFunc_t data); |
|
|
static void lcd_prepare_menu(); |
|
|
static void menu_action_gcode(const char* pgcode); |
|
|
static void lcd_move_menu(); |
|
|
static void menu_action_function(menuFunc_t data); |
|
|
static void lcd_control_menu(); |
|
|
static void menu_action_sdfile(const char* filename, char* longFilename); |
|
|
static void lcd_control_temperature_menu(); |
|
|
static void menu_action_sddirectory(const char* filename, char* longFilename); |
|
|
static void lcd_control_temperature_preheat_pla_settings_menu(); |
|
|
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr); |
|
|
static void lcd_control_temperature_preheat_abs_settings_menu(); |
|
|
static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue); |
|
|
static void lcd_control_motion_menu(); |
|
|
static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue); |
|
|
static void lcd_control_volumetric_menu(); |
|
|
static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue); |
|
|
#ifdef DOGLCD |
|
|
static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue); |
|
|
static void lcd_set_contrast(); |
|
|
static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue); |
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
#define ENCODER_FEEDRATE_DEADZONE 10 |
|
|
|
|
|
|
|
|
|
|
|
#if !defined(LCD_I2C_VIKI) |
|
|
|
|
|
#ifndef ENCODER_STEPS_PER_MENU_ITEM |
|
|
|
|
|
#define ENCODER_STEPS_PER_MENU_ITEM 5 |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
#ifndef ENCODER_PULSES_PER_STEP |
|
|
#ifdef FWRETRACT |
|
|
#define ENCODER_PULSES_PER_STEP 1 |
|
|
static void lcd_control_retract_menu(); |
|
|
#endif |
|
|
#endif |
|
|
#else |
|
|
static void lcd_sdcard_menu(); |
|
|
#ifndef ENCODER_STEPS_PER_MENU_ITEM |
|
|
|
|
|
#define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
|
|
|
#ifdef DELTA_CALIBRATION_MENU |
|
|
|
|
|
static void lcd_delta_calibrate_menu(); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if defined(MANUAL_BED_LEVELING) |
|
|
|
|
|
#include "mesh_bed_leveling.h" |
|
|
|
|
|
static void _lcd_level_bed(); |
|
|
|
|
|
static void _lcd_level_bed_homing(); |
|
|
|
|
|
static void lcd_level_bed(); |
|
|
#endif |
|
|
#endif |
|
|
#ifndef ENCODER_PULSES_PER_STEP |
|
|
|
|
|
#define ENCODER_PULSES_PER_STEP 1 |
|
|
static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
|
|
|
|
|
|
|
|
|
|
|
|
/* Different types of actions that can be used in menu items. */ |
|
|
|
|
|
static void menu_action_back(menuFunc_t data); |
|
|
|
|
|
static void menu_action_submenu(menuFunc_t data); |
|
|
|
|
|
static void menu_action_gcode(const char* pgcode); |
|
|
|
|
|
static void menu_action_function(menuFunc_t data); |
|
|
|
|
|
static void menu_action_sdfile(const char* filename, char* longFilename); |
|
|
|
|
|
static void menu_action_sddirectory(const char* filename, char* longFilename); |
|
|
|
|
|
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); |
|
|
|
|
|
static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue); |
|
|
|
|
|
static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue); |
|
|
|
|
|
static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue); |
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
#define ENCODER_FEEDRATE_DEADZONE 10 |
|
|
|
|
|
|
|
|
|
|
|
#if !defined(LCD_I2C_VIKI) |
|
|
|
|
|
#ifndef ENCODER_STEPS_PER_MENU_ITEM |
|
|
|
|
|
#define ENCODER_STEPS_PER_MENU_ITEM 5 |
|
|
|
|
|
#endif |
|
|
|
|
|
#ifndef ENCODER_PULSES_PER_STEP |
|
|
|
|
|
#define ENCODER_PULSES_PER_STEP 1 |
|
|
|
|
|
#endif |
|
|
|
|
|
#else |
|
|
|
|
|
#ifndef ENCODER_STEPS_PER_MENU_ITEM |
|
|
|
|
|
#define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
|
|
|
|
|
|
#endif |
|
|
|
|
|
#ifndef ENCODER_PULSES_PER_STEP |
|
|
|
|
|
#define ENCODER_PULSES_PER_STEP 1 |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Helper macros for menus */ |
|
|
/* Helper macros for menus */ |
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* START_MENU generates the init code for a menu function |
|
|
|
|
|
*/ |
|
|
|
|
|
#define START_MENU() do { \ |
|
|
|
|
|
encoderRateMultiplierEnabled = false; \ |
|
|
|
|
|
if (encoderPosition > 0x8000) encoderPosition = 0; \ |
|
|
|
|
|
uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \ |
|
|
|
|
|
if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \ |
|
|
|
|
|
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ |
|
|
|
|
|
bool wasClicked = LCD_CLICKED, itemSelected; \ |
|
|
|
|
|
if (wasClicked) lcd_quick_feedback(); \ |
|
|
|
|
|
for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \ |
|
|
|
|
|
_menuItemNr = 0; |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* MENU_ITEM generates draw & handler code for a menu item, potentially calling: |
|
|
|
|
|
* |
|
|
|
|
|
* lcd_implementation_drawmenu_[type](sel, row, label, arg3...) |
|
|
|
|
|
* menu_action_[type](arg3...) |
|
|
|
|
|
* |
|
|
|
|
|
* Examples: |
|
|
|
|
|
* MENU_ITEM(back, MSG_WATCH, lcd_status_screen) |
|
|
|
|
|
* lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen) |
|
|
|
|
|
* menu_action_back(lcd_status_screen) |
|
|
|
|
|
* |
|
|
|
|
|
* MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause) |
|
|
|
|
|
* lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause) |
|
|
|
|
|
* menu_action_function(lcd_sdcard_pause) |
|
|
|
|
|
* |
|
|
|
|
|
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999) |
|
|
|
|
|
* MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedmultiply, 10, 999) |
|
|
|
|
|
* lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedmultiply, 10, 999) |
|
|
|
|
|
* menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedmultiply, 10, 999) |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
#define MENU_ITEM(type, label, args...) do { \ |
|
|
|
|
|
if (_menuItemNr == _lineNr) { \ |
|
|
|
|
|
itemSelected = encoderLine == _menuItemNr; \ |
|
|
|
|
|
if (lcdDrawUpdate) \ |
|
|
|
|
|
lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ |
|
|
|
|
|
if (wasClicked && itemSelected) { \ |
|
|
|
|
|
menu_action_ ## type(args); \ |
|
|
|
|
|
return; \ |
|
|
|
|
|
} \ |
|
|
|
|
|
} \ |
|
|
|
|
|
_menuItemNr++; \ |
|
|
|
|
|
} while(0) |
|
|
|
|
|
|
|
|
|
|
|
#ifdef ENCODER_RATE_MULTIPLIER |
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item |
|
|
* START_MENU generates the init code for a menu function |
|
|
*/ |
|
|
*/ |
|
|
#define MENU_MULTIPLIER_ITEM(type, label, args...) do { \ |
|
|
#define START_MENU() do { \ |
|
|
|
|
|
encoderRateMultiplierEnabled = false; \ |
|
|
|
|
|
if (encoderPosition > 0x8000) encoderPosition = 0; \ |
|
|
|
|
|
uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \ |
|
|
|
|
|
if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \ |
|
|
|
|
|
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ |
|
|
|
|
|
bool wasClicked = LCD_CLICKED, itemSelected; \ |
|
|
|
|
|
if (wasClicked) lcd_quick_feedback(); \ |
|
|
|
|
|
for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \ |
|
|
|
|
|
_menuItemNr = 0; |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* MENU_ITEM generates draw & handler code for a menu item, potentially calling: |
|
|
|
|
|
* |
|
|
|
|
|
* lcd_implementation_drawmenu_[type](sel, row, label, arg3...) |
|
|
|
|
|
* menu_action_[type](arg3...) |
|
|
|
|
|
* |
|
|
|
|
|
* Examples: |
|
|
|
|
|
* MENU_ITEM(back, MSG_WATCH, lcd_status_screen) |
|
|
|
|
|
* lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen) |
|
|
|
|
|
* menu_action_back(lcd_status_screen) |
|
|
|
|
|
* |
|
|
|
|
|
* MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause) |
|
|
|
|
|
* lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause) |
|
|
|
|
|
* menu_action_function(lcd_sdcard_pause) |
|
|
|
|
|
* |
|
|
|
|
|
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999) |
|
|
|
|
|
* MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedmultiply, 10, 999) |
|
|
|
|
|
* lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedmultiply, 10, 999) |
|
|
|
|
|
* menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedmultiply, 10, 999) |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
#define MENU_ITEM(type, label, args...) do { \ |
|
|
if (_menuItemNr == _lineNr) { \ |
|
|
if (_menuItemNr == _lineNr) { \ |
|
|
itemSelected = encoderLine == _menuItemNr; \ |
|
|
itemSelected = encoderLine == _menuItemNr; \ |
|
|
if (lcdDrawUpdate) \ |
|
|
if (lcdDrawUpdate) \ |
|
|
lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ |
|
|
lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ |
|
|
if (wasClicked && itemSelected) { \ |
|
|
if (wasClicked && itemSelected) { \ |
|
|
encoderRateMultiplierEnabled = true; \ |
|
|
|
|
|
lastEncoderMovementMillis = 0; \ |
|
|
|
|
|
menu_action_ ## type(args); \ |
|
|
menu_action_ ## type(args); \ |
|
|
return; \ |
|
|
return; \ |
|
|
} \ |
|
|
} \ |
|
|
} \ |
|
|
} \ |
|
|
_menuItemNr++; \ |
|
|
_menuItemNr++; \ |
|
|
} while(0) |
|
|
} while(0) |
|
|
#endif //ENCODER_RATE_MULTIPLIER
|
|
|
|
|
|
|
|
|
#ifdef ENCODER_RATE_MULTIPLIER |
|
|
#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0) |
|
|
/**
|
|
|
#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) |
|
|
* MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item |
|
|
#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) |
|
|
*/ |
|
|
#ifdef ENCODER_RATE_MULTIPLIER |
|
|
#define MENU_MULTIPLIER_ITEM(type, label, args...) do { \ |
|
|
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) |
|
|
if (_menuItemNr == _lineNr) { \ |
|
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) |
|
|
itemSelected = encoderLine == _menuItemNr; \ |
|
|
#else //!ENCODER_RATE_MULTIPLIER
|
|
|
if (lcdDrawUpdate) \ |
|
|
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) |
|
|
lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \ |
|
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) |
|
|
if (wasClicked && itemSelected) { \ |
|
|
#endif //!ENCODER_RATE_MULTIPLIER
|
|
|
encoderRateMultiplierEnabled = true; \ |
|
|
#define END_MENU() \ |
|
|
lastEncoderMovementMillis = 0; \ |
|
|
if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\ |
|
|
menu_action_ ## type(args); \ |
|
|
if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \ |
|
|
return; \ |
|
|
} } while(0) |
|
|
} \ |
|
|
|
|
|
} \ |
|
|
/** Used variables to keep track of the menu */ |
|
|
_menuItemNr++; \ |
|
|
#ifndef REPRAPWORLD_KEYPAD |
|
|
} while(0) |
|
|
volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
|
|
|
#endif //ENCODER_RATE_MULTIPLIER
|
|
|
#else |
|
|
|
|
|
volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shift register values
|
|
|
#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0) |
|
|
#endif |
|
|
#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) |
|
|
#ifdef LCD_HAS_SLOW_BUTTONS |
|
|
#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) |
|
|
volatile uint8_t slow_buttons;//Contains the bits of the currently pressed buttons.
|
|
|
#ifdef ENCODER_RATE_MULTIPLIER |
|
|
#endif |
|
|
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) |
|
|
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */ |
|
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) |
|
|
uint32_t blocking_enc; |
|
|
#else //!ENCODER_RATE_MULTIPLIER
|
|
|
uint8_t lastEncoderBits; |
|
|
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) |
|
|
uint32_t encoderPosition; |
|
|
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) |
|
|
#if (SDCARDDETECT > 0) |
|
|
#endif //!ENCODER_RATE_MULTIPLIER
|
|
|
bool lcd_oldcardstatus; |
|
|
#define END_MENU() \ |
|
|
#endif |
|
|
if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\ |
|
|
#endif //ULTIPANEL
|
|
|
if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \ |
|
|
|
|
|
} } while(0) |
|
|
|
|
|
|
|
|
|
|
|
/** Used variables to keep track of the menu */ |
|
|
|
|
|
#ifndef REPRAPWORLD_KEYPAD |
|
|
|
|
|
volatile uint8_t buttons; // Bits of the pressed buttons.
|
|
|
|
|
|
#else |
|
|
|
|
|
volatile uint8_t buttons_reprapworld_keypad; // The reprapworld_keypad shift register values
|
|
|
|
|
|
#endif |
|
|
|
|
|
#ifdef LCD_HAS_SLOW_BUTTONS |
|
|
|
|
|
volatile uint8_t slow_buttons; // Bits of the pressed buttons.
|
|
|
|
|
|
#endif |
|
|
|
|
|
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */ |
|
|
|
|
|
uint32_t blocking_enc; |
|
|
|
|
|
uint8_t lastEncoderBits; |
|
|
|
|
|
uint32_t encoderPosition; |
|
|
|
|
|
#if (SDCARDDETECT > 0) |
|
|
|
|
|
bool lcd_oldcardstatus; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#endif // ULTIPANEL
|
|
|
|
|
|
|
|
|
menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */ |
|
|
menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */ |
|
|
uint32_t lcd_next_update_millis; |
|
|
uint32_t lcd_next_update_millis; |
|
@ -520,22 +520,21 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa |
|
|
void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
|
|
|
|
|
|
#if TEMP_SENSOR_1 != 0 //2nd extruder preheat
|
|
|
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0 //more than one extruder present
|
|
|
void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
|
|
|
void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
|
|
|
#endif //2nd extruder preheat
|
|
|
|
|
|
|
|
|
|
|
|
#if TEMP_SENSOR_2 != 0 //3 extruder preheat
|
|
|
#if TEMP_SENSOR_1 != 0 |
|
|
void lcd_preheat_pla2() { _lcd_preheat(2, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
void lcd_preheat_abs2() { _lcd_preheat(2, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
#endif //3 extruder preheat
|
|
|
#endif |
|
|
|
|
|
#if TEMP_SENSOR_2 != 0 |
|
|
#if TEMP_SENSOR_3 != 0 //4 extruder preheat
|
|
|
void lcd_preheat_pla2() { _lcd_preheat(2, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
void lcd_preheat_pla3() { _lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
void lcd_preheat_abs2() { _lcd_preheat(2, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
void lcd_preheat_abs3() { _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
#endif |
|
|
#endif //4 extruder preheat
|
|
|
#if TEMP_SENSOR_3 != 0 |
|
|
|
|
|
void lcd_preheat_pla3() { _lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
|
|
|
void lcd_preheat_abs3() { _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //more than one extruder present
|
|
|
|
|
|
void lcd_preheat_pla0123() { |
|
|
void lcd_preheat_pla0123() { |
|
|
setTargetHotend0(plaPreheatHotendTemp); |
|
|
setTargetHotend0(plaPreheatHotendTemp); |
|
|
setTargetHotend1(plaPreheatHotendTemp); |
|
|
setTargetHotend1(plaPreheatHotendTemp); |
|
@ -548,54 +547,54 @@ void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTem |
|
|
setTargetHotend2(absPreheatHotendTemp); |
|
|
setTargetHotend2(absPreheatHotendTemp); |
|
|
_lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); |
|
|
_lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); |
|
|
} |
|
|
} |
|
|
#endif //more than one extruder present
|
|
|
|
|
|
|
|
|
|
|
|
void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
#if TEMP_SENSOR_0 != 0 |
|
|
void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
|
|
|
|
|
|
|
|
|
static void lcd_preheat_pla_menu() { |
|
|
void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, plaPreheatHPBTemp, plaPreheatFanSpeed); } |
|
|
START_MENU(); |
|
|
void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, absPreheatHPBTemp, absPreheatFanSpeed); } |
|
|
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu); |
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0); |
|
|
|
|
|
#if TEMP_SENSOR_1 != 0 //2 extruder preheat
|
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1); |
|
|
|
|
|
#endif //2 extruder preheat
|
|
|
|
|
|
#if TEMP_SENSOR_2 != 0 //3 extruder preheat
|
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2); |
|
|
|
|
|
#endif //3 extruder preheat
|
|
|
|
|
|
#if TEMP_SENSOR_3 != 0 //4 extruder preheat
|
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3); |
|
|
|
|
|
#endif //4 extruder preheat
|
|
|
|
|
|
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat
|
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123); |
|
|
|
|
|
#endif //all extruder preheat
|
|
|
|
|
|
#if TEMP_SENSOR_BED != 0 |
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly); |
|
|
|
|
|
#endif |
|
|
|
|
|
END_MENU(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void lcd_preheat_abs_menu() { |
|
|
static void lcd_preheat_pla_menu() { |
|
|
START_MENU(); |
|
|
START_MENU(); |
|
|
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu); |
|
|
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu); |
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0); |
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0); |
|
|
#if TEMP_SENSOR_1 != 0 //2 extruder preheat
|
|
|
#if TEMP_SENSOR_1 != 0 |
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1); |
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1); |
|
|
#endif //2 extruder preheat
|
|
|
#endif |
|
|
#if TEMP_SENSOR_2 != 0 //3 extruder preheat
|
|
|
#if TEMP_SENSOR_2 != 0 |
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2); |
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2); |
|
|
#endif //3 extruder preheat
|
|
|
#endif |
|
|
#if TEMP_SENSOR_3 != 0 //4 extruder preheat
|
|
|
#if TEMP_SENSOR_3 != 0 |
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3); |
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3); |
|
|
#endif //4 extruder preheat
|
|
|
#endif |
|
|
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat
|
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123); |
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123); |
|
|
#if TEMP_SENSOR_BED != 0 |
|
|
#endif //all extruder preheat
|
|
|
MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly); |
|
|
#if TEMP_SENSOR_BED != 0 |
|
|
#endif |
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly); |
|
|
END_MENU(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void lcd_preheat_abs_menu() { |
|
|
|
|
|
START_MENU(); |
|
|
|
|
|
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu); |
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0); |
|
|
|
|
|
#if TEMP_SENSOR_1 != 0 |
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if TEMP_SENSOR_2 != 0 |
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2); |
|
|
|
|
|
#endif |
|
|
|
|
|
#if TEMP_SENSOR_3 != 0 |
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3); |
|
|
|
|
|
#endif |
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123); |
|
|
|
|
|
#if TEMP_SENSOR_BED != 0 |
|
|
|
|
|
MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly); |
|
|
|
|
|
#endif |
|
|
|
|
|
END_MENU(); |
|
|
|
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
END_MENU(); |
|
|
|
|
|
} |
|
|
#endif // more than one temperature sensor present
|
|
|
|
|
|
|
|
|
void lcd_cooldown() { |
|
|
void lcd_cooldown() { |
|
|
setTargetHotend0(0); |
|
|
setTargetHotend0(0); |
|
@ -618,7 +617,7 @@ static void lcd_prepare_menu() { |
|
|
MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets); |
|
|
MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets); |
|
|
//MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
|
|
|
//MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
|
|
|
#if TEMP_SENSOR_0 != 0 |
|
|
#if TEMP_SENSOR_0 != 0 |
|
|
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_BED != 0 |
|
|
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0 |
|
|
MENU_ITEM(submenu, MSG_PREHEAT_PLA, lcd_preheat_pla_menu); |
|
|
MENU_ITEM(submenu, MSG_PREHEAT_PLA, lcd_preheat_pla_menu); |
|
|
MENU_ITEM(submenu, MSG_PREHEAT_ABS, lcd_preheat_abs_menu); |
|
|
MENU_ITEM(submenu, MSG_PREHEAT_ABS, lcd_preheat_abs_menu); |
|
|
#else |
|
|
#else |
|
|