Skip to content

Commit

Permalink
Merge pull request #2335 from Panayiotis-git/MK3_NoBedHeating_onLoadU…
Browse files Browse the repository at this point in the history
…nload

@Panayiotis-git Thanks a lot!

Finally after 3 years 21 days your PR gets merged 🦕
  • Loading branch information
3d-gussner authored Dec 8, 2022
2 parents a266ff3 + c75c81c commit 92f2281
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 27 deletions.
3 changes: 3 additions & 0 deletions Firmware/eeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ void eeprom_init()
eeprom_init_default_dword((uint32_t*)EEPROM_TOTALTIME, 0);
eeprom_init_default_dword((uint32_t*)EEPROM_FILAMENTUSED, 0);
eeprom_init_default_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED, 0);

eeprom_init_default_byte((uint8_t*)EEPROM_HEAT_BED_ON_LOAD_FILAMENT, 1);

}

//! @brief Get default sheet name for index
Expand Down
7 changes: 6 additions & 1 deletion Firmware/eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
| 0x0CAD 3245 | uint8 | EEPROM_FSENSOR_JAM_DETECTION | 01h 1 | ff/01 | fsensor pat9125 jam detection feature | LCD menu | D3 Ax0cad C1
| 0x0CAC 3244 | uint8 | EEPROM_MMU_ENABLED | 01h 1 | ff/01 | MMU enabled | LCD menu | D3 Ax0cac C1
| 0x0CA8 3240 | uint32 | EEPROM_TOTAL_TOOLCHANGE_COUNT | ??? | ff ff ff ffh | MMU toolchange counter over printers lifetime | LCD statistic| D3 Ax0ca8 C4
| 0x0CA7 3239 | uint8 | EEPROM_HEAT_BED_ON_LOAD_FILAMENT | ffh 255 | ffh 255 | Heat bed on load filament unknown state | LCD menu | D3 Ax0d02 C1
| ^ | ^ | ^ | 00h 0 | ^ | Do not heat bed on load filament | ^ | ^
| ^ | ^ | ^ | 01h 1 | ^ | Heat bed on load filament | ^ | ^
|Address begin|Bit/Type | Name | Valid values | Default/FactoryReset | Description |Gcode/Function| Debug code
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--:
Expand Down Expand Up @@ -570,8 +573,10 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
#define EEPROM_FSENSOR_JAM_DETECTION (EEPROM_TEMP_MODEL_E-1) // uint8_t
#define EEPROM_MMU_ENABLED (EEPROM_FSENSOR_JAM_DETECTION-1) // uint8_t
#define EEPROM_TOTAL_TOOLCHANGE_COUNT (EEPROM_MMU_ENABLED-4)
#define EEPROM_HEAT_BED_ON_LOAD_FILAMENT (EEPROM_TOTAL_TOOLCHANGE_COUNT-1) //uint8

//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
#define EEPROM_LAST_ITEM EEPROM_TOTAL_TOOLCHANGE_COUNT
#define EEPROM_LAST_ITEM EEPROM_HEAT_BED_ON_LOAD_FILAMENT
// !!!!!
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
// !!!!!
Expand Down
86 changes: 60 additions & 26 deletions Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1824,12 +1824,42 @@ bool bFilamentPreheatState;
bool bFilamentAction=false;
static bool bFilamentWaitingFlag=false;

bool shouldPreheatOnlyNozzle() {
uint8_t eeprom_setting = eeprom_read_byte((uint8_t*)EEPROM_HEAT_BED_ON_LOAD_FILAMENT);
if (eeprom_setting != 0)
return false;

switch(eFilamentAction) {
case FilamentAction::Load:
case FilamentAction::AutoLoad:
case FilamentAction::UnLoad:
case FilamentAction::MmuLoad:
case FilamentAction::MmuUnLoad:
case FilamentAction::MmuEject:
case FilamentAction::MmuCut:
return true;
default:
return false;
}
}

void lcd_print_target_temps_first_line(){
lcd_set_cursor(0, 0);
lcdui_print_temp(LCD_STR_THERMOMETER[0], (int) degHotend(0), (int) degTargetHotend(0));
lcd_set_cursor(10, 0);
int targetBedTemp = (int) degTargetBed();
if (targetBedTemp) {
lcdui_print_temp(LCD_STR_BEDTEMP[0], (int) degBed(), targetBedTemp);
} else {
lcd_space(10);
}
}

static void mFilamentPrompt()
{
uint8_t nLevel;

lcd_set_cursor(0,0);
lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0));
lcd_print_target_temps_first_line();
lcd_puts_at_P(0,1, _i("Press the knob")); ////MSG_PRESS_KNOB c=20
lcd_set_cursor(0,2);
switch(eFilamentAction)
Expand Down Expand Up @@ -1891,14 +1921,10 @@ switch(eFilamentAction)

void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
{
static int nTargetOld;
static int nTargetBedOld;
uint8_t nLevel;

nTargetOld = target_temperature[0];
nTargetBedOld = target_temperature_bed;
setTargetHotend0((float )nTemp);
setTargetBed((float) nTempBed);
setTargetHotend0((float)nTemp);
if (!shouldPreheatOnlyNozzle()) setTargetBed((float)nTempBed);

{
const FilamentAction action = eFilamentAction;
Expand Down Expand Up @@ -2033,8 +2059,7 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
}

if (bFilamentWaitingFlag) {
lcd_set_cursor(0, 0);
lcdui_print_temp(LCD_STR_THERMOMETER[0], (int) degHotend(0), (int) degTargetHotend(0));
lcd_print_target_temps_first_line();
}

if (lcd_clicked())
Expand All @@ -2043,14 +2068,9 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
if (!bFilamentPreheatState)
{
setTargetHotend0(0.0);
setTargetBed(0.0);
if (!isPrintPaused) setTargetBed(0.0);
menu_back();
}
else
{
setTargetHotend0((float )nTargetOld);
setTargetBed((float) nTargetBedOld);
}
menu_back();
if (eFilamentAction == FilamentAction::AutoLoad) eFilamentAction = FilamentAction::None; // i.e. non-autoLoad
}
Expand Down Expand Up @@ -2155,16 +2175,17 @@ void lcd_generic_preheat_menu()
}
else
{
MENU_ITEM_SUBMENU_P(PSTR("PLA - " STRINGIFY(PLA_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PLA_PREHEAT_HPB_TEMP)),mFilamentItem_PLA);
MENU_ITEM_SUBMENU_P(PSTR("PET - " STRINGIFY(PET_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PET_PREHEAT_HPB_TEMP)),mFilamentItem_PET);
MENU_ITEM_SUBMENU_P(PSTR("ASA - " STRINGIFY(ASA_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(ASA_PREHEAT_HPB_TEMP)),mFilamentItem_ASA);
MENU_ITEM_SUBMENU_P(PSTR("PC - " STRINGIFY(PC_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PC_PREHEAT_HPB_TEMP)),mFilamentItem_PC);
MENU_ITEM_SUBMENU_P(PSTR("PVB - " STRINGIFY(PVB_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PVB_PREHEAT_HPB_TEMP)),mFilamentItem_PVB);
MENU_ITEM_SUBMENU_P(PSTR("PA - " STRINGIFY(PA_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PA_PREHEAT_HPB_TEMP)),mFilamentItem_PA);
MENU_ITEM_SUBMENU_P(PSTR("ABS - " STRINGIFY(ABS_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(ABS_PREHEAT_HPB_TEMP)),mFilamentItem_ABS);
MENU_ITEM_SUBMENU_P(PSTR("HIPS - " STRINGIFY(HIPS_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(HIPS_PREHEAT_HPB_TEMP)),mFilamentItem_HIPS);
MENU_ITEM_SUBMENU_P(PSTR("PP - " STRINGIFY(PP_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PP_PREHEAT_HPB_TEMP)),mFilamentItem_PP);
MENU_ITEM_SUBMENU_P(PSTR("FLEX - " STRINGIFY(FLEX_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(FLEX_PREHEAT_HPB_TEMP)),mFilamentItem_FLEX);
bool bPreheatOnlyNozzle = shouldPreheatOnlyNozzle();
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("PLA - " STRINGIFY(PLA_PREHEAT_HOTEND_TEMP)) : PSTR("PLA - " STRINGIFY(PLA_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PLA_PREHEAT_HPB_TEMP)) , mFilamentItem_PLA);
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("PET - " STRINGIFY(PET_PREHEAT_HOTEND_TEMP)) : PSTR("PET - " STRINGIFY(PET_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PET_PREHEAT_HPB_TEMP)) , mFilamentItem_PET);
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("ASA - " STRINGIFY(ASA_PREHEAT_HOTEND_TEMP)) : PSTR("ASA - " STRINGIFY(ASA_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(ASA_PREHEAT_HPB_TEMP)) , mFilamentItem_ASA);
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("PC - " STRINGIFY(PC_PREHEAT_HOTEND_TEMP)) : PSTR("PC - " STRINGIFY(PC_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PC_PREHEAT_HPB_TEMP)) , mFilamentItem_PC);
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("PVB - " STRINGIFY(PVB_PREHEAT_HOTEND_TEMP)) : PSTR("PVB - " STRINGIFY(PVB_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PVB_PREHEAT_HPB_TEMP)) , mFilamentItem_PVB);
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("PA - " STRINGIFY(PA_PREHEAT_HOTEND_TEMP)) : PSTR("PA - " STRINGIFY(PA_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PA_PREHEAT_HPB_TEMP)) , mFilamentItem_PA);
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("ABS - " STRINGIFY(ABS_PREHEAT_HOTEND_TEMP)) : PSTR("ABS - " STRINGIFY(ABS_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(ABS_PREHEAT_HPB_TEMP)) , mFilamentItem_ABS);
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("HIPS - " STRINGIFY(HIPS_PREHEAT_HOTEND_TEMP)): PSTR("HIPS - " STRINGIFY(HIPS_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(HIPS_PREHEAT_HPB_TEMP)), mFilamentItem_HIPS);
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("PP - " STRINGIFY(PP_PREHEAT_HOTEND_TEMP)) : PSTR("PP - " STRINGIFY(PP_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(PP_PREHEAT_HPB_TEMP)) , mFilamentItem_PP);
MENU_ITEM_SUBMENU_P(bPreheatOnlyNozzle ? PSTR("FLEX - " STRINGIFY(FLEX_PREHEAT_HOTEND_TEMP)): PSTR("FLEX - " STRINGIFY(FLEX_PREHEAT_HOTEND_TEMP) "/" STRINGIFY(FLEX_PREHEAT_HPB_TEMP)), mFilamentItem_FLEX);
}
if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) && eFilamentAction == FilamentAction::Preheat) MENU_ITEM_FUNCTION_P(_T(MSG_COOLDOWN), lcd_cooldown);
MENU_END();
Expand Down Expand Up @@ -4731,6 +4752,9 @@ static void lcd_settings_menu()
}
#endif //LCD_BL_PIN

//! Enables/disables the bed heating while heating the nozzle for loading/unloading filament
MENU_ITEM_TOGGLE_P(_N("HeatBedOnLoad"), eeprom_read_byte((uint8_t *)EEPROM_HEAT_BED_ON_LOAD_FILAMENT) ? _T(MSG_YES) : _T(MSG_NO), lcd_heat_bed_on_load_toggle);

if (farm_mode)
{
MENU_ITEM_FUNCTION_P(PSTR("Disable farm mode"), lcd_disable_farm_mode);
Expand Down Expand Up @@ -7766,3 +7790,13 @@ void lcd_pinda_temp_compensation_toggle()
SERIAL_ECHOLN(pinda_temp_compensation);
}
#endif //PINDA_TEMP_COMP

void lcd_heat_bed_on_load_toggle()
{
uint8_t value = eeprom_read_byte((uint8_t*)EEPROM_HEAT_BED_ON_LOAD_FILAMENT);
if (value > 1)
value = 1;
else
value = !value;
eeprom_update_byte((uint8_t*)EEPROM_HEAT_BED_ON_LOAD_FILAMENT, value);
}
2 changes: 2 additions & 0 deletions Firmware/ultralcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,6 @@ uint8_t lcdui_print_extruder(void);
extern void lcd_pinda_temp_compensation_toggle();
#endif //PINDA_TEMP_COMP

extern void lcd_heat_bed_on_load_toggle();

#endif //ULTRALCD_H

0 comments on commit 92f2281

Please sign in to comment.