From f71bbfe95e5eab4d52af21f455a93bdfe2d417ab Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 10 Mar 2020 00:11:17 +0100 Subject: [PATCH] tresholds specification, steady delay --- Firmware/Marlin_main.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index dd1a9e72..6b5f2470 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9440,10 +9440,14 @@ static void handleSafetyTimer() } #endif //SAFETYTIMER +#define FS_CHECK_COUNT 15 void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h { #ifdef FILAMENT_SENSOR bool bInhibitFlag; +#if IR_SENSOR_ANALOG +static uint8_t nFSCheckCount=0; +#endif // IR_SENSOR_ANALOG if (mmu_enabled == false) { @@ -9462,18 +9466,25 @@ bool bInhibitFlag; if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && ! eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { #if IR_SENSOR_ANALOG - bool bTemp=current_voltage_raw_IR>14000; // nahradit prumerem @ vicero hodnot + bool bTemp=current_voltage_raw_IR>IRsensor_Hmin_TRESHOLD; + bTemp=bTemp&¤t_voltage_raw_IRFS_CHECK_COUNT) + { + nFSCheckCount=0; // not necessary + oFsensorPCB=ClFsensorPCB::_Rev03b; +// eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB); + printf_P(PSTR("Filament sensor board change detected: revision 03b or newer\n")); + lcd_setstatuspgm(_i("FS rev. 03b or newer")); + } } + else nFSCheckCount=0; #endif // IR_SENSOR_ANALOG if (fsensor_check_autoload()) {