Browse Source

Merge pull request #1279 from PavelSindler/turn_on_FINDA

mmu2: filament senor (FINDA) menu fix
mkbel 5 years ago
parent
commit
16c2f6fe8e
2 changed files with 24 additions and 17 deletions
  1. 22 15
      Firmware/fsensor.cpp
  2. 2 2
      Firmware/ultralcd.cpp

+ 22 - 15
Firmware/fsensor.cpp

@@ -11,6 +11,7 @@
 #include "cmdqueue.h"
 #include "ultralcd.h"
 #include "ConfigurationStore.h"
+#include "mmu.h"
 
 //! @name Basic parameters
 //! @{
@@ -143,21 +144,27 @@ void fsensor_init(void)
 
 bool fsensor_enable(void)
 {
-	uint8_t pat9125 = pat9125_init();
-    printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
-	if (pat9125)
-		fsensor_not_responding = false;
-	else
-		fsensor_not_responding = true;
-	fsensor_enabled = pat9125?true:false;
-	fsensor_watch_runout = true;
-	fsensor_oq_meassure = false;
-	fsensor_err_cnt = 0;
-	fsensor_dy_old = 0;
-	eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, fsensor_enabled?0x01:0x00); 
-	FSensorStateMenu = fsensor_enabled?1:0;
-
-
+	if (mmu_enabled == false) { //filament sensor is pat9125, enable only if it is working
+		uint8_t pat9125 = pat9125_init();
+		printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
+		if (pat9125)
+			fsensor_not_responding = false;
+		else
+			fsensor_not_responding = true;
+		fsensor_enabled = pat9125 ? true : false;
+		fsensor_watch_runout = true;
+		fsensor_oq_meassure = false;
+		fsensor_err_cnt = 0;
+		fsensor_dy_old = 0;
+		eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, fsensor_enabled ? 0x01 : 0x00);
+		FSensorStateMenu = fsensor_enabled ? 1 : 0;
+	}
+	else //filament sensor is FINDA, always enable 
+	{
+		fsensor_enabled = true;
+		eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x01);
+		FSensorStateMenu = 1;
+	}
 	return fsensor_enabled;
 }
 

+ 2 - 2
Firmware/ultralcd.cpp

@@ -4644,7 +4644,7 @@ do\
 {\
     if (FSensorStateMenu == 0)\
     {\
-        if (fsensor_not_responding)\
+        if (fsensor_not_responding && (mmu_enabled == false))\
         {\
             /* Filament sensor not working*/\
             MENU_ITEM_FUNCTION_P(_i("Fil. sensor [N/A]"), lcd_fsensor_state_set);/*////MSG_FSENSOR_NA c=0 r=0*/\
@@ -4654,7 +4654,7 @@ do\
         {\
             /* Filament sensor turned off, working, no problems*/\
             MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_OFF), lcd_fsensor_state_set);\
-            if (mmu_enabled == false)if (mmu_enabled == false)\
+            if (mmu_enabled == false)\
             {\
                 MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_filament_autoload_info);\
             }\