Browse Source

default nozzle diameter for farm mode

MRprusa3d 4 years ago
parent
commit
89de5aac77
3 changed files with 8 additions and 1 deletions
  1. 1 0
      Firmware/eeprom.h
  2. 5 1
      Firmware/util.cpp
  3. 2 0
      Firmware/util.h

+ 1 - 0
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

+ 5 - 1
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)

+ 2 - 0
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,