updated messages + slight refactoring to save some bytes
This commit is contained in:
parent
34ac2917ae
commit
818efb4fa2
@ -9480,7 +9480,7 @@ static uint8_t nFSCheckCount=0;
|
|||||||
nFSCheckCount=0; // not necessary
|
nFSCheckCount=0; // not necessary
|
||||||
oFsensorPCB=ClFsensorPCB::_Rev03b;
|
oFsensorPCB=ClFsensorPCB::_Rev03b;
|
||||||
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB);
|
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB);
|
||||||
printf_P(PSTR("Filament sensor board change detected: revision 03b or newer\n"));
|
printf_IRSensorAnalogBoardChange(true);
|
||||||
lcd_setstatuspgm(_i("FS rev. 03b or newer"));
|
lcd_setstatuspgm(_i("FS rev. 03b or newer"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2160,10 +2160,8 @@ static void lcd_support_menu()
|
|||||||
MENU_ITEM_BACK_P(PSTR(" 03b or newer"));
|
MENU_ITEM_BACK_P(PSTR(" 03b or newer"));
|
||||||
break;
|
break;
|
||||||
case ClFsensorPCB::_Undef:
|
case ClFsensorPCB::_Undef:
|
||||||
MENU_ITEM_BACK_P(PSTR(" N/A"));
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
MENU_ITEM_BACK_P(PSTR(" unknown"));
|
MENU_ITEM_BACK_P(PSTR(" state unknown"));
|
||||||
}
|
}
|
||||||
#endif // IR_SENSOR_ANALOG
|
#endif // IR_SENSOR_ANALOG
|
||||||
|
|
||||||
@ -5718,7 +5716,7 @@ void lcd_hw_setup_menu(void) // can not be "static"
|
|||||||
|
|
||||||
#ifdef IR_SENSOR_ANALOG
|
#ifdef IR_SENSOR_ANALOG
|
||||||
FSENSOR_ACTION_NA;
|
FSENSOR_ACTION_NA;
|
||||||
MENU_ITEM_FUNCTION_P(PSTR("FS Detect"), lcd_detect_IRsensor);
|
MENU_ITEM_FUNCTION_P(PSTR("Fsensor Detection"), lcd_detect_IRsensor);
|
||||||
#endif //IR_SENSOR_ANALOG
|
#endif //IR_SENSOR_ANALOG
|
||||||
MENU_END();
|
MENU_END();
|
||||||
}
|
}
|
||||||
@ -7518,6 +7516,11 @@ void lcd_belttest()
|
|||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
|
||||||
#ifdef IR_SENSOR_ANALOG
|
#ifdef IR_SENSOR_ANALOG
|
||||||
|
// called also from marlin_main.cpp
|
||||||
|
void printf_IRSensorAnalogBoardChange(bool bPCBrev03b){
|
||||||
|
printf_P(PSTR("Filament sensor board change detected: revision %S\n"), bPCBrev03b ? PSTR("03b or newer") : PSTR("03 or older"));
|
||||||
|
}
|
||||||
|
|
||||||
static bool lcd_selftest_IRsensor(bool bStandalone)
|
static bool lcd_selftest_IRsensor(bool bStandalone)
|
||||||
{
|
{
|
||||||
bool bAction;
|
bool bAction;
|
||||||
@ -7529,8 +7532,7 @@ volt_IR_int=current_voltage_raw_IR;
|
|||||||
bPCBrev03b=(volt_IR_int<((int)IRsensor_Hopen_TRESHOLD));
|
bPCBrev03b=(volt_IR_int<((int)IRsensor_Hopen_TRESHOLD));
|
||||||
volt_IR=VOLT_DIV_REF*((float)volt_IR_int/(1023*OVERSAMPLENR));
|
volt_IR=VOLT_DIV_REF*((float)volt_IR_int/(1023*OVERSAMPLENR));
|
||||||
printf_P(PSTR("Measured filament sensor high level: %4.2fV\n"),volt_IR);
|
printf_P(PSTR("Measured filament sensor high level: %4.2fV\n"),volt_IR);
|
||||||
if(volt_IR_int<((int)IRsensor_Hmin_TRESHOLD))
|
if(volt_IR_int < ((int)IRsensor_Hmin_TRESHOLD)){
|
||||||
{
|
|
||||||
if(!bStandalone)
|
if(!bStandalone)
|
||||||
lcd_selftest_error(TestError::FsensorLevel,"HIGH","");
|
lcd_selftest_error(TestError::FsensorLevel,"HIGH","");
|
||||||
return(false);
|
return(false);
|
||||||
@ -7539,36 +7541,33 @@ lcd_show_fullscreen_message_and_wait_P(_i("Please insert filament (but not load
|
|||||||
volt_IR_int=current_voltage_raw_IR;
|
volt_IR_int=current_voltage_raw_IR;
|
||||||
volt_IR=VOLT_DIV_REF*((float)volt_IR_int/(1023*OVERSAMPLENR));
|
volt_IR=VOLT_DIV_REF*((float)volt_IR_int/(1023*OVERSAMPLENR));
|
||||||
printf_P(PSTR("Measured filament sensor low level: %4.2fV\n"),volt_IR);
|
printf_P(PSTR("Measured filament sensor low level: %4.2fV\n"),volt_IR);
|
||||||
if(volt_IR_int>((int)IRsensor_Lmax_TRESHOLD))
|
if(volt_IR_int > ((int)IRsensor_Lmax_TRESHOLD)){
|
||||||
{
|
|
||||||
if(!bStandalone)
|
if(!bStandalone)
|
||||||
lcd_selftest_error(TestError::FsensorLevel,"LOW","");
|
lcd_selftest_error(TestError::FsensorLevel,"LOW","");
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
if((bPCBrev03b?1:0)!=(uint8_t)oFsensorPCB) // safer then "(uint8_t)bPCBrev03b"
|
if((bPCBrev03b?1:0)!=(uint8_t)oFsensorPCB){ // safer then "(uint8_t)bPCBrev03b"
|
||||||
{
|
printf_IRSensorAnalogBoardChange(bPCBrev03b);
|
||||||
printf_P(PSTR("Filament sensor board change detected: revision %S\n"),bPCBrev03b?PSTR("03b or newer"):PSTR("03 or older"));
|
|
||||||
oFsensorPCB=bPCBrev03b?ClFsensorPCB::_Rev03b:ClFsensorPCB::_Old;
|
oFsensorPCB=bPCBrev03b?ClFsensorPCB::_Rev03b:ClFsensorPCB::_Old;
|
||||||
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB);
|
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB);
|
||||||
}
|
}
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lcd_detect_IRsensor()
|
static void lcd_detect_IRsensor(){
|
||||||
{
|
|
||||||
bool bAction;
|
bool bAction;
|
||||||
|
|
||||||
bMenuFSDetect = true; // inhibits some code inside "manage_inactivity()"
|
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 loaded?"), false, false);
|
||||||
if(!bAction)
|
if(!bAction){
|
||||||
{
|
lcd_show_fullscreen_message_and_wait_P(_i("Please unload the filament first, then repeat this action."));
|
||||||
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("PCB check successful - withdraw the filament now!"));
|
lcd_show_fullscreen_message_and_wait_P(_i("Sensor verified, remove the filament now."));
|
||||||
else lcd_show_fullscreen_message_and_wait_P(_i("PCB check unsuccessful - withdraw the filament now!"));
|
else
|
||||||
|
lcd_show_fullscreen_message_and_wait_P(_i("Verification failed, remove the filament and try again."));
|
||||||
bMenuFSDetect=false; // de-inhibits some code inside "manage_inactivity()"
|
bMenuFSDetect=false; // de-inhibits some code inside "manage_inactivity()"
|
||||||
}
|
}
|
||||||
#endif //IR_SENSOR_ANALOG
|
#endif //IR_SENSOR_ANALOG
|
||||||
|
@ -142,6 +142,7 @@ extern uint8_t farm_status;
|
|||||||
|
|
||||||
#ifdef IR_SENSOR_ANALOG
|
#ifdef IR_SENSOR_ANALOG
|
||||||
extern bool bMenuFSDetect;
|
extern bool bMenuFSDetect;
|
||||||
|
void printf_IRSensorAnalogBoardChange(bool bPCBrev03b);
|
||||||
#endif //IR_SENSOR_ANALOG
|
#endif //IR_SENSOR_ANALOG
|
||||||
|
|
||||||
extern int8_t SilentModeMenu;
|
extern int8_t SilentModeMenu;
|
||||||
|
Loading…
Reference in New Issue
Block a user