Merge pull request #3251 from gudnimg/farm-mode-setup-gudni

Optimize `farm_mode` initialisation in `setup()`
This commit is contained in:
Alex Voinea 2022-02-09 13:48:12 +01:00 committed by GitHub
commit 6aaf784975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1102,10 +1102,10 @@ void setup()
setup_powerhold(); setup_powerhold();
farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE); farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
if (farm_mode == 0xFF) if (farm_mode == 0xFF) {
farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode
if (farm_mode) eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode);
{ } else if (farm_mode) {
no_response = true; //we need confirmation by recieving PRUSA thx no_response = true; //we need confirmation by recieving PRUSA thx
important_status = 8; important_status = 8;
prusa_statistics(8); prusa_statistics(8);
@ -1117,9 +1117,8 @@ void setup()
//disabled filament autoload (PFW360) //disabled filament autoload (PFW360)
fsensor_autoload_set(false); fsensor_autoload_set(false);
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
// ~ FanCheck -> on // ~ FanCheck -> on
if(!(eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED))) eeprom_update_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED, true);
eeprom_update_byte((unsigned char *)EEPROM_FAN_CHECK_ENABLED,true);
} }
#ifdef TMC2130 #ifdef TMC2130
@ -1441,12 +1440,11 @@ void setup()
enable_z(); enable_z();
#endif #endif
farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE); if (farm_mode) {
if (farm_mode == 0xFF) farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode // The farm monitoring SW may accidentally expect
if (farm_mode) // 2 messages of "printer started" to consider a printer working.
{ prusa_statistics(8);
prusa_statistics(8); }
}
// Enable Toshiba FlashAir SD card / WiFi enahanced card. // Enable Toshiba FlashAir SD card / WiFi enahanced card.
card.ToshibaFlashAir_enable(eeprom_read_byte((unsigned char*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY) == 1); card.ToshibaFlashAir_enable(eeprom_read_byte((unsigned char*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY) == 1);