Checkpoint after a lot of removal

This commit is contained in:
Alex Voinea 2022-02-23 12:26:17 +01:00 committed by D.R.racer
parent 8fae5e708e
commit 5484882758
8 changed files with 129 additions and 226 deletions

View File

@ -1,3 +1,3 @@
#include "Filament_sensor.h"
IR_sensor_analog fsensor;
IR_sensor_analog fsensor;

View File

@ -22,6 +22,13 @@ public:
virtual bool update() = 0;
virtual bool getFilamentPresent() = 0;
enum class State : uint8_t {
disabled = 0,
ready,
initializing,
error,
};
enum class SensorActionOnError : uint8_t {
_Continue = 0,
_Pause = 1,
@ -35,6 +42,10 @@ public:
}
}
bool getAutoLoadEnabled() {
return autoLoadEnabled;
}
void setRunoutEnabled(bool state, bool updateEEPROM = false) {
runoutEnabled = state;
if (updateEEPROM) {
@ -42,22 +53,45 @@ public:
}
}
bool getRunoutEnabled() {
return runoutEnabled;
}
void setActionOnError(SensorActionOnError state, bool updateEEPROM = false) {
sensorActionOnError = state;
if (updateEEPROM) {
eeprom_update_byte((uint8_t *)EEPROM_FSENSOR_ACTION_NA, (uint8_t)state);
}
}
SensorActionOnError getActionOnError() {
return sensorActionOnError;
}
bool getFilamentLoadEvent() {
return postponedLoadEvent;
}
bool isError() {
return state == State::error;
}
bool isReady() {
return state == State::ready;
}
protected:
void settings_init() {
autoLoadEnabled = eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED);
runoutEnabled = eeprom_read_byte((uint8_t*)EEPROM_FSENSOR);
sensorActionOnError = (SensorActionOnError)eeprom_read_byte((uint8_t*)EEPROM_FSENSOR_ACTION_NA);
if (sensorActionOnError == SensorActionOnError::_Undef) {
sensorActionOnError = SensorActionOnError::_Pause;
sensorActionOnError = SensorActionOnError::_Continue;
}
}
bool checkFilamentEvents() {
if (!ready)
if (state != State::ready)
return false;
bool newFilamentPresent = getFilamentPresent();
@ -102,10 +136,10 @@ protected:
}
}
State state;
bool autoLoadEnabled;
bool runoutEnabled;
bool oldFilamentPresent; //for creating filament presence switching events.
bool ready;
bool postponedLoadEvent; //this event lasts exactly one update cycle. It is long enough to be able to do polling for load event.
SensorActionOnError sensorActionOnError;
};
@ -116,19 +150,18 @@ public:
SET_INPUT(IR_SENSOR_PIN); //input mode
WRITE(IR_SENSOR_PIN, 1); //pullup
settings_init();
state = State::initializing;
}
bool update() {
if (!ready) {
ready = true; //the IR sensor gets ready instantly as it's just a gpio read operation.
if (state == State::initializing) {
state = State::ready; //the IR sensor gets ready instantly as it's just a gpio read operation.
oldFilamentPresent = getFilamentPresent(); //initialize the current filament state so that we don't create a switching event right after the sensor is ready.
}
postponedLoadEvent = false;
bool event = checkFilamentEvents();
;//
return event;
}
@ -146,7 +179,7 @@ class IR_sensor_analog: public IR_sensor {
public:
void init() {
IR_sensor::init();
;//
settings_init();
}
bool update() {
@ -175,13 +208,13 @@ public:
//! So I'm waiting for a situation, when minVolt gets to range <0, 1.5> and maxVolt gets into range <3.0, 5>
//! If and only if minVolt is in range <0.3, 1.5> and maxVolt is in range <3.0, 4.6>, I'm considering a situation with the new fsensor
if(minVolt >= IRsensor_Ldiode_TRESHOLD && minVolt <= IRsensor_Lmax_TRESHOLD && maxVolt >= IRsensor_Hmin_TRESHOLD && maxVolt <= IRsensor_Hopen_TRESHOLD) {
IR_ANALOG_Check(SensorRevision::_Old, SensorRevision::_Rev04, _i("FS v0.4 or newer") ); ////MSG_FS_V_04_OR_NEWER c=18
IR_ANALOG_Check(SensorRevision::_Old, SensorRevision::_Rev04);
}
//! If and only if minVolt is in range <0.0, 0.3> and maxVolt is in range <4.6, 5.0V>, I'm considering a situation with the old fsensor
//! Note, we are not relying on one voltage here - getting just +5V can mean an old fsensor or a broken new sensor - that's why
//! we need to have both voltages detected correctly to allow switching back to the old fsensor.
else if( minVolt < IRsensor_Ldiode_TRESHOLD && maxVolt > IRsensor_Hopen_TRESHOLD && maxVolt <= IRsensor_VMax_TRESHOLD) {
IR_ANALOG_Check(SensorRevision::_Rev04, sensorRevision=SensorRevision::_Old, _i("FS v0.3 or older")); ////MSG_FS_V_03_OR_OLDER c=18
IR_ANALOG_Check(SensorRevision::_Rev04, SensorRevision::_Old);
}
@ -302,18 +335,27 @@ private:
/// Called from 2 spots which have a very similar behavior
/// 1: SensorRevision::_Old -> SensorRevision::_Rev04 and print _i("FS v0.4 or newer")
/// 2: SensorRevision::_Rev04 -> sensorRevision=SensorRevision::_Old and print _i("FS v0.3 or older")
void IR_ANALOG_Check(SensorRevision isVersion, SensorRevision switchTo, const char *statusLineTxt_P) {
void IR_ANALOG_Check(SensorRevision isVersion, SensorRevision switchTo) {
bool bTemp = (!CHECK_ALL_HEATERS);
bTemp = bTemp && (menu_menu == lcd_status_screen);
bTemp = bTemp && ((sensorRevision == isVersion) || (sensorRevision == SensorRevision::_Undef));
bTemp = bTemp && ready;
bTemp = bTemp && (state == State::ready);
if (bTemp) {
nFSCheckCount++;
if (nFSCheckCount > FS_CHECK_COUNT) {
nFSCheckCount = 0; // not necessary
setSensorRevision(switchTo, true);
printf_IRSensorAnalogBoardChange();
lcd_setstatuspgm(statusLineTxt_P);
switch (switchTo) {
case SensorRevision::_Old:
lcd_setstatuspgm(_T(MSG_FS_V_03_OR_OLDER)); ////MSG_FS_V_03_OR_OLDER c=18
break;
case SensorRevision::_Rev04:
lcd_setstatuspgm(_T(MSG_FS_V_04_OR_NEWER)); ////MSG_FS_V_04_OR_NEWER c=18
break;
default:
break;
}
}
}
else {

View File

@ -765,8 +765,8 @@ static void factory_reset(char level)
farm_disable();
#ifdef FILAMENT_SENSOR
fsensor_enable();
fsensor_autoload_set(true);
fsensor.setAutoLoadEnabled(true, true);
fsensor.setRunoutEnabled(true, true);
#endif //FILAMENT_SENSOR
break;
@ -1498,10 +1498,6 @@ void setup()
setup_fan_interrupt();
#endif //DEBUG_DISABLE_FANCHECK
#ifdef PAT9125
fsensor_setup_interrupt();
#endif //PAT9125
#ifndef DEBUG_DISABLE_STARTMSGS
KEEPALIVE_STATE(PAUSED_FOR_USER);
@ -11549,9 +11545,6 @@ void M600_load_filament() {
//load_filament_time = _millis();
KEEPALIVE_STATE(PAUSED_FOR_USER);
#ifdef PAT9125
fsensor_autoload_check_start();
#endif //PAT9125
while(!lcd_clicked())
{
manage_heater();
@ -11563,9 +11556,6 @@ void M600_load_filament() {
}
#endif //FILAMENT_SENSOR
}
#ifdef PAT9125
fsensor_autoload_check_stop();
#endif //PAT9125
KEEPALIVE_STATE(IN_HANDLER);
M600_load_filament_movements();

View File

@ -6,51 +6,15 @@
#include "config.h"
// enable/disable flag
extern bool fsensor_enabled;
// not responding flag
extern bool fsensor_not_responding;
#ifdef PAT9125
// optical checking "chunk lenght" (already in steps)
extern int16_t fsensor_chunk_len;
// count of soft failures
extern uint8_t fsensor_softfail;
#endif
//! @name save restore printing
//! @{
//! split the current gcode stream to insert new instructions
extern void fsensor_checkpoint_print(void);
//! @}
#ifdef PAT9125
//! update axis resolution
extern void fsensor_set_axis_steps_per_unit(float u);
#endif
//! @name enable/disable
//! @{
extern bool fsensor_enable(bool bUpdateEEPROM=true);
extern void fsensor_disable(bool bUpdateEEPROM=true);
//! @}
//autoload feature enabled
extern bool fsensor_autoload_enabled;
extern void fsensor_autoload_set(bool State);
#ifdef PAT9125
//! setup pin-change interrupt
extern void fsensor_setup_interrupt(void);
//! @name autoload support
//! @{
extern void fsensor_autoload_check_start(void);
extern void fsensor_autoload_check_stop(void);
#endif //PAT9125
//! @}
#ifdef PAT9125
//! @name callbacks from stepper
//! @{
extern void fsensor_st_block_chunk(int cnt);
@ -66,17 +30,4 @@ extern uint8_t fsensor_log;
//! @}
#endif //PAT9125
#ifdef IR_SENSOR_ANALOG
enum class ClFsensorActionNA:uint_least8_t
{
_Continue=0,
_Pause=1,
_Undef=EEPROM_EMPTY_VALUE
};
extern ClFsensorActionNA oFsensorActionNA;
#endif //IR_SENSOR_ANALOG
#endif //FSENSOR_H

View File

@ -155,6 +155,8 @@ const char MSG_TIMEOUT[] PROGMEM_I1 = ISTR("Timeout"); ////MSG_TIMEOUT c=12
const char MSG_BRIGHT[] PROGMEM_I1 = ISTR("Bright"); ////MSG_BRIGHT c=6
const char MSG_DIM[] PROGMEM_I1 = ISTR("Dim"); ////MSG_DIM c=6
const char MSG_AUTO[] PROGMEM_I1 = ISTR("Auto"); ////MSG_AUTO c=6
const char MSG_FS_V_03_OR_OLDER[] PROGMEM_I1 = ISTR("FS v0.3 or older"); ////c=18
const char MSG_FS_V_04_OR_NEWER[] PROGMEM_I1 = ISTR("FS v0.4 or newer"); ////c=18
#ifdef IR_SENSOR_ANALOG
// Beware - the space at the beginning is necessary since it is reused in LCD menu items which are to be with a space
const char MSG_IR_04_OR_NEWER[] PROGMEM_I1 = ISTR(" 0.4 or newer");////MSG_IR_04_OR_NEWER c=18

View File

@ -166,6 +166,8 @@ extern const char MSG_TIMEOUT[];
extern const char MSG_BRIGHT[];
extern const char MSG_DIM[];
extern const char MSG_AUTO[];
extern const char MSG_FS_V_03_OR_OLDER[];
extern const char MSG_FS_V_04_OR_NEWER[];
#ifdef IR_SENSOR_ANALOG
extern const char MSG_IR_04_OR_NEWER[];
extern const char MSG_IR_03_OR_OLDER[];

View File

@ -19,6 +19,7 @@
#include "AutoDeplete.h"
#include "fastio.h"
#include "pins.h"
#include "Filament_sensor.h"
//-//
#include "util.h"
@ -169,12 +170,7 @@ bool check_for_ir_sensor()
bool detected = false;
//if IR_SENSOR_PIN input is low and pat9125sensor is not present we detected idler sensor
if ((READ(IR_SENSOR_PIN) == 0)
#ifdef PAT9125
&& fsensor_not_responding
#endif //PAT9125
)
{
if ((READ(IR_SENSOR_PIN) == 0)) {
detected = true;
//printf_P(PSTR("Idler IR sensor detected\n"));
}
@ -380,8 +376,9 @@ void mmu_loop(void)
mmu_last_finda_response.start();
FDEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_finda);
//printf_P(PSTR("Eact: %d\n"), int(e_active()));
if (!mmu_finda && CHECK_FSENSOR && fsensor_enabled) {
fsensor_checkpoint_print();
if (!mmu_finda && CHECK_FSENSOR && fsensor.isReady()) {
stop_and_save_print_to_ram(0, 0);
restore_print_from_ram_and_continue(0);
if (mmu_extruder != MMU_FILAMENT_UNKNOWN) // Can't deplete unknown extruder.
ad_markDepleted(mmu_extruder);
if (lcd_autoDepleteEnabled() && !ad_allDepleted() && mmu_extruder != MMU_FILAMENT_UNKNOWN) // Can't auto if F=?

View File

@ -1788,10 +1788,6 @@ void lcd_cutter_enabled()
}
#endif //MMU_HAS_CUTTER
void lcd_set_filament_autoload() {
fsensor_autoload_set(!fsensor_autoload_enabled);
}
FilamentAction eFilamentAction=FilamentAction::None; // must be initialized as 'non-autoLoad'
bool bFilamentPreheatState;
bool bFilamentAction=false;
@ -2147,7 +2143,7 @@ void lcd_wait_interact() {
lcd_clear();
lcd_puts_at_P(0, 1, _i("Insert filament"));////MSG_INSERT_FILAMENT c=20
if (!fsensor_autoload_enabled) {
if (!fsensor.getAutoLoadEnabled()) {
lcd_puts_at_P(0, 2, _i("and press the knob"));////MSG_PRESS c=20 r=2
}
}
@ -3535,34 +3531,6 @@ static void lcd_crash_mode_info2()
}
#endif //TMC2130
#ifdef FILAMENT_SENSOR
static void lcd_filament_autoload_info()
{
uint8_t nlines;
lcd_update_enable(true);
static uint32_t tim = 0;
if ((tim + 1000) < _millis())
{
lcd_display_message_fullscreen_nonBlocking_P(_i("Autoloading filament available only when filament sensor is turned on..."), nlines); ////MSG_AUTOLOADING_ONLY_IF_FSENS_ON c=20 r=4
tim = _millis();
}
menu_back_if_clicked();
}
static void lcd_fsensor_fail()
{
uint8_t nlines;
lcd_update_enable(true);
static uint32_t tim = 0;
if ((tim + 1000) < _millis())
{
lcd_display_message_fullscreen_nonBlocking_P(_i("ERROR: Filament sensor is not responding, please check connection."), nlines);////MSG_FSENS_NOT_RESPONDING c=20 r=4
tim = _millis();
}
menu_back_if_clicked();
}
#endif //FILAMENT_SENSOR
//-//
static void lcd_sound_state_set(void)
{
@ -3635,19 +3603,12 @@ static void crash_mode_switch()
#ifdef FILAMENT_SENSOR
static void lcd_fsensor_state_set()
{
FSensorStateMenu = !FSensorStateMenu; //set also from fsensor_enable() and fsensor_disable()
if (!FSensorStateMenu) {
fsensor_disable();
if (fsensor_autoload_enabled && !mmu_enabled)
menu_submenu(lcd_filament_autoload_info);
}
else {
fsensor_enable();
if (fsensor_not_responding && !mmu_enabled)
menu_submenu(lcd_fsensor_fail);
}
static void lcd_fsensor_runout_set() {
fsensor.setRunoutEnabled(!fsensor.getRunoutEnabled(), true);
}
static void lcd_fsensor_autoload_set() {
fsensor.setAutoLoadEnabled(!fsensor.getAutoLoadEnabled(), true);
}
#endif //FILAMENT_SENSOR
@ -3843,7 +3804,7 @@ void lcd_v2_calibration()
else if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE))
{
bool loaded = false;
if (fsensor_enabled && ir_sensor_detected)
if (fsensor.isReady())
{
loaded = fsensor.getFilamentPresent();
}
@ -3950,7 +3911,7 @@ static void lcd_wizard_load()
bool lcd_autoDepleteEnabled()
{
return (lcd_autoDeplete && fsensor_enabled);
return (lcd_autoDeplete && fsensor.isReady());
}
static void wizard_lay1cal_message(bool cold)
@ -4214,44 +4175,22 @@ void lcd_settings_linearity_correction_menu(void)
#endif // TMC2130
#ifdef FILAMENT_SENSOR
#define SETTINGS_FILAMENT_SENSOR \
do\
{\
if (FSensorStateMenu == 0)\
{\
if (fsensor_not_responding && (mmu_enabled == false))\
{\
/* Filament sensor not working*/\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), _T(MSG_NA), lcd_fsensor_state_set);\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR_AUTOLOAD), NULL, lcd_fsensor_fail);\
}\
else\
{\
/* Filament sensor turned off, working, no problems*/\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), _T(MSG_OFF), lcd_fsensor_state_set);\
if (mmu_enabled == false)\
{\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR_AUTOLOAD), NULL, lcd_filament_autoload_info);\
}\
}\
}\
else\
{\
/* Filament sensor turned on, working, no problems*/\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), _T(MSG_ON), lcd_fsensor_state_set);\
if (mmu_enabled == false)\
{\
if (fsensor_autoload_enabled)\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR_AUTOLOAD), _T(MSG_ON), lcd_set_filament_autoload);/*////MSG_FSENS_AUTOLOAD_ON c=17*/\
else\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR_AUTOLOAD), _T(MSG_OFF), lcd_set_filament_autoload);/*////MSG_FSENS_AUTOLOAD_OFF c=17*/\
}\
}\
}\
while(0)
#else //FILAMENT_SENSOR
#define SETTINGS_FILAMENT_SENSOR do{}while(0)
void fsensor_reinit() {
fsensor.init();
}
#define SETTINGS_FILAMENT_SENSOR \
do {\
if (fsensor.isError()) {\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), NULL, fsensor_reinit);\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR_AUTOLOAD), NULL, fsensor_reinit);\
}\
else {\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), fsensor.getRunoutEnabled() ? _T(MSG_ON) : _T(MSG_OFF), lcd_fsensor_runout_set);\
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR_AUTOLOAD), fsensor.getAutoLoadEnabled() ? _T(MSG_ON) : _T(MSG_OFF), lcd_fsensor_autoload_set);\
}\
} while(0)
#endif //FILAMENT_SENSOR
static void auto_deplete_switch()
@ -4264,17 +4203,11 @@ static void settingsAutoDeplete()
{
if (mmu_enabled)
{
if (!fsensor_enabled)
{
MENU_ITEM_TOGGLE_P(MSG_AUTO_DEPLETE, _T(MSG_NA), NULL);
if (fsensor.isError()) {
MENU_ITEM_TOGGLE_P(_T(MSG_AUTO_DEPLETE), NULL, fsensor_reinit);
}
else if (lcd_autoDeplete)
{
MENU_ITEM_TOGGLE_P(MSG_AUTO_DEPLETE, _T(MSG_ON), auto_deplete_switch);
}
else
{
MENU_ITEM_TOGGLE_P(MSG_AUTO_DEPLETE, _T(MSG_OFF), auto_deplete_switch);
else {
MENU_ITEM_TOGGLE_P(_T(MSG_AUTO_DEPLETE), lcd_autoDeplete ? _T(MSG_ON) : _T(MSG_OFF), auto_deplete_switch);
}
}
}
@ -4671,40 +4604,35 @@ SETTINGS_VERSION;
MENU_END();
}
#ifdef IR_SENSOR_ANALOG
static void lcd_fsensor_actionNA_set(void)
{
switch(oFsensorActionNA)
{
case ClFsensorActionNA::_Continue:
oFsensorActionNA=ClFsensorActionNA::_Pause;
break;
case ClFsensorActionNA::_Pause:
oFsensorActionNA=ClFsensorActionNA::_Continue;
break;
default:
oFsensorActionNA=ClFsensorActionNA::_Continue;
}
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_ACTION_NA,(uint8_t)oFsensorActionNA);
Filament_sensor::SensorActionOnError act = fsensor.getActionOnError();
switch(act) {
case Filament_sensor::SensorActionOnError::_Continue:
act = Filament_sensor::SensorActionOnError::_Pause;
break;
case Filament_sensor::SensorActionOnError::_Pause:
act = Filament_sensor::SensorActionOnError::_Continue;
break;
default:
act = Filament_sensor::SensorActionOnError::_Continue;
}
fsensor.setActionOnError(act, true);
}
#define FSENSOR_ACTION_NA \
do\
{\
switch(oFsensorActionNA)\
{\
case ClFsensorActionNA::_Continue:\
MENU_ITEM_TOGGLE_P(_T(MSG_FS_ACTION), _T(MSG_CONTINUE_SHORT), lcd_fsensor_actionNA_set);\
do {\
switch(fsensor.getActionOnError()) {\
case Filament_sensor::SensorActionOnError::_Continue:\
MENU_ITEM_TOGGLE_P(_T(MSG_FS_ACTION), _T(MSG_FS_CONTINUE), lcd_fsensor_actionNA_set);\
break;\
case ClFsensorActionNA::_Pause:\
MENU_ITEM_TOGGLE_P(_T(MSG_FS_ACTION), _T(MSG_PAUSE), lcd_fsensor_actionNA_set);\
case Filament_sensor::SensorActionOnError::_Pause:\
MENU_ITEM_TOGGLE_P(_T(MSG_FS_ACTION), _T(MSG_FS_PAUSE), lcd_fsensor_actionNA_set);\
break;\
default:\
oFsensorActionNA=ClFsensorActionNA::_Continue;\
lcd_fsensor_actionNA_set();\
}\
}\
while (0)
#endif //IR_SENSOR_ANALOG
} while (0)
template <uint8_t number>
static void select_sheet_menu()
@ -4758,7 +4686,6 @@ void lcd_hw_setup_menu(void) // can not be "static"
MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu); ////MSG_CHECKS c=18
#ifdef IR_SENSOR_ANALOG
FSENSOR_ACTION_NA;
//! Fsensor Detection isn't ready for mmu yet it is temporarily disabled.
//! @todo Don't forget to remove this as soon Fsensor Detection works with mmu
if(!mmu_enabled) MENU_ITEM_FUNCTION_P(PSTR("Fsensor Detection"), lcd_detect_IRsensor);
@ -4795,7 +4722,12 @@ static void lcd_settings_menu()
MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS c=18
}
SETTINGS_FILAMENT_SENSOR;
#ifdef FILAMENT_SENSOR
SETTINGS_FILAMENT_SENSOR;
#ifdef IR_SENSOR_ANALOG
FSENSOR_ACTION_NA;
#endif //IR_SENSOR_ANALOG
#endif //FILAMENT_SENSOR
SETTINGS_AUTO_DEPLETE;
@ -5563,8 +5495,9 @@ static void lcd_main_menu()
#endif //MMU_HAS_CUTTER
} else {
#ifdef FILAMENT_SENSOR
if ((fsensor_autoload_enabled == true) && (fsensor_enabled == true) && (mmu_enabled == false))
if (fsensor.getAutoLoadEnabled() && (mmu_enabled == false)) {
MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=18
}
else
#endif //FILAMENT_SENSOR
{
@ -5726,21 +5659,9 @@ static void lcd_tune_menu()
#endif
#ifdef FILAMENT_SENSOR
if (FSensorStateMenu == 0) {
if (fsensor_not_responding && (mmu_enabled == false)) {
/* Filament sensor not working*/
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), _T(MSG_NA), lcd_fsensor_state_set);
}
else {
/* Filament sensor turned off, working, no problems*/
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), _T(MSG_OFF), lcd_fsensor_state_set);
}
}
else {
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), _T(MSG_ON), lcd_fsensor_state_set);
}
SETTINGS_FILAMENT_SENSOR;
#ifdef IR_SENSOR_ANALOG
FSENSOR_ACTION_NA;
FSENSOR_ACTION_NA;
#endif //IR_SENSOR_ANALOG
#endif //FILAMENT_SENSOR
@ -6251,11 +6172,9 @@ static void lcd_detect_IRsensor(){
}
if(bAction){
lcd_show_fullscreen_message_and_wait_P(_i("Sensor verified, remove the filament now."));////MSG_FS_VERIFIED c=20 r=3
// the fsensor board has been successfully identified, any previous "not responding" may be cleared now
fsensor_not_responding = false;
fsensor.init();
} else {
lcd_show_fullscreen_message_and_wait_P(_i("Verification failed, remove the filament and try again."));////MSG_FIL_FAILED c=20 r=5
// here it is unclear what to to with the fsensor_not_responding flag
}
}
#endif //IR_SENSOR_ANALOG
@ -7053,12 +6972,12 @@ static void lcd_selftest_error(TestError testError, const char *_error_1, const
#ifdef PAT9125
static bool lcd_selftest_fsensor(void)
{
// fsensor.init();
if (fsensor_not_responding)
fsensor.init();
if (fsensor.isError())
{
lcd_selftest_error(TestError::WiringFsensor, "", "");
}
return (!fsensor_not_responding);
return (!fsensor.isError());
}
#endif //PAT9125