Create enum class for heating_status variable
This commit is contained in:
parent
2013295f94
commit
a940c364c9
4 changed files with 28 additions and 18 deletions
|
@ -275,6 +275,17 @@ FORCE_INLINE unsigned long millis_nc() {
|
|||
void setPwmFrequency(uint8_t pin, int val);
|
||||
#endif
|
||||
|
||||
enum class HeatingStatus : uint8_t
|
||||
{
|
||||
NO_HEATING = 0,
|
||||
EXTRUDER_HEATING = 1,
|
||||
EXTRUDER_HEATING_COMPLETE = 2,
|
||||
BED_HEATING = 3,
|
||||
BED_HEATING_COMPLETE = 4,
|
||||
};
|
||||
|
||||
extern HeatingStatus heating_status;
|
||||
|
||||
extern bool fans_check_enabled;
|
||||
extern float homing_feedrate[];
|
||||
extern uint8_t axis_relative_modes;
|
||||
|
@ -322,7 +333,6 @@ extern bool loading_flag;
|
|||
extern uint8_t usb_printing_counter;
|
||||
extern unsigned long total_filament_used;
|
||||
void save_statistics(unsigned long _total_filament_used, unsigned long _total_print_time);
|
||||
extern uint8_t heating_status;
|
||||
extern unsigned int status_number;
|
||||
extern uint8_t heating_status_counter;
|
||||
extern char snmm_filaments_used;
|
||||
|
|
|
@ -217,7 +217,7 @@ bool prusa_sd_card_upload = false;
|
|||
unsigned int status_number = 0;
|
||||
|
||||
unsigned long total_filament_used;
|
||||
uint8_t heating_status;
|
||||
HeatingStatus heating_status;
|
||||
uint8_t heating_status_counter;
|
||||
bool loading_flag = false;
|
||||
|
||||
|
@ -6676,7 +6676,7 @@ Sigma_Exit:
|
|||
break;
|
||||
}
|
||||
LCD_MESSAGERPGM(_T(MSG_HEATING));
|
||||
heating_status = 1;
|
||||
heating_status = HeatingStatus::EXTRUDER_HEATING;
|
||||
if (farm_mode) { prusa_statistics(1); };
|
||||
|
||||
#ifdef AUTOTEMP
|
||||
|
@ -6710,7 +6710,7 @@ Sigma_Exit:
|
|||
|
||||
LCD_MESSAGERPGM(_T(MSG_HEATING_COMPLETE));
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
heating_status = 2;
|
||||
heating_status = HeatingStatus::EXTRUDER_HEATING_COMPLETE;
|
||||
if (farm_mode) { prusa_statistics(2); };
|
||||
|
||||
//starttime=_millis();
|
||||
|
@ -6736,7 +6736,7 @@ Sigma_Exit:
|
|||
{
|
||||
bool CooldownNoWait = false;
|
||||
LCD_MESSAGERPGM(_T(MSG_BED_HEATING));
|
||||
heating_status = 3;
|
||||
heating_status = HeatingStatus::BED_HEATING;
|
||||
if (farm_mode) { prusa_statistics(1); };
|
||||
if (code_seen('S'))
|
||||
{
|
||||
|
@ -6776,7 +6776,7 @@ Sigma_Exit:
|
|||
}
|
||||
LCD_MESSAGERPGM(_T(MSG_BED_DONE));
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
heating_status = 4;
|
||||
heating_status = HeatingStatus::BED_HEATING_COMPLETE;
|
||||
|
||||
previous_millis_cmd.start();
|
||||
}
|
||||
|
@ -11798,9 +11798,9 @@ void restore_print_from_ram_and_continue(float e_move)
|
|||
if (degTargetHotend(saved_active_extruder) != saved_extruder_temperature)
|
||||
{
|
||||
setTargetHotendSafe(saved_extruder_temperature, saved_active_extruder);
|
||||
heating_status = 1;
|
||||
heating_status = HeatingStatus::EXTRUDER_HEATING;
|
||||
wait_for_heater(_millis(), saved_active_extruder);
|
||||
heating_status = 2;
|
||||
heating_status = HeatingStatus::EXTRUDER_HEATING_COMPLETE;
|
||||
}
|
||||
axis_relative_modes ^= (-saved_extruder_relative_mode ^ axis_relative_modes) & E_AXIS_MASK;
|
||||
float e = saved_pos[E_AXIS] - e_move;
|
||||
|
|
|
@ -615,7 +615,7 @@ void fanSpeedError(unsigned char _fan) {
|
|||
if (get_message_level() != 0 && isPrintPaused) return;
|
||||
//to ensure that target temp. is not set to zero in case that we are resuming print
|
||||
if (card.sdprinting || is_usb_printing) {
|
||||
if (heating_status != 0) {
|
||||
if (heating_status != HeatingStatus::NO_HEATING) {
|
||||
lcd_print_stop();
|
||||
}
|
||||
else {
|
||||
|
@ -625,7 +625,7 @@ void fanSpeedError(unsigned char _fan) {
|
|||
else {
|
||||
// SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //Why pause octoprint? is_usb_printing would be true in that case, so there is no need for this.
|
||||
setTargetHotend0(0);
|
||||
heating_status = 0;
|
||||
heating_status = HeatingStatus::NO_HEATING;
|
||||
fan_check_error = EFCE_REPORTED;
|
||||
}
|
||||
switch (_fan) {
|
||||
|
|
|
@ -457,7 +457,7 @@ void lcdui_print_percent_done(void)
|
|||
const char* src = is_usb_printing?_N("USB"):(IS_SD_PRINTING?_N(" SD"):_N(" "));
|
||||
char per[4];
|
||||
bool num = IS_SD_PRINTING || (PRINTER_ACTIVE && (print_percent_done_normal != PRINT_PERCENT_DONE_INIT));
|
||||
if (!num || heating_status) // either not printing or heating
|
||||
if (!num || heating_status != HeatingStatus::NO_HEATING) // either not printing or heating
|
||||
{
|
||||
const int8_t sheetNR = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet));
|
||||
const int8_t nextSheet = eeprom_next_initialized_sheet(sheetNR);
|
||||
|
@ -574,7 +574,7 @@ void lcdui_print_time(void)
|
|||
//! @Brief Print status line on status screen
|
||||
void lcdui_print_status_line(void)
|
||||
{
|
||||
if (heating_status) { // If heating flag, show progress of heating
|
||||
if (heating_status != HeatingStatus::NO_HEATING) { // If heating flag, show progress of heating
|
||||
heating_status_counter++;
|
||||
if (heating_status_counter > 13) {
|
||||
heating_status_counter = 0;
|
||||
|
@ -586,20 +586,20 @@ void lcdui_print_status_line(void)
|
|||
lcd_putc_at(7 + dots, 3, '.');
|
||||
}
|
||||
switch (heating_status) {
|
||||
case 1:
|
||||
case HeatingStatus::EXTRUDER_HEATING:
|
||||
lcd_puts_at_P(0, 3, _T(MSG_HEATING));
|
||||
break;
|
||||
case 2:
|
||||
case HeatingStatus::EXTRUDER_HEATING_COMPLETE:
|
||||
lcd_puts_at_P(0, 3, _T(MSG_HEATING_COMPLETE));
|
||||
heating_status = 0;
|
||||
heating_status = HeatingStatus::NO_HEATING;
|
||||
heating_status_counter = 0;
|
||||
break;
|
||||
case 3:
|
||||
case HeatingStatus::BED_HEATING:
|
||||
lcd_puts_at_P(0, 3, _T(MSG_BED_HEATING));
|
||||
break;
|
||||
case 4:
|
||||
case HeatingStatus::BED_HEATING_COMPLETE:
|
||||
lcd_puts_at_P(0, 3, _T(MSG_BED_DONE));
|
||||
heating_status = 0;
|
||||
heating_status = HeatingStatus::NO_HEATING;
|
||||
heating_status_counter = 0;
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue