소스 검색

Implement fsensor raii event suppression

Alex Voinea 3 년 전
부모
커밋
74fad4f8f6
1개의 변경된 파일16개의 추가작업 그리고 3개의 파일을 삭제
  1. 16 3
      Firmware/mmu2_fsensor.cpp

+ 16 - 3
Firmware/mmu2_fsensor.cpp

@@ -7,8 +7,21 @@ FilamentState WhereIsFilament(){
     return fsensor.getFilamentPresent() ? FilamentState::IN_NOZZLE : FilamentState::NOT_PRESENT;
 }
 
-// on AVR this does nothing
-BlockRunoutRAII::BlockRunoutRAII() { }
-BlockRunoutRAII::~BlockRunoutRAII() { }
+
+BlockRunoutRAII::BlockRunoutRAII() {
+#ifdef FILAMENT_SENSOR
+    fsensor.setRunoutEnabled(false); //suppress filament runouts while loading filament.
+    fsensor.setAutoLoadEnabled(false); //suppress filament autoloads while loading filament.
+#if (FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
+    fsensor.setJamDetectionEnabled(false); //suppress filament jam detection while loading filament.
+#endif //(FILAMENT_SENSOR_TYPE == FSENSOR_PAT9125)
+#endif
+}
+
+BlockRunoutRAII::~BlockRunoutRAII() {
+#ifdef FILAMENT_SENSOR
+    fsensor.settings_init(); // restore filament runout state.
+#endif
+}
 
 } // namespace MMU2