print parameters checking
nozzle diameter
This commit is contained in:
parent
42036270cf
commit
1f131f66e0
@ -214,8 +214,6 @@ static LongTimer crashDetTimer;
|
||||
bool mesh_bed_leveling_flag = false;
|
||||
bool mesh_bed_run_from_menu = false;
|
||||
|
||||
int8_t FarmMode = 0;
|
||||
|
||||
bool prusa_sd_card_upload = false;
|
||||
|
||||
unsigned int status_number = 0;
|
||||
@ -1617,6 +1615,7 @@ void setup()
|
||||
|
||||
}
|
||||
#endif //UVLO_SUPPORT
|
||||
fCheckModeInit();
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
#ifdef WATCHDOG
|
||||
wdt_enable(WDTO_4S);
|
||||
@ -3578,7 +3577,39 @@ void process_commands()
|
||||
} else if(code_seen("FR")) { //! PRUSA FR
|
||||
// Factory full reset
|
||||
factory_reset(0);
|
||||
}
|
||||
|
||||
//-//
|
||||
/*
|
||||
} else if(code_seen("qqq")) {
|
||||
MYSERIAL.println("=== checking ===");
|
||||
MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODE),DEC);
|
||||
MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER),DEC);
|
||||
MYSERIAL.println(eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM),DEC);
|
||||
MYSERIAL.println(farm_mode,DEC);
|
||||
MYSERIAL.println(eCheckMode,DEC);
|
||||
} else if(code_seen("www")) {
|
||||
MYSERIAL.println("=== @ FF ===");
|
||||
eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,0xFF);
|
||||
eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,0xFF);
|
||||
eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,0xFFFF);
|
||||
*/
|
||||
} else if (code_seen("nozzle")) { //! PRUSA nozzle
|
||||
uint16_t nDiameter;
|
||||
if(code_seen('D'))
|
||||
{
|
||||
nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um]
|
||||
nozzle_diameter_check(nDiameter);
|
||||
}
|
||||
else if(code_seen("set") && farm_mode)
|
||||
{
|
||||
strchr_pointer++; // skip 2nd char (~ 'e')
|
||||
strchr_pointer++; // skip 3rd char (~ 't')
|
||||
nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um]
|
||||
eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)e_NOZZLE_DIAMETER_NULL); // for correct synchronization after farm-mode exiting
|
||||
eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter);
|
||||
}
|
||||
else SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0);
|
||||
}
|
||||
//else if (code_seen('Cal')) {
|
||||
// lcd_calibration();
|
||||
// }
|
||||
@ -4854,6 +4885,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
|
||||
SilentModeMenu = SILENT_MODE_OFF;
|
||||
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
|
||||
fCheckModeInit(); // alternatively invoke printer reset
|
||||
break;
|
||||
|
||||
case 99: //! G99 (deactivate farm mode)
|
||||
@ -4861,6 +4893,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
lcd_printer_connected();
|
||||
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
||||
lcd_update(2);
|
||||
fCheckModeInit(); // alternatively invoke printer reset
|
||||
break;
|
||||
default:
|
||||
printf_P(PSTR("Unknown G code: %s \n"), cmdbuffer + bufindr + CMDHDRSIZE);
|
||||
|
@ -156,6 +156,10 @@
|
||||
#define EEPROM_MMU_CUTTER_ENABLED (EEPROM_MMU_LOAD_FAIL - 1)
|
||||
#define EEPROM_UVLO_MESH_BED_LEVELING_FULL (EEPROM_MMU_CUTTER_ENABLED - 12*12*2) //allow 12 calibration points for future expansion
|
||||
|
||||
#define EEPROM_CHECK_MODE (EEPROM_UVLO_MESH_BED_LEVELING_FULL-1) // uint8
|
||||
#define EEPROM_NOZZLE_DIAMETER (EEPROM_CHECK_MODE-1) // uint8
|
||||
#define EEPROM_NOZZLE_DIAMETER_uM (EEPROM_NOZZLE_DIAMETER-2) // uint16
|
||||
|
||||
// !!!!!
|
||||
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
|
||||
// !!!!!
|
||||
|
@ -5350,6 +5350,101 @@ do\
|
||||
}\
|
||||
while (0)
|
||||
|
||||
//-//
|
||||
static void lcd_check_mode_set(void)
|
||||
{
|
||||
switch(eCheckMode)
|
||||
{
|
||||
case e_CHECK_MODE_none:
|
||||
eCheckMode=e_CHECK_MODE_warn;
|
||||
break;
|
||||
case e_CHECK_MODE_warn:
|
||||
eCheckMode=e_CHECK_MODE_strict;
|
||||
break;
|
||||
case e_CHECK_MODE_strict:
|
||||
eCheckMode=e_CHECK_MODE_none;
|
||||
break;
|
||||
default:
|
||||
eCheckMode=e_CHECK_MODE_none;
|
||||
}
|
||||
eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)eCheckMode);
|
||||
}
|
||||
|
||||
static void lcd_nozzle_diameter_set(void)
|
||||
{
|
||||
uint16_t nDiameter;
|
||||
|
||||
switch(eNozzleDiameter)
|
||||
{
|
||||
case e_NOZZLE_DIAMETER_250:
|
||||
eNozzleDiameter=e_NOZZLE_DIAMETER_400;
|
||||
nDiameter=400;
|
||||
break;
|
||||
case e_NOZZLE_DIAMETER_400:
|
||||
eNozzleDiameter=e_NOZZLE_DIAMETER_600;
|
||||
nDiameter=600;
|
||||
break;
|
||||
case e_NOZZLE_DIAMETER_600:
|
||||
eNozzleDiameter=e_NOZZLE_DIAMETER_250;
|
||||
nDiameter=250;
|
||||
break;
|
||||
default:
|
||||
eNozzleDiameter=e_NOZZLE_DIAMETER_400;
|
||||
nDiameter=400;
|
||||
}
|
||||
eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)eNozzleDiameter);
|
||||
eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter);
|
||||
}
|
||||
|
||||
#define SETTINGS_MODE \
|
||||
do\
|
||||
{\
|
||||
switch(eCheckMode)\
|
||||
{\
|
||||
case e_CHECK_MODE_none:\
|
||||
MENU_ITEM_FUNCTION_P(_i("Action [none]"),lcd_check_mode_set);\
|
||||
break;\
|
||||
case e_CHECK_MODE_warn:\
|
||||
MENU_ITEM_FUNCTION_P(_i("Action [warn]"),lcd_check_mode_set);\
|
||||
break;\
|
||||
case e_CHECK_MODE_strict:\
|
||||
MENU_ITEM_FUNCTION_P(_i("Action [strict]"),lcd_check_mode_set);\
|
||||
break;\
|
||||
default:\
|
||||
MENU_ITEM_FUNCTION_P(_i("Action [none]"),lcd_check_mode_set);\
|
||||
}\
|
||||
}\
|
||||
while (0)
|
||||
|
||||
#define SETTINGS_NOZZLE \
|
||||
do\
|
||||
{\
|
||||
switch(eNozzleDiameter)\
|
||||
{\
|
||||
case e_NOZZLE_DIAMETER_250:\
|
||||
MENU_ITEM_FUNCTION_P(_i("Nozzle [0.25]"),lcd_nozzle_diameter_set);\
|
||||
break;\
|
||||
case e_NOZZLE_DIAMETER_400:\
|
||||
MENU_ITEM_FUNCTION_P(_i("Nozzle [0.40]"),lcd_nozzle_diameter_set);\
|
||||
break;\
|
||||
case e_NOZZLE_DIAMETER_600:\
|
||||
MENU_ITEM_FUNCTION_P(_i("Nozzle [0.60]"),lcd_nozzle_diameter_set);\
|
||||
break;\
|
||||
default:\
|
||||
MENU_ITEM_FUNCTION_P(_i("Nozzle [0.40]"),lcd_nozzle_diameter_set);\
|
||||
}\
|
||||
}\
|
||||
while (0)
|
||||
|
||||
static void lcd_checking_menu()
|
||||
{
|
||||
MENU_BEGIN();
|
||||
MENU_ITEM_BACK_P(_T(MSG_SETTINGS));
|
||||
SETTINGS_MODE;
|
||||
SETTINGS_NOZZLE;
|
||||
MENU_END();
|
||||
}
|
||||
|
||||
static void lcd_settings_menu()
|
||||
{
|
||||
EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu));
|
||||
@ -5398,6 +5493,9 @@ static void lcd_settings_menu()
|
||||
MENU_ITEM_SUBMENU_P(_i("Select language"), lcd_language_menu);////MSG_LANGUAGE_SELECT c=0 r=0
|
||||
#endif //(LANG_MODE != 0)
|
||||
|
||||
if (!farm_mode)
|
||||
MENU_ITEM_SUBMENU_P(_i("Print checking"), lcd_checking_menu);
|
||||
|
||||
SETTINGS_SD;
|
||||
SETTINGS_SOUND;
|
||||
|
||||
@ -6660,6 +6758,12 @@ static void lcd_sd_updir()
|
||||
|
||||
void lcd_print_stop()
|
||||
{
|
||||
//-//
|
||||
if(!card.sdprinting)
|
||||
{
|
||||
SERIAL_ECHOLNPGM("// action:cancel"); // for Octoprint
|
||||
return;
|
||||
}
|
||||
saved_printing = false;
|
||||
cancel_heatup = true;
|
||||
#ifdef MESH_BED_LEVELING
|
||||
|
@ -138,14 +138,14 @@ void extr_unload();
|
||||
|
||||
typedef enum
|
||||
{
|
||||
e_FILAMENT_ACTION_none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state)
|
||||
e_FILAMENT_ACTION_none, //!< 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state)
|
||||
e_FILAMENT_ACTION_Load,
|
||||
e_FILAMENT_ACTION_autoLoad,
|
||||
e_FILAMENT_ACTION_unLoad,
|
||||
e_FILAMENT_ACTION_mmuLoad,
|
||||
e_FILAMENT_ACTION_mmuUnLoad,
|
||||
e_FILAMENT_ACTION_mmuEject,
|
||||
e_FILAMENT_ACTION_mmuCut,
|
||||
e_FILAMENT_ACTION_mmuCut
|
||||
} eFILAMENT_ACTION;
|
||||
extern eFILAMENT_ACTION eFilamentAction;
|
||||
extern bool bFilamentFirstRun;
|
||||
|
@ -327,3 +327,46 @@ void update_current_firmware_version_to_eeprom()
|
||||
eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR, ver_current[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-//
|
||||
eNOZZLE_DIAMETER eNozzleDiameter=e_NOZZLE_DIAMETER_400;
|
||||
eCHECK_MODE eCheckMode=e_CHECK_MODE_none;
|
||||
|
||||
void fCheckModeInit()
|
||||
{
|
||||
eCheckMode=(eCHECK_MODE)eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODE);
|
||||
if(eCheckMode==e_CHECK_MODE_NULL)
|
||||
{
|
||||
eCheckMode=e_CHECK_MODE_warn;
|
||||
eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)eCheckMode);
|
||||
}
|
||||
if(farm_mode)
|
||||
eCheckMode=e_CHECK_MODE_strict;
|
||||
eNozzleDiameter=(eNOZZLE_DIAMETER)eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER);
|
||||
if((eNozzleDiameter==e_NOZZLE_DIAMETER_NULL)&& !farm_mode)
|
||||
{
|
||||
eNozzleDiameter=e_NOZZLE_DIAMETER_400;
|
||||
eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)eNozzleDiameter);
|
||||
eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,400);
|
||||
}
|
||||
}
|
||||
|
||||
void nozzle_diameter_check(uint16_t nDiameter)
|
||||
{
|
||||
uint16_t nDiameter_um;
|
||||
|
||||
nDiameter_um=eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM);
|
||||
if(nDiameter==nDiameter_um)
|
||||
return;
|
||||
switch(eCheckMode)
|
||||
{
|
||||
case e_CHECK_MODE_warn:
|
||||
lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Press the knob to continue."));
|
||||
break;
|
||||
case e_CHECK_MODE_strict:
|
||||
lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Print is aborted, press the knob."));
|
||||
lcd_print_stop();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -33,4 +33,29 @@ inline void eeprom_update_int8(unsigned char* addr, int8_t v) {
|
||||
eeprom_update_byte(addr, *reinterpret_cast<uint8_t*>(&v));
|
||||
}
|
||||
|
||||
|
||||
//-//
|
||||
#define e_CHECK_MODE_NULL 0xFF
|
||||
#define e_NOZZLE_DIAMETER_NULL 0xFF
|
||||
|
||||
typedef enum
|
||||
{
|
||||
e_NOZZLE_DIAMETER_250,
|
||||
e_NOZZLE_DIAMETER_400,
|
||||
e_NOZZLE_DIAMETER_600
|
||||
} eNOZZLE_DIAMETER;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
e_CHECK_MODE_none,
|
||||
e_CHECK_MODE_warn,
|
||||
e_CHECK_MODE_strict
|
||||
} eCHECK_MODE;
|
||||
|
||||
extern eNOZZLE_DIAMETER eNozzleDiameter;
|
||||
extern eCHECK_MODE eCheckMode;
|
||||
|
||||
void fCheckModeInit();
|
||||
void nozzle_diameter_check(uint16_t nDiameter);
|
||||
|
||||
#endif /* UTIL_H */
|
||||
|
Loading…
Reference in New Issue
Block a user