Rephrase texts for fsensor detection and cleanup (#2630)

* Rephrase texts for fsensor detection and cleanup

* fsensor msgs only for MK3S
This commit is contained in:
DRracer 2020-04-24 19:46:54 +02:00 committed by GitHub
parent 8ef87d76ef
commit baaa372a56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 20 deletions

View file

@ -9484,10 +9484,10 @@ static uint8_t nFSCheckCount=0;
if(nFSCheckCount>FS_CHECK_COUNT) if(nFSCheckCount>FS_CHECK_COUNT)
{ {
nFSCheckCount=0; // not necessary nFSCheckCount=0; // not necessary
oFsensorPCB=ClFsensorPCB::_Rev03b; oFsensorPCB=ClFsensorPCB::_Rev04;
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB); eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB);
printf_IRSensorAnalogBoardChange(true); printf_IRSensorAnalogBoardChange(true);
lcd_setstatuspgm(_i("FS rev. 03b or newer")); lcd_setstatuspgm(_i("FS v0.4 or newer"));
} }
} }
else nFSCheckCount=0; else nFSCheckCount=0;

View file

@ -201,7 +201,7 @@ void fsensor_init(void)
fsensor_disable(false); // (in this case) EEPROM update is not necessary fsensor_disable(false); // (in this case) EEPROM update is not necessary
printf_P(PSTR("FSensor %S"), (fsensor_enabled?PSTR("ENABLED"):PSTR("DISABLED"))); printf_P(PSTR("FSensor %S"), (fsensor_enabled?PSTR("ENABLED"):PSTR("DISABLED")));
#ifdef IR_SENSOR_ANALOG #ifdef IR_SENSOR_ANALOG
printf_P(PSTR(" (sensor board revision: %S)\n"),(oFsensorPCB==ClFsensorPCB::_Rev03b)?PSTR("03b or newer"):PSTR("03 or older")); printf_P(PSTR(" (sensor board revision: %S)\n"),(oFsensorPCB==ClFsensorPCB::_Rev04) ? MSG_04_OR_NEWER : MSG_03_OR_OLDER);
#else //IR_SENSOR_ANALOG #else //IR_SENSOR_ANALOG
printf_P(PSTR("\n")); printf_P(PSTR("\n"));
#endif //IR_SENSOR_ANALOG #endif //IR_SENSOR_ANALOG
@ -691,7 +691,7 @@ void fsensor_update(void)
ADCSRB=nMUX2; ADCSRB=nMUX2;
ENABLE_TEMPERATURE_INTERRUPT(); ENABLE_TEMPERATURE_INTERRUPT();
// end of sequence for ... // end of sequence for ...
if((oFsensorPCB==ClFsensorPCB::_Rev03b)&&((nADC*OVERSAMPLENR)>((int)IRsensor_Hopen_TRESHOLD))) if((oFsensorPCB==ClFsensorPCB::_Rev04)&&((nADC*OVERSAMPLENR)>((int)IRsensor_Hopen_TRESHOLD)))
{ {
fsensor_disable(); fsensor_disable();
fsensor_not_responding = true; fsensor_not_responding = true;
@ -727,7 +727,7 @@ bool bCheckResult;
volt_IR_int=current_voltage_raw_IR; volt_IR_int=current_voltage_raw_IR;
bCheckResult=(volt_IR_int<((int)IRsensor_Lmax_TRESHOLD))||(volt_IR_int>((int)IRsensor_Hmin_TRESHOLD)); bCheckResult=(volt_IR_int<((int)IRsensor_Lmax_TRESHOLD))||(volt_IR_int>((int)IRsensor_Hmin_TRESHOLD));
bCheckResult=bCheckResult&&(!((oFsensorPCB==ClFsensorPCB::_Rev03b)&&(volt_IR_int>((int)IRsensor_Hopen_TRESHOLD)))); bCheckResult=bCheckResult&&(!((oFsensorPCB==ClFsensorPCB::_Rev04)&&(volt_IR_int>((int)IRsensor_Hopen_TRESHOLD))));
return(bCheckResult); return(bCheckResult);
} }
#endif //IR_SENSOR_ANALOG #endif //IR_SENSOR_ANALOG

View file

@ -90,7 +90,7 @@ extern uint8_t fsensor_log;
enum class ClFsensorPCB:uint_least8_t enum class ClFsensorPCB:uint_least8_t
{ {
_Old=0, _Old=0,
_Rev03b=1, _Rev04=1,
_Undef=EEPROM_EMPTY_VALUE _Undef=EEPROM_EMPTY_VALUE
}; };

View file

@ -138,6 +138,11 @@ const char MSG_TIMEOUT[] PROGMEM_I1 = ISTR("Timeout"); ////
const char MSG_BRIGHT[] PROGMEM_I1 = ISTR("Bright"); //// const char MSG_BRIGHT[] PROGMEM_I1 = ISTR("Bright"); ////
const char MSG_DIM[] PROGMEM_I1 = ISTR("Dim"); //// const char MSG_DIM[] PROGMEM_I1 = ISTR("Dim"); ////
const char MSG_AUTO[] PROGMEM_I1 = ISTR("Auto"); //// const char MSG_AUTO[] PROGMEM_I1 = ISTR("Auto"); ////
#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_04_OR_NEWER[] PROGMEM_I1 = ISTR(" 0.4 or newer");
const char MSG_03_OR_OLDER[] PROGMEM_I1 = ISTR(" 0.3 or older");
#endif
//not internationalized messages //not internationalized messages
const char MSG_SD_WORKDIR_FAIL[] PROGMEM_N1 = "workDir open failed"; //// const char MSG_SD_WORKDIR_FAIL[] PROGMEM_N1 = "workDir open failed"; ////
@ -170,3 +175,4 @@ const char MSG_FANCHECK_PRINT[] PROGMEM_N1 = "Err: PRINT FAN ERROR"; ////c=20
const char MSG_M112_KILL[] PROGMEM_N1 = "M112 called. Emergency Stop."; ////c=20 const char MSG_M112_KILL[] PROGMEM_N1 = "M112 called. Emergency Stop."; ////c=20
const char MSG_ADVANCE_K[] PROGMEM_N1 = "Advance K:"; ////c=13 const char MSG_ADVANCE_K[] PROGMEM_N1 = "Advance K:"; ////c=13
const char MSG_POWERPANIC_DETECTED[] PROGMEM_N1 = "POWER PANIC DETECTED"; ////c=20 const char MSG_POWERPANIC_DETECTED[] PROGMEM_N1 = "POWER PANIC DETECTED"; ////c=20

View file

@ -138,6 +138,10 @@ extern const char MSG_TIMEOUT[];
extern const char MSG_BRIGHT[]; extern const char MSG_BRIGHT[];
extern const char MSG_DIM[]; extern const char MSG_DIM[];
extern const char MSG_AUTO[]; extern const char MSG_AUTO[];
#ifdef IR_SENSOR_ANALOG
extern const char MSG_04_OR_NEWER[];
extern const char MSG_03_OR_OLDER[];
#endif
//not internationalized messages //not internationalized messages
extern const char MSG_BROWNOUT_RESET[]; extern const char MSG_BROWNOUT_RESET[];

View file

@ -2166,14 +2166,14 @@ static void lcd_support_menu()
switch(oFsensorPCB) switch(oFsensorPCB)
{ {
case ClFsensorPCB::_Old: case ClFsensorPCB::_Old:
MENU_ITEM_BACK_P(PSTR(" 03 or older")); MENU_ITEM_BACK_P(MSG_03_OR_OLDER);
break; break;
case ClFsensorPCB::_Rev03b: case ClFsensorPCB::_Rev04:
MENU_ITEM_BACK_P(PSTR(" 03b or newer")); MENU_ITEM_BACK_P(MSG_04_OR_NEWER);
break; break;
case ClFsensorPCB::_Undef: case ClFsensorPCB::_Undef:
default: default:
MENU_ITEM_BACK_P(PSTR(" state unknown")); MENU_ITEM_BACK_P(PSTR(" unknown state"));
} }
#endif // IR_SENSOR_ANALOG #endif // IR_SENSOR_ANALOG
@ -7504,19 +7504,19 @@ void lcd_belttest()
#ifdef IR_SENSOR_ANALOG #ifdef IR_SENSOR_ANALOG
// called also from marlin_main.cpp // called also from marlin_main.cpp
void printf_IRSensorAnalogBoardChange(bool bPCBrev03b){ void printf_IRSensorAnalogBoardChange(bool bPCBrev04){
printf_P(PSTR("Filament sensor board change detected: revision %S\n"), bPCBrev03b ? PSTR("03b or newer") : PSTR("03 or older")); printf_P(PSTR("Filament sensor board change detected: revision %S\n"), bPCBrev04 ? MSG_04_OR_NEWER : MSG_03_OR_OLDER);
} }
static bool lcd_selftest_IRsensor(bool bStandalone) static bool lcd_selftest_IRsensor(bool bStandalone)
{ {
bool bAction; bool bAction;
bool bPCBrev03b; bool bPCBrev04;
uint16_t volt_IR_int; uint16_t volt_IR_int;
float volt_IR; float volt_IR;
volt_IR_int=current_voltage_raw_IR; volt_IR_int=current_voltage_raw_IR;
bPCBrev03b=(volt_IR_int<((int)IRsensor_Hopen_TRESHOLD)); bPCBrev04=(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)){
@ -7524,7 +7524,7 @@ static bool lcd_selftest_IRsensor(bool bStandalone)
lcd_selftest_error(TestError::FsensorLevel,"HIGH",""); lcd_selftest_error(TestError::FsensorLevel,"HIGH","");
return(false); return(false);
} }
lcd_show_fullscreen_message_and_wait_P(_i("Please insert filament (but not load them!) into extruder and then press the knob.")); lcd_show_fullscreen_message_and_wait_P(_i("Insert the filament (do not load it) into the extruder and then press the knob."));
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);
@ -7533,9 +7533,9 @@ static bool lcd_selftest_IRsensor(bool 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((bPCBrev04?1:0)!=(uint8_t)oFsensorPCB){ // safer then "(uint8_t)bPCBrev04"
printf_IRSensorAnalogBoardChange(bPCBrev03b); printf_IRSensorAnalogBoardChange(bPCBrev04);
oFsensorPCB=bPCBrev03b?ClFsensorPCB::_Rev03b:ClFsensorPCB::_Old; oFsensorPCB=bPCBrev04?ClFsensorPCB::_Rev04: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);
@ -7545,7 +7545,7 @@ 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 loaded?"), false, false); bAction = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Is 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("Please unload the filament first, then repeat this action."));
return; return;

View file

@ -142,7 +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); void printf_IRSensorAnalogBoardChange(bool bPCBrev04);
#endif //IR_SENSOR_ANALOG #endif //IR_SENSOR_ANALOG
extern int8_t SilentModeMenu; extern int8_t SilentModeMenu;