Browse Source

New filament sensor

Robert Pelnar 5 years ago
parent
commit
6157c3ab32

+ 9 - 0
Firmware/Marlin_main.cpp

@@ -1813,6 +1813,15 @@ void loop()
   isPrintPaused ? manage_inactivity(true) : manage_inactivity(false);
   checkHitEndstops();
   lcd_update(0);
+#ifdef NEW_FILAMENT_SENSOR
+	if (mcode_in_progress != 600 && !mmu_enabled) //M600 not in progress
+	{
+		if (IS_SD_PRINTING)
+		{
+			fsensor_update();
+		}
+	}
+#endif //NEW_FILAMENT_SENSOR
 #ifdef TMC2130
 	tmc2130_check_overtemp();
 	if (tmc2130_sg_crash)

+ 13 - 0
Firmware/fsensor.cpp

@@ -477,6 +477,18 @@ void fsensor_st_block_chunk(block_t* bl, int cnt)
 //! If there is still no plausible signal from filament sensor plans M600 (Filament change).
 void fsensor_update(void)
 {
+#ifdef NEW_FILAMENT_SENSOR
+	if (digitalRead(A8) == 1)
+	{
+		fsensor_stop_and_save_print();
+		printf_P(PSTR("fsensor_update - M600\n"));
+		eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1);
+		eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1);
+		enquecommand_front_P(PSTR("FSENSOR_RECOVER"));
+		enquecommand_front_P((PSTR("M600")));
+		fsensor_watch_runout = false;
+	}
+#else //NEW_FILAMENT_SENSOR
 	if (fsensor_enabled && fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX))
 	{
         bool autoload_enabled_tmp = fsensor_autoload_enabled;
@@ -527,6 +539,7 @@ void fsensor_update(void)
         fsensor_autoload_enabled = autoload_enabled_tmp;
 		fsensor_oq_meassure_enabled = oq_meassure_enabled_tmp;
 	}
+#endif //NEW_FILAMENT_SENSOR
 }
 
 void fsensor_setup_interrupt(void)

+ 1 - 0
Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h

@@ -134,6 +134,7 @@
 // Filament sensor
 #define PAT9125
 #define FILAMENT_SENSOR
+//#define NEW_FILAMENT_SENSOR
 
 // Backlash - 
 //#define BACKLASH_X