Prusa-Firmware/Firmware/ultralcd.h

269 lines
8.1 KiB
C
Raw Normal View History

2016-07-22 13:28:01 +00:00
#ifndef ULTRALCD_H
#define ULTRALCD_H
#include "mesh_bed_calibration.h"
#include "config.h"
2016-07-22 13:28:01 +00:00
extern void menu_lcd_longpress_func(void);
extern void menu_lcd_charsetup_func(void);
extern void menu_lcd_lcdupdate_func(void);
2016-07-22 13:28:01 +00:00
// Call with a false parameter to suppress the LCD update from various places like the planner or the temp control.
void ultralcd_init();
void lcd_setstatus(const char* message);
void lcd_setstatuspgm(const char* message);
2019-05-24 06:46:44 +00:00
//! return to the main status screen and display the alert message
//! Beware - it has sideeffects:
//! - always returns the display to the main status screen
//! - always makes lcd_reset (which is slow and causes flicker)
//! - does not update the message if there is already one (i.e. lcd_status_message_level > 0)
void lcd_setalertstatus(const char* message);
void lcd_setalertstatuspgm(const char* message);
2019-05-24 06:46:44 +00:00
//! only update the alert message on the main status screen
//! has no sideeffects, may be called multiple times
void lcd_updatestatus(const char *message);
2019-05-24 06:46:44 +00:00
void lcd_updatestatuspgm(const char *message);
void lcd_reset_alert_level();
uint8_t get_message_level();
void lcd_adjust_z();
void lcd_pick_babystep();
void lcd_alright();
void show_preheat_nozzle_warning();
void EEPROM_save_B(int pos, int* value);
void EEPROM_read_B(int pos, int* value);
void lcd_wait_interact();
void lcd_loading_filament();
void lcd_change_success();
void lcd_loading_color();
void lcd_sdcard_stop();
void lcd_pause_print();
2021-02-17 06:42:12 +00:00
void lcd_pause_usb_print();
void lcd_resume_print();
void lcd_print_stop();
void prusa_statistics(int _message, uint8_t _col_nr = 0);
unsigned char lcd_choose_color();
void lcd_load_filament_color_check();
//void lcd_mylang();
2016-07-22 13:28:01 +00:00
extern void lcd_belttest();
extern bool lcd_selftest();
void lcd_menu_statistics();
2016-07-22 13:28:01 +00:00
void lcd_status_screen(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
2020-03-02 16:52:25 +00:00
#ifdef TMC2130
bool lcd_crash_detect_enabled();
void lcd_crash_detect_enable();
void lcd_crash_detect_disable();
#endif
extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines);
extern const char* lcd_display_message_fullscreen_P(const char *msg);
extern void lcd_return_to_status();
extern void lcd_wait_for_click();
extern bool lcd_wait_for_click_delay(uint16_t nDelay);
extern void lcd_show_fullscreen_message_and_wait_P(const char *msg);
// 0: no, 1: yes, -1: timeouted
extern int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
extern int8_t lcd_show_multiscreen_message_two_choices_and_wait_P(const char *msg, bool allow_timeouting, bool default_yes,
const char *first_choice, const char *second_choice);
extern int8_t lcd_show_multiscreen_message_yes_no_and_wait_P(const char *msg, bool allow_timeouting = true, bool default_yes = false);
// Ask the user to move the Z axis up to the end stoppers and let
// the user confirm that it has been done.
2016-07-22 13:28:01 +00:00
#ifndef TMC2130
extern bool lcd_calibrate_z_end_stop_manual(bool only_z);
#endif
2016-07-22 13:28:01 +00:00
// Show the result of the calibration process on the LCD screen.
2018-08-21 15:56:34 +00:00
extern void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask);
2016-07-22 13:28:01 +00:00
extern void lcd_diag_show_end_stops();
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
#define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x))
#define LCD_ALERTMESSAGERPGM(x) lcd_setalertstatuspgm((x))
// To be used in lcd_commands_type.
enum class LcdCommands : uint_least8_t
{
Idle,
LoadFilament,
StopPrint,
FarmModeConfirm,
LongPause,
PidExtruder,
Layer1Cal,
};
extern LcdCommands lcd_commands_type;
extern int8_t FSensorStateMenu;
enum class CustomMsg : uint_least8_t
{
2021-02-15 11:50:40 +00:00
Status, //!< status message from lcd_status_message variable
MeshBedLeveling, //!< Mesh bed leveling in progress
FilamentLoading, //!< Loading filament in progress
PidCal, //!< PID tuning in progress
TempCal, //!< PINDA temperature calibration
TempCompPreheat, //!< Temperature compensation preheat
M0Wait, //!< M0/M1 Wait command working even from SD
MsgUpdate, //!< Short message even while printing from SD
2021-02-16 06:27:46 +00:00
Resuming, //!< Resuming message
};
extern CustomMsg custom_message_type;
extern unsigned int custom_message_state;
extern uint8_t farm_mode;
extern int farm_timer;
extern uint8_t farm_status;
Scale extruder motor current linearly with speed. (#2813) Scale extruder motor current linearly with speed. 49% less heating when running at low speed and standstill, 4% more torque at maximum extrusion rate (15mm^3/s), 15% more torque in high speed movements (un/retractions). StealthChop mode is used for low speeds (below 900mm/min) spreadCycle is used above. Transition speed is well above maximum extrusion rate of 15mm^3/s (275mm/min) so mode transition is not expected to be visible on printed surface. StealthChop is expected to improve printed surface quality (less artifacts). Warning you can burn extruder motor if it is not the same impedance as original Prusa i3 Extruder stepper motor. There is no current feedback in low speed so lower impedance motor can be burned by over current. Even there is no direct current feedback, there is no risk for original motor thermal runaway, as motor resistance increases with temperature, current decreases. Standstill peak phase current is expected to be 500 mA and linearly increase with speed to 970 mA at 900mm/min where spreadCycle constant current regulation takes over and keeps peak current at 805 mA to maximum speed possible. As motor heating increases with current squared, lowering low speed current from 700mA to 500mA decreases heating 49% in thate mode, where motor spends most of the time. Enable E-motor cool mode in farm mode only (and experimental menu) - the experimental menu is visible AND the EEPROM_ECOOL variable has a value of the universal answer to all problems of the universe - i.e. two conditions must be met at the start of the FW to enable the E-cool mode. If the user enables the experimental menu, sets the E-cool mode and disables the menu afterwards, on the next start of the FW the E-cool mode will be DISABLED. This is still subject to discussion how much obscure (security through obscurity) we'd like this option to have . Additional stuff: * Add serial debug msg to verify if E-cool mode is on * Avoid access to E-cool mode switch on machines without TMC2130 * Do not allow only M907 E in case of E-cool mode+warn the user on the serial line that the command was skipped Co-authored-by: D.R.racer <drracer@drracer.eu>
2021-04-23 14:06:28 +00:00
extern bool UserECoolEnabled();
extern bool FarmOrUserECool();
#ifdef TMC2130
#define SILENT_MODE_NORMAL 0
#define SILENT_MODE_STEALTH 1
#define SILENT_MODE_OFF SILENT_MODE_NORMAL
#else
#define SILENT_MODE_POWER 0
#define SILENT_MODE_SILENT 1
#define SILENT_MODE_AUTO 2
#define SILENT_MODE_OFF SILENT_MODE_POWER
#endif
2016-07-22 13:28:01 +00:00
#ifdef IR_SENSOR_ANALOG
extern bool bMenuFSDetect;
void printf_IRSensorAnalogBoardChange();
#endif //IR_SENSOR_ANALOG
extern int8_t SilentModeMenu;
extern uint8_t SilentModeMenu_MMU;
2016-08-11 08:42:53 +00:00
extern bool cancel_heatup;
extern bool isPrintPaused;
2016-07-22 13:28:01 +00:00
extern uint8_t scrollstuff;
2016-07-22 13:28:01 +00:00
void lcd_ignore_click(bool b=true);
void lcd_commands();
2016-07-22 13:28:01 +00:00
2017-03-24 18:47:50 +00:00
2019-07-16 18:10:49 +00:00
extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function
void lcd_hw_setup_menu(void); // NOT static due to using inside "util" module ("nozzle_diameter_check()")
2019-07-10 14:29:40 +00:00
2017-03-24 18:47:50 +00:00
void change_extr(int extr);
#ifdef SNMM
2017-06-29 16:35:43 +00:00
void extr_unload_all();
void extr_unload_used();
#endif //SNMM
2017-06-29 16:35:43 +00:00
void extr_unload();
2017-03-24 18:47:50 +00:00
enum class FilamentAction : uint_least8_t
2019-02-25 10:12:39 +00:00
{
None, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state)
Load,
AutoLoad,
UnLoad,
MmuLoad,
MmuUnLoad,
MmuEject,
MmuCut,
Preheat,
Lay1Cal,
};
extern FilamentAction eFilamentAction;
extern bool bFilamentFirstRun;
extern bool bFilamentPreheatState;
extern bool bFilamentAction;
void mFilamentItem(uint16_t nTemp,uint16_t nTempBed);
void mFilamentItemForce();
void lcd_generic_preheat_menu();
void unload_filament(bool automatic = false);
2018-07-31 10:24:22 +00:00
2017-03-24 18:47:50 +00:00
void stack_error();
void lcd_printer_connected();
void lcd_ping();
void lcd_calibrate_extruder();
void lcd_farm_sdcard_menu();
//void getFileDescription(char *name, char *description);
void lcd_farm_sdcard_menu_w();
//void get_description();
void lcd_wait_for_heater();
void lcd_wait_for_cool_down();
void lcd_move_e(); // NOT static due to usage in Marlin_main
2017-03-24 18:47:50 +00:00
void lcd_extr_cal_reset();
void lcd_temp_cal_show_result(bool result);
#ifdef PINDA_THERMISTOR
bool lcd_wait_for_pinda(float temp);
#endif //PINDA_THERMISTOR
2017-06-29 16:35:43 +00:00
void bowden_menu();
2017-03-24 18:47:50 +00:00
char reset_menu();
uint8_t choose_menu_P(const char *header, const char *item, const char *last_item = nullptr);
2017-06-29 16:35:43 +00:00
void lcd_pinda_calibration_menu();
void lcd_calibrate_pinda();
void lcd_temp_calibration_set();
void display_loading();
void lcd_set_degree();
#if (LANG_MODE != 0)
void lcd_language();
#endif
void lcd_wizard();
bool lcd_autoDepleteEnabled();
//! @brief Wizard state
enum class WizState : uint8_t
{
2019-09-17 16:58:59 +00:00
Run, //!< run wizard? Main entry point.
Restore, //!< restore calibration status
2019-09-17 16:58:59 +00:00
Selftest, //!< self test
Xyz, //!< xyz calibration
Z, //!< z calibration
2019-09-17 16:58:59 +00:00
IsFil, //!< Is filament loaded? First step of 1st layer calibration
PreheatPla, //!< waiting for preheat nozzle for PLA
Preheat, //!< Preheat for any material
LoadFilCold, //!< Load filament for MMU
LoadFilHot, //!< Load filament without MMU
IsPla, //!< Is PLA filament?
Lay1CalCold, //!< First layer calibration, temperature not selected yet
Lay1CalHot, //!< First layer calibration, temperature already selected
RepeatLay1Cal, //!< Repeat first layer calibration?
Finish, //!< Deactivate wizard
};
void lcd_wizard(WizState state);
2020-07-29 08:23:24 +00:00
extern void lcd_experimental_toggle();
2020-07-20 16:35:25 +00:00
extern void lcd_experimental_menu();
#ifdef PINDA_TEMP_COMP
extern void lcd_pinda_temp_compensation_toggle();
#endif //PINDA_TEMP_COMP
#endif //ULTRALCD_H