!!! for testing only !!!

filament sensor auto-detection
This commit is contained in:
MRprusa3d 2020-03-02 19:07:23 +01:00
parent ec5e54de25
commit 2a9504b20a
4 changed files with 40 additions and 47 deletions

View File

@ -9439,12 +9439,11 @@ static void handleSafetyTimer()
} }
#endif //SAFETYTIMER #endif //SAFETYTIMER
extern bool bMenuDetect; / -> .h
extern void lcd_status_screen(); / -> .h & 'static'
void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h
{ {
bool bInhibitFlag;
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
bool bInhibitFlag;
if (mmu_enabled == false) if (mmu_enabled == false)
{ {
//-// if (mcode_in_progress != 600) //M600 not in progress //-// if (mcode_in_progress != 600) //M600 not in progress
@ -9453,38 +9452,28 @@ bool bInhibitFlag;
#endif // PAT9125 #endif // PAT9125
#ifdef IR_SENSOR #ifdef IR_SENSOR
bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active
//MYSERIAL.print("inhibit :: "); #ifdef IR_SENSOR_ANALOG
//MYSERIAL.println(bInhibitFlag); bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Settings::HWsetup::FSdetect menu active
// & IR_SENSOR_ANALOG ??? #endif // IR_SENSOR_ANALOG
//bInhibitFlag|=(menu_menu==lcd_detect_IRsensor); // Settings::HWsetup::FSdetect menu active
//.bInhibitFlag=bInhibitFlag||(menu_menu==lcd_detect_IRsensor); // Settings::HWsetup::FSdetect menu active
bInhibitFlag=bInhibitFlag||bMenuDetect; // Settings::HWsetup::FSdetect menu active
//MYSERIAL.print(" :: ");
//MYSERIAL.println(bInhibitFlag);
//MYSERIAL.println(current_voltage_raw_IR);
#endif // IR_SENSOR #endif // IR_SENSOR
if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active
{ {
if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && ! eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && ! eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE))
{ {
// ***** #ifdef IR_SENSOR_ANALOG
// & IR_SENSOR_ANALOG ??? bool bTemp=current_voltage_raw_IR>14000; // nahradit prumerem @ vicero hodnot
bool bTemp; bTemp=bTemp&&(target_temperature[0]==0); // & bed (& dalsi extrudery)
bTemp=current_voltage_raw_IR>14000; // nahradit prumerem @ vicero hodnot bTemp=bTemp&&(menu_menu==lcd_status_screen);
bTemp=bTemp&&(target_temperature[0]==0); // & bed (& dalsi extrudery) bTemp=bTemp&&((oFsensorPCB==ClFsensorPCB::_Old)||(oFsensorPCB==ClFsensorPCB::_Undef));
bTemp=bTemp&&(menu_menu==lcd_status_screen); bTemp=bTemp&&fsensor_enabled;
bTemp=bTemp&&((oFsensorPCB==ClFsensorPCB::_Old)||(oFsensorPCB==ClFsensorPCB::_Undef)); if(bTemp)
bTemp=bTemp&&fsensor_enabled; {
if(bTemp) oFsensorPCB=ClFsensorPCB::_Rev03b;
{ // eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB);
MYSERIAL.println(current_voltage_raw_IR); printf_P(PSTR("Filament sensor board change detected: revision 03b or newer\n"));
MYSERIAL.println("!!!!! -> 03b !!!!!"); lcd_setstatuspgm(_i("FS rev. 03b or newer"));
oFsensorPCB=ClFsensorPCB::_Rev03b; }
//bTemp=lcd_show_fullscreen_message_yes_no_and_wait_P(_i("?potvrdit?"),false,true); #endif // IR_SENSOR_ANALOG
//MYSERIAL.println(bTemp);
lcd_setstatuspgm(_i("!!! -> 03b !!!"));
}
// *****
if (fsensor_check_autoload()) if (fsensor_check_autoload())
{ {
#ifdef PAT9125 #ifdef PAT9125

View File

@ -55,8 +55,8 @@
#define W25X20CL_SPSR SPI_SPSR(W25X20CL_SPI_RATE) #define W25X20CL_SPSR SPI_SPSR(W25X20CL_SPI_RATE)
//LANG - Multi-language support //LANG - Multi-language support
#define LANG_MODE 0 // primary language only //#define LANG_MODE 0 // primary language only
//#define LANG_MODE 1 // sec. language support #define LANG_MODE 1 // sec. language support
#define LANG_SIZE_RESERVED 0x3000 // reserved space for secondary language (12288 bytes) #define LANG_SIZE_RESERVED 0x3000 // reserved space for secondary language (12288 bytes)

View File

@ -68,6 +68,10 @@ uint8_t SilentModeMenu_MMU = 1; //activate mmu unit stealth mode
int8_t FSensorStateMenu = 1; int8_t FSensorStateMenu = 1;
#if IR_SENSOR_ANALOG
bool bMenuFSDetect=false;
#endif //IR_SENSOR_ANALOG
#ifdef SDCARD_SORT_ALPHA #ifdef SDCARD_SORT_ALPHA
bool presort_flag = false; bool presort_flag = false;
@ -114,8 +118,7 @@ static const char* lcd_display_message_fullscreen_nonBlocking_P(const char *msg,
// void copy_and_scalePID_d(); // void copy_and_scalePID_d();
/* Different menus */ /* Different menus */
//-//static void lcd_status_screen(); //static void lcd_status_screen(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
void lcd_status_screen();
#if (LANG_MODE != 0) #if (LANG_MODE != 0)
static void lcd_language_menu(); static void lcd_language_menu();
#endif #endif
@ -237,8 +240,8 @@ static bool lcd_selftest_fsensor();
#endif //PAT9125 #endif //PAT9125
static bool selftest_irsensor(); static bool selftest_irsensor();
#if IR_SENSOR_ANALOG #if IR_SENSOR_ANALOG
static bool lcd_selftest_IRsensor(bool bStandalone = false); static bool lcd_selftest_IRsensor(bool bStandalone=false);
//-//static lcd_detect_IRsensor(); static void lcd_detect_IRsensor();
#endif //IR_SENSOR_ANALOG #endif //IR_SENSOR_ANALOG
static void lcd_selftest_error(TestError error, const char *_error_1, const char *_error_2); static void lcd_selftest_error(TestError error, const char *_error_1, const char *_error_2);
static void lcd_colorprint_change(); static void lcd_colorprint_change();
@ -977,7 +980,7 @@ void lcdui_print_status_screen(void)
} }
// Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent // Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent
static void lcd_status_screen() void lcd_status_screen() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
{ {
if (firstrun == 1) if (firstrun == 1)
{ {
@ -7552,24 +7555,22 @@ if((bPCBrev03b?1:0)!=(uint8_t)oFsensorPCB) // safer then "(uint8_t)bPCBre
return(true); return(true);
} }
bool bMenuDetect=false; static void lcd_detect_IRsensor()
//static void lcd_detect_IRsensor()
void lcd_detect_IRsensor()
{ {
bool bAction; bool bAction;
bMenuDetect=true; bMenuFSDetect=true; // inhibits some code inside "manage_inactivity()"
bAction=lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is the filament unloaded?"),false,true); bAction=lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is the filament unloaded?"),false,true);
if(!bAction) if(!bAction)
{ {
lcd_show_fullscreen_message_and_wait_P(_i("... vyjmi & opakuj ...")); lcd_show_fullscreen_message_and_wait_P(_i("... so unload the filament and repeat action!"));
return; return;
} }
bAction=lcd_selftest_IRsensor(true); bAction=lcd_selftest_IRsensor(true);
if(bAction) if(bAction)
lcd_show_fullscreen_message_and_wait_P(_i("... povedlo se - VYJMI!!! ...")); lcd_show_fullscreen_message_and_wait_P(_i("PCB check successful - withdraw the filament now!"));
else lcd_show_fullscreen_message_and_wait_P(_i("... NEpovedlo se - VYJMI!!!...")); else lcd_show_fullscreen_message_and_wait_P(_i("PCB check unsuccessful - withdraw the filament now!"));
bMenuDetect=false; bMenuFSDetect=false; // de-inhibits some code inside "manage_inactivity()"
} }
#endif //IR_SENSOR_ANALOG #endif //IR_SENSOR_ANALOG

View File

@ -55,11 +55,10 @@ extern bool lcd_selftest();
void lcd_menu_statistics(); void lcd_menu_statistics();
void lcd_status_screen(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") void lcd_menu_extruder_info(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") void lcd_menu_show_sensors_state(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
void lcd_detect_IRsensor(); // NOT static due to using inside "Marlin_main" module ("manage_inactivity()")
#ifdef TMC2130 #ifdef TMC2130
bool lcd_crash_detect_enabled(); bool lcd_crash_detect_enabled();
void lcd_crash_detect_enable(); void lcd_crash_detect_enable();
@ -141,6 +140,10 @@ extern uint8_t farm_status;
#define SILENT_MODE_OFF SILENT_MODE_POWER #define SILENT_MODE_OFF SILENT_MODE_POWER
#endif #endif
#if IR_SENSOR_ANALOG
extern bool bMenuFSDetect;
#endif //IR_SENSOR_ANALOG
extern int8_t SilentModeMenu; extern int8_t SilentModeMenu;
extern uint8_t SilentModeMenu_MMU; extern uint8_t SilentModeMenu_MMU;