From 89de5aac77f382fd0257fa3779fdd866f1ab2bf6 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 23 Sep 2019 17:13:33 +0200 Subject: [PATCH] default nozzle diameter for farm mode --- Firmware/eeprom.h | 1 + Firmware/util.cpp | 6 +++++- Firmware/util.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 482ddf932..8276d61a7 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -25,6 +25,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #endif #define EEPROM_EMPTY_VALUE 0xFF +#define EEPROM_EMPTY_VALUE16 0xFFFF // The total size of the EEPROM is // 4096 for the Atmega2560 #define EEPROM_TOP 4096 diff --git a/Firmware/util.cpp b/Firmware/util.cpp index aa1a624da..aac72ee0c 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -341,13 +341,17 @@ if(oCheckMode==ClCheckMode::_Undef) eeprom_update_byte((uint8_t*)EEPROM_CHECK_MODE,(uint8_t)oCheckMode); } if(farm_mode) + { oCheckMode=ClCheckMode::_Strict; + if(eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)==EEPROM_EMPTY_VALUE16) + eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,EEPROM_NOZZLE_DIAMETER_uM_DEFAULT); + } oNozzleDiameter=(ClNozzleDiameter)eeprom_read_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER); if((oNozzleDiameter==ClNozzleDiameter::_Diameter_Undef)&& !farm_mode) { oNozzleDiameter=ClNozzleDiameter::_Diameter_400; eeprom_update_byte((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)oNozzleDiameter); - eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,400); + eeprom_update_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,EEPROM_NOZZLE_DIAMETER_uM_DEFAULT); } oCheckModel=(ClCheckModel)eeprom_read_byte((uint8_t*)EEPROM_CHECK_MODEL); if(oCheckModel==ClCheckModel::_Undef) diff --git a/Firmware/util.h b/Firmware/util.h index a9bbcb1d6..8f23cd5c3 100644 --- a/Firmware/util.h +++ b/Firmware/util.h @@ -35,6 +35,8 @@ inline void eeprom_update_int8(unsigned char* addr, int8_t v) { //-// +#define EEPROM_NOZZLE_DIAMETER_uM_DEFAULT 400 + enum class ClPrintChecking:uint_least8_t { _Nozzle=1,