Use first letter capital camel case for enum class members. Rename CustomMsgTypes to CustomMsg. Remove unnecessary maping to numbers. Change underlying type to uint_least8_t.
This commit is contained in:
parent
51df6cdfdc
commit
5fcf760954
@ -389,7 +389,7 @@ extern bool wizard_active; //autoload temporarily disabled during wizard
|
||||
extern LongTimer safetyTimer;
|
||||
|
||||
#define PRINT_PERCENT_DONE_INIT 0xff
|
||||
#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsgTypes::TEMCAL) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || card.paused || mmu_print_saved)
|
||||
#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsg::TempCal) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || card.paused || mmu_print_saved)
|
||||
//! Beware - mcode_in_progress is set as soon as the command gets really processed,
|
||||
//! which is not the same as posting the M600 command into the command queue
|
||||
//! There can be a considerable lag between posting M600 and its real processing which might result
|
||||
|
@ -3157,7 +3157,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
|
||||
#endif //IR_SENSOR
|
||||
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
}
|
||||
|
||||
//! @brief Rise Z if too low to avoid blob/jam before filament loading
|
||||
@ -3181,7 +3181,7 @@ void gcode_M701()
|
||||
else
|
||||
{
|
||||
enable_z();
|
||||
custom_message_type = CustomMsgTypes::F_LOAD;
|
||||
custom_message_type = CustomMsg::FilamentLoading;
|
||||
|
||||
#ifdef FSENSOR_QUALITY
|
||||
fsensor_oq_meassure_start(40);
|
||||
@ -3211,7 +3211,7 @@ void gcode_M701()
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
disable_z();
|
||||
loading_flag = false;
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
|
||||
#ifdef FSENSOR_QUALITY
|
||||
fsensor_oq_meassure_stop();
|
||||
@ -4194,7 +4194,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
// setTargetHotend(200, 0);
|
||||
setTargetBed(70 + (start_temp - 30));
|
||||
|
||||
custom_message_type = CustomMsgTypes::TEMCAL;
|
||||
custom_message_type = CustomMsg::TempCal;
|
||||
custom_message_state = 1;
|
||||
lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION));
|
||||
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
|
||||
@ -4296,7 +4296,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
break;
|
||||
}
|
||||
puts_P(_N("PINDA probe calibration start"));
|
||||
custom_message_type = CustomMsgTypes::TEMCAL;
|
||||
custom_message_type = CustomMsg::TempCal;
|
||||
custom_message_state = 1;
|
||||
lcd_setstatuspgm(_T(MSG_TEMP_CALIBRATION));
|
||||
current_position[X_AXIS] = PINDA_PREHEAT_X;
|
||||
@ -4364,7 +4364,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
|
||||
|
||||
}
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
|
||||
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1);
|
||||
puts_P(_N("Temperature calibration done."));
|
||||
@ -4481,9 +4481,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
break;
|
||||
}
|
||||
// Save custom message state, set a new custom message state to display: Calibrating point 9.
|
||||
CustomMsgTypes custom_message_type_old = custom_message_type;
|
||||
CustomMsg custom_message_type_old = custom_message_type;
|
||||
unsigned int custom_message_state_old = custom_message_state;
|
||||
custom_message_type = CustomMsgTypes::MESHBL;
|
||||
custom_message_type = CustomMsg::MeshBedLeveling;
|
||||
custom_message_state = (nMeasPoints * nMeasPoints) + 10;
|
||||
lcd_update(1);
|
||||
|
||||
@ -4683,7 +4683,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
enable_z_endstop(bState);
|
||||
} while (st_get_position_mm(Z_AXIS) > MESH_HOME_Z_SEARCH); // i.e. Z-leveling not o.k.
|
||||
// plan_set_z_position(MESH_HOME_Z_SEARCH); // is not necessary ('do-while' loop always ends at the expected Z-position)
|
||||
custom_message_type=CustomMsgTypes::STATUS; // display / status-line recovery
|
||||
custom_message_type=CustomMsg::Status; // display / status-line recovery
|
||||
lcd_update_enable(true); // display / status-line recovery
|
||||
gcode_G28(true, true, true); // X & Y & Z-homing (must be after individual Z-homing (problem with spool-holder)!)
|
||||
repeatcommand_front(); // re-run (i.e. of "G80")
|
||||
@ -8210,7 +8210,7 @@ void bed_check(float x_dimension, float y_dimension, int x_points_num, int y_poi
|
||||
|
||||
unsigned int custom_message_type_old = custom_message_type;
|
||||
unsigned int custom_message_state_old = custom_message_state;
|
||||
custom_message_type = CustomMsgTypes::MESHBL;
|
||||
custom_message_type = CustomMsg::MeshBedLeveling;
|
||||
custom_message_state = (x_points_num * y_points_num) + 10;
|
||||
lcd_update(1);
|
||||
|
||||
@ -8408,7 +8408,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
|
||||
}
|
||||
unsigned int custom_message_type_old = custom_message_type;
|
||||
unsigned int custom_message_state_old = custom_message_state;
|
||||
custom_message_type = CustomMsgTypes::MESHBL;
|
||||
custom_message_type = CustomMsg::MeshBedLeveling;
|
||||
custom_message_state = (x_points_num * y_points_num) + 10;
|
||||
lcd_update(1);
|
||||
|
||||
@ -8558,7 +8558,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_
|
||||
|
||||
void temp_compensation_start() {
|
||||
|
||||
custom_message_type = CustomMsgTypes::TEMPRE;
|
||||
custom_message_type = CustomMsg::TempCompPreheat;
|
||||
custom_message_state = PINDA_HEAT_T + 1;
|
||||
lcd_update(2);
|
||||
if (degHotend(active_extruder) > EXTRUDE_MINTEMP) {
|
||||
@ -8579,7 +8579,7 @@ void temp_compensation_start() {
|
||||
if (custom_message_state == 99 || custom_message_state == 9) lcd_update(2); //force whole display redraw if number of digits changed
|
||||
else lcd_update(1);
|
||||
}
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
custom_message_state = 0;
|
||||
}
|
||||
|
||||
|
@ -1372,13 +1372,13 @@ void lcd_mmu_load_to_nozzle(uint8_t filament_nr)
|
||||
mmu_load_to_nozzle();
|
||||
load_filament_final_feed();
|
||||
st_synchronize();
|
||||
custom_message_type = CustomMsgTypes::F_LOAD;
|
||||
custom_message_type = CustomMsg::FilamentLoading;
|
||||
lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT));
|
||||
lcd_return_to_status();
|
||||
lcd_update_enable(true);
|
||||
lcd_load_filament_color_check();
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ bool presort_flag = false;
|
||||
LcdCommands lcd_commands_type = LcdCommands::Idle;
|
||||
static uint8_t lcd_commands_step = 0;
|
||||
|
||||
CustomMsgTypes custom_message_type = CustomMsgTypes::STATUS;
|
||||
CustomMsg custom_message_type = CustomMsg::Status;
|
||||
unsigned int custom_message_state = 0;
|
||||
|
||||
|
||||
@ -565,7 +565,7 @@ void lcdui_print_temp(char type, int val_current, int val_target)
|
||||
// Print Z-coordinate (8 chars total)
|
||||
void lcdui_print_Z_coord(void)
|
||||
{
|
||||
if (custom_message_type == CustomMsgTypes::MESHBL)
|
||||
if (custom_message_type == CustomMsg::MeshBedLeveling)
|
||||
lcd_puts_P(_N("Z --- "));
|
||||
else
|
||||
lcd_printf_P(_N("Z%6.2f "), current_position[Z_AXIS]);
|
||||
@ -760,7 +760,7 @@ void lcdui_print_status_line(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsgTypes::STATUS))
|
||||
else if ((IS_SD_PRINTING) && (custom_message_type == CustomMsg::Status))
|
||||
{ // If printing from SD, show what we are printing
|
||||
if(strlen(card.longFilename) > LCD_WIDTH)
|
||||
{
|
||||
@ -794,10 +794,10 @@ void lcdui_print_status_line(void)
|
||||
{ // Otherwise check for other special events
|
||||
switch (custom_message_type)
|
||||
{
|
||||
case CustomMsgTypes::STATUS: // Nothing special, print status message normally
|
||||
case CustomMsg::Status: // Nothing special, print status message normally
|
||||
lcd_print(lcd_status_message);
|
||||
break;
|
||||
case CustomMsgTypes::MESHBL: // If mesh bed leveling in progress, show the status
|
||||
case CustomMsg::MeshBedLeveling: // If mesh bed leveling in progress, show the status
|
||||
if (custom_message_state > 10)
|
||||
{
|
||||
lcd_set_cursor(0, 3);
|
||||
@ -813,7 +813,7 @@ void lcdui_print_status_line(void)
|
||||
{
|
||||
lcd_puts_P(_T(WELCOME_MSG));
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
}
|
||||
if (custom_message_state > 3 && custom_message_state <= 10 )
|
||||
{
|
||||
@ -825,10 +825,10 @@ void lcdui_print_status_line(void)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CustomMsgTypes::F_LOAD: // If loading filament, print status
|
||||
case CustomMsg::FilamentLoading: // If loading filament, print status
|
||||
lcd_print(lcd_status_message);
|
||||
break;
|
||||
case CustomMsgTypes::PIDCAL: // PID tuning in progress
|
||||
case CustomMsg::PidCal: // PID tuning in progress
|
||||
lcd_print(lcd_status_message);
|
||||
if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0)
|
||||
{
|
||||
@ -838,7 +838,7 @@ void lcdui_print_status_line(void)
|
||||
lcd_print(itostr3left(pid_number_of_cycles));
|
||||
}
|
||||
break;
|
||||
case CustomMsgTypes::TEMCAL: // PINDA temp calibration in progress
|
||||
case CustomMsg::TempCal: // PINDA temp calibration in progress
|
||||
{
|
||||
char progress[4];
|
||||
lcd_set_cursor(0, 3);
|
||||
@ -848,7 +848,7 @@ void lcdui_print_status_line(void)
|
||||
lcd_print(progress);
|
||||
}
|
||||
break;
|
||||
case CustomMsgTypes::TEMPRE: // temp compensation preheat
|
||||
case CustomMsg::TempCompPreheat: // temp compensation preheat
|
||||
lcd_set_cursor(0, 3);
|
||||
lcd_puts_P(_i("PINDA Heating"));////MSG_PINDA_PREHEAT c=20 r=1
|
||||
if (custom_message_state <= PINDA_HEAT_T)
|
||||
@ -1465,7 +1465,7 @@ void lcd_commands()
|
||||
lcd_commands_step = 0;
|
||||
lcd_commands_type = LcdCommands::Idle;
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
isPrintPaused = false;
|
||||
}
|
||||
if (lcd_commands_step == 2 && !blocks_queued())
|
||||
@ -1521,7 +1521,7 @@ void lcd_commands()
|
||||
if (mmu_enabled)
|
||||
setAllTargetHotends(0);
|
||||
manage_heater();
|
||||
custom_message_type = CustomMsgTypes::F_LOAD;
|
||||
custom_message_type = CustomMsg::FilamentLoading;
|
||||
lcd_commands_step = 5;
|
||||
}
|
||||
if (lcd_commands_step == 7 && !blocks_queued())
|
||||
@ -1589,7 +1589,7 @@ void lcd_commands()
|
||||
char cmd1[30];
|
||||
|
||||
if (lcd_commands_step == 0) {
|
||||
custom_message_type = CustomMsgTypes::PIDCAL;
|
||||
custom_message_type = CustomMsg::PidCal;
|
||||
custom_message_state = 1;
|
||||
lcd_draw_update = 3;
|
||||
lcd_commands_step = 3;
|
||||
@ -1625,7 +1625,7 @@ void lcd_commands()
|
||||
}
|
||||
if ((lcd_commands_step == 1) && ((_millis()- display_time)>2000)) { //calibration finished message
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
pid_temp = DEFAULT_PID_TEMP;
|
||||
lcd_commands_step = 0;
|
||||
lcd_commands_type = LcdCommands::Idle;
|
||||
@ -2758,7 +2758,7 @@ static void lcd_LoadFilament()
|
||||
if(0)
|
||||
{
|
||||
// menu_back(); // not necessary (see "lcd_return_to_status()" below)
|
||||
custom_message_type = CustomMsgTypes::F_LOAD;
|
||||
custom_message_type = CustomMsg::FilamentLoading;
|
||||
loading_flag = true;
|
||||
enquecommand_P(PSTR("M701")); //load filament
|
||||
SERIAL_ECHOLN("Loading filament");
|
||||
@ -3817,7 +3817,7 @@ void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, ui
|
||||
|
||||
void lcd_temp_cal_show_result(bool result) {
|
||||
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
disable_x();
|
||||
disable_y();
|
||||
disable_z();
|
||||
@ -5900,7 +5900,7 @@ static void change_extr_menu(){
|
||||
//unload filament for single material printer (used in M702 gcode)
|
||||
void unload_filament()
|
||||
{
|
||||
custom_message_type = CustomMsgTypes::F_LOAD;
|
||||
custom_message_type = CustomMsg::FilamentLoading;
|
||||
lcd_setstatuspgm(_T(MSG_UNLOADING_FILAMENT));
|
||||
|
||||
// extr_unload2();
|
||||
@ -5935,7 +5935,7 @@ void unload_filament()
|
||||
lcd_update_enable(true);
|
||||
|
||||
lcd_setstatuspgm(_T(WELCOME_MSG));
|
||||
custom_message_type = CustomMsgTypes::STATUS;
|
||||
custom_message_type = CustomMsg::Status;
|
||||
|
||||
}
|
||||
|
||||
@ -6422,7 +6422,7 @@ static void lcd_colorprint_change() {
|
||||
|
||||
enquecommand_P(PSTR("M600"));
|
||||
|
||||
custom_message_type = CustomMsgTypes::F_LOAD; //just print status message
|
||||
custom_message_type = CustomMsg::FilamentLoading; //just print status message
|
||||
lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS));
|
||||
lcd_return_to_status();
|
||||
lcd_draw_update = 3;
|
||||
|
@ -89,7 +89,7 @@ extern void lcd_diag_show_end_stops();
|
||||
|
||||
|
||||
// To be used in lcd_commands_type.
|
||||
enum class LcdCommands : uint8_t
|
||||
enum class LcdCommands : uint_least8_t
|
||||
{
|
||||
Idle,
|
||||
LoadFilament,
|
||||
@ -103,16 +103,17 @@ enum class LcdCommands : uint8_t
|
||||
extern LcdCommands lcd_commands_type;
|
||||
extern int8_t FSensorStateMenu;
|
||||
|
||||
enum class CustomMsgTypes : uint8_t {
|
||||
STATUS = 0, //!< status message from lcd_status_message variable
|
||||
MESHBL = 1, //!< Mesh bed leveling in progress
|
||||
F_LOAD = 2, //!< Loading filament in progress
|
||||
PIDCAL = 3, //!< PID tuning in progress
|
||||
TEMCAL = 4, //!< PINDA temp calibration
|
||||
TEMPRE = 5, //!< Temp compensation preheat
|
||||
enum class CustomMsg : uint_least8_t
|
||||
{
|
||||
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
|
||||
};
|
||||
|
||||
extern CustomMsgTypes custom_message_type;
|
||||
extern CustomMsg custom_message_type;
|
||||
extern unsigned int custom_message_state;
|
||||
|
||||
extern uint8_t farm_mode;
|
||||
|
Loading…
Reference in New Issue
Block a user