mmu2: filament senor (FINDA) can be switched ON/OFF from menu without dependency on pat9125 state

This commit is contained in:
PavelSindler 2018-10-25 18:26:26 +02:00
parent 2566ae0b08
commit a6a81c6ea6
2 changed files with 24 additions and 17 deletions

View File

@ -7,6 +7,7 @@
#include "planner.h" #include "planner.h"
#include "fastio.h" #include "fastio.h"
#include "cmdqueue.h" #include "cmdqueue.h"
#include "mmu.h"
//Basic params //Basic params
#define FSENSOR_CHUNK_LEN 0.64F //filament sensor chunk length 0.64mm #define FSENSOR_CHUNK_LEN 0.64F //filament sensor chunk length 0.64mm
@ -136,21 +137,27 @@ void fsensor_init(void)
bool fsensor_enable(void) bool fsensor_enable(void)
{ {
uint8_t pat9125 = pat9125_init(); if (mmu_enabled == false) { //filament sensor is pat9125, enable only if it is working
printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125); uint8_t pat9125 = pat9125_init();
if (pat9125) printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
fsensor_not_responding = false; if (pat9125)
else fsensor_not_responding = false;
fsensor_not_responding = true; else
fsensor_enabled = pat9125?true:false; fsensor_not_responding = true;
fsensor_watch_runout = true; fsensor_enabled = pat9125 ? true : false;
fsensor_oq_meassure = false; fsensor_watch_runout = true;
fsensor_err_cnt = 0; fsensor_oq_meassure = false;
fsensor_dy_old = 0; fsensor_err_cnt = 0;
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, fsensor_enabled?0x01:0x00); fsensor_dy_old = 0;
FSensorStateMenu = fsensor_enabled?1: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; return fsensor_enabled;
} }

View File

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