|
@@ -64,6 +64,10 @@ uint8_t SilentModeMenu_MMU = 1; //activate mmu unit stealth mode
|
|
|
|
|
|
int8_t FSensorStateMenu = 1;
|
|
int8_t FSensorStateMenu = 1;
|
|
|
|
|
|
|
|
+#ifdef 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;
|
|
@@ -110,7 +114,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()")
|
|
#if (LANG_MODE != 0)
|
|
#if (LANG_MODE != 0)
|
|
static void lcd_language_menu();
|
|
static void lcd_language_menu();
|
|
#endif
|
|
#endif
|
|
@@ -160,10 +164,10 @@ static void reset_crash_det(unsigned char axis);
|
|
static bool lcd_selfcheck_axis_sg(unsigned char axis);
|
|
static bool lcd_selfcheck_axis_sg(unsigned char axis);
|
|
static bool lcd_selfcheck_axis(int _axis, int _travel);
|
|
static bool lcd_selfcheck_axis(int _axis, int _travel);
|
|
#else
|
|
#else
|
|
-static bool lcd_selfcheck_endstops();
|
|
|
|
static bool lcd_selfcheck_axis(int _axis, int _travel);
|
|
static bool lcd_selfcheck_axis(int _axis, int _travel);
|
|
static bool lcd_selfcheck_pulleys(int axis);
|
|
static bool lcd_selfcheck_pulleys(int axis);
|
|
#endif //TMC2130
|
|
#endif //TMC2130
|
|
|
|
+static bool lcd_selfcheck_endstops();
|
|
|
|
|
|
static bool lcd_selfcheck_check_heater(bool _isbed);
|
|
static bool lcd_selfcheck_check_heater(bool _isbed);
|
|
enum class TestScreen : uint_least8_t
|
|
enum class TestScreen : uint_least8_t
|
|
@@ -231,8 +235,9 @@ static FanCheck lcd_selftest_fan_auto(int _fan);
|
|
static bool lcd_selftest_fsensor();
|
|
static bool lcd_selftest_fsensor();
|
|
#endif //PAT9125
|
|
#endif //PAT9125
|
|
static bool selftest_irsensor();
|
|
static bool selftest_irsensor();
|
|
-#if IR_SENSOR_ANALOG
|
|
|
|
-static bool lcd_selftest_IRsensor();
|
|
|
|
|
|
+#ifdef IR_SENSOR_ANALOG
|
|
|
|
+static bool lcd_selftest_IRsensor(bool bStandalone=false);
|
|
|
|
+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();
|
|
@@ -792,7 +797,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)
|
|
{
|
|
{
|
|
@@ -1769,7 +1774,7 @@ static void lcd_menu_temperatures()
|
|
menu_back_if_clicked();
|
|
menu_back_if_clicked();
|
|
}
|
|
}
|
|
|
|
|
|
-#if defined (VOLT_BED_PIN) || defined (VOLT_PWR_PIN) || IR_SENSOR_ANALOG
|
|
|
|
|
|
+#if defined (VOLT_BED_PIN) || defined (VOLT_PWR_PIN) || defined(IR_SENSOR_ANALOG)
|
|
#define VOLT_DIV_R1 10000
|
|
#define VOLT_DIV_R1 10000
|
|
#define VOLT_DIV_R2 2370
|
|
#define VOLT_DIV_R2 2370
|
|
#define VOLT_DIV_FAC ((float)VOLT_DIV_R2 / (VOLT_DIV_R2 + VOLT_DIV_R1))
|
|
#define VOLT_DIV_FAC ((float)VOLT_DIV_R2 / (VOLT_DIV_R2 + VOLT_DIV_R1))
|
|
@@ -1781,27 +1786,24 @@ static void lcd_menu_temperatures()
|
|
//! | |
|
|
//! | |
|
|
//! | PWR: 00.0V | c=12 r=1
|
|
//! | PWR: 00.0V | c=12 r=1
|
|
//! | Bed: 00.0V | c=12 r=1
|
|
//! | Bed: 00.0V | c=12 r=1
|
|
-//! | |
|
|
|
|
|
|
+//! | IR : 00.0V | c=12 r=1 optional
|
|
//! ----------------------
|
|
//! ----------------------
|
|
//! @endcode
|
|
//! @endcode
|
|
//! @todo Positioning of the messages and values on LCD aren't fixed to their exact place. This causes issues with translations.
|
|
//! @todo Positioning of the messages and values on LCD aren't fixed to their exact place. This causes issues with translations.
|
|
static void lcd_menu_voltages()
|
|
static void lcd_menu_voltages()
|
|
{
|
|
{
|
|
- lcd_timeoutToStatus.stop(); //infinite timeout
|
|
|
|
- float volt_pwr = VOLT_DIV_REF * ((float)current_voltage_raw_pwr / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
|
|
|
|
- float volt_bed = VOLT_DIV_REF * ((float)current_voltage_raw_bed / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
|
|
|
|
- lcd_home();
|
|
|
|
-#if !IR_SENSOR_ANALOG
|
|
|
|
- lcd_printf_P(PSTR("\n"));
|
|
|
|
-#endif //!IR_SENSOR_ANALOG
|
|
|
|
- lcd_printf_P(PSTR(" PWR: %4.1fV\n" " BED: %4.1fV"), volt_pwr, volt_bed);
|
|
|
|
-#if IR_SENSOR_ANALOG
|
|
|
|
- float volt_IR = VOLT_DIV_REF * ((float)current_voltage_raw_IR / (1023 * OVERSAMPLENR));
|
|
|
|
- lcd_printf_P(PSTR("\n IR : %3.1fV"),volt_IR);
|
|
|
|
|
|
+ lcd_timeoutToStatus.stop(); //infinite timeout
|
|
|
|
+ float volt_pwr = VOLT_DIV_REF * ((float)current_voltage_raw_pwr / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
|
|
|
|
+ float volt_bed = VOLT_DIV_REF * ((float)current_voltage_raw_bed / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
|
|
|
|
+ lcd_home();
|
|
|
|
+ lcd_printf_P(PSTR(" PWR: %4.1fV\n" " BED: %4.1fV"), volt_pwr, volt_bed);
|
|
|
|
+#ifdef IR_SENSOR_ANALOG
|
|
|
|
+ float volt_IR = VOLT_DIV_REF * ((float)current_voltage_raw_IR / (1023 * OVERSAMPLENR));
|
|
|
|
+ lcd_printf_P(PSTR("\n IR : %3.1fV"),volt_IR);
|
|
#endif //IR_SENSOR_ANALOG
|
|
#endif //IR_SENSOR_ANALOG
|
|
- menu_back_if_clicked();
|
|
|
|
|
|
+ menu_back_if_clicked();
|
|
}
|
|
}
|
|
-#endif //defined (VOLT_BED_PIN) || defined (VOLT_PWR_PIN) || IR_SENSOR_ANALOG
|
|
|
|
|
|
+#endif //defined (VOLT_BED_PIN) || defined (VOLT_PWR_PIN) || defined(IR_SENSOR_ANALOG)
|
|
|
|
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
//! @brief Show Belt Status
|
|
//! @brief Show Belt Status
|
|
@@ -1975,6 +1977,23 @@ static void lcd_support_menu()
|
|
MENU_ITEM_BACK_P(_i("Date:"));////MSG_DATE c=17 r=1
|
|
MENU_ITEM_BACK_P(_i("Date:"));////MSG_DATE c=17 r=1
|
|
MENU_ITEM_BACK_P(PSTR(__DATE__));
|
|
MENU_ITEM_BACK_P(PSTR(__DATE__));
|
|
|
|
|
|
|
|
+#ifdef IR_SENSOR_ANALOG
|
|
|
|
+ MENU_ITEM_BACK_P(STR_SEPARATOR);
|
|
|
|
+ MENU_ITEM_BACK_P(PSTR("Fil. sensor v.:"));
|
|
|
|
+ switch(oFsensorPCB)
|
|
|
|
+ {
|
|
|
|
+ case ClFsensorPCB::_Old:
|
|
|
|
+ MENU_ITEM_BACK_P(PSTR(" 03 or older"));
|
|
|
|
+ break;
|
|
|
|
+ case ClFsensorPCB::_Rev03b:
|
|
|
|
+ MENU_ITEM_BACK_P(PSTR(" 03b or newer"));
|
|
|
|
+ break;
|
|
|
|
+ case ClFsensorPCB::_Undef:
|
|
|
|
+ default:
|
|
|
|
+ MENU_ITEM_BACK_P(PSTR(" state unknown"));
|
|
|
|
+ }
|
|
|
|
+#endif // IR_SENSOR_ANALOG
|
|
|
|
+
|
|
MENU_ITEM_BACK_P(STR_SEPARATOR);
|
|
MENU_ITEM_BACK_P(STR_SEPARATOR);
|
|
if (mmu_enabled)
|
|
if (mmu_enabled)
|
|
{
|
|
{
|
|
@@ -5445,7 +5464,7 @@ SETTINGS_VERSION;
|
|
MENU_END();
|
|
MENU_END();
|
|
}
|
|
}
|
|
|
|
|
|
-#if IR_SENSOR_ANALOG
|
|
|
|
|
|
+#ifdef IR_SENSOR_ANALOG
|
|
static void lcd_fsensor_actionNA_set(void)
|
|
static void lcd_fsensor_actionNA_set(void)
|
|
{
|
|
{
|
|
switch(oFsensorActionNA)
|
|
switch(oFsensorActionNA)
|
|
@@ -5511,8 +5530,9 @@ void lcd_hw_setup_menu(void) // can not be "static"
|
|
SETTINGS_NOZZLE;
|
|
SETTINGS_NOZZLE;
|
|
MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu);
|
|
MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu);
|
|
|
|
|
|
-#if IR_SENSOR_ANALOG
|
|
|
|
|
|
+#ifdef IR_SENSOR_ANALOG
|
|
FSENSOR_ACTION_NA;
|
|
FSENSOR_ACTION_NA;
|
|
|
|
+ MENU_ITEM_FUNCTION_P(PSTR("Fsensor Detection"), lcd_detect_IRsensor);
|
|
#endif //IR_SENSOR_ANALOG
|
|
#endif //IR_SENSOR_ANALOG
|
|
MENU_END();
|
|
MENU_END();
|
|
}
|
|
}
|
|
@@ -6931,7 +6951,7 @@ static void lcd_tune_menu()
|
|
else {
|
|
else {
|
|
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), _T(MSG_ON), lcd_fsensor_state_set);
|
|
MENU_ITEM_TOGGLE_P(_T(MSG_FSENSOR), _T(MSG_ON), lcd_fsensor_state_set);
|
|
}
|
|
}
|
|
-#if IR_SENSOR_ANALOG
|
|
|
|
|
|
+#ifdef IR_SENSOR_ANALOG
|
|
FSENSOR_ACTION_NA;
|
|
FSENSOR_ACTION_NA;
|
|
#endif //IR_SENSOR_ANALOG
|
|
#endif //IR_SENSOR_ANALOG
|
|
#endif //FILAMENT_SENSOR
|
|
#endif //FILAMENT_SENSOR
|
|
@@ -7167,10 +7187,7 @@ void lcd_print_stop()
|
|
|
|
|
|
planner_abort_hard(); //needs to be done since plan_buffer_line resets waiting_inside_plan_buffer_line_print_aborted to false. Also copies current to destination.
|
|
planner_abort_hard(); //needs to be done since plan_buffer_line resets waiting_inside_plan_buffer_line_print_aborted to false. Also copies current to destination.
|
|
|
|
|
|
- axis_relative_modes[X_AXIS] = false;
|
|
|
|
- axis_relative_modes[Y_AXIS] = false;
|
|
|
|
- axis_relative_modes[Z_AXIS] = false;
|
|
|
|
- axis_relative_modes[E_AXIS] = true;
|
|
|
|
|
|
+ axis_relative_modes = E_AXIS_MASK; //XYZ absolute, E relative
|
|
|
|
|
|
isPrintPaused = false; //clear isPrintPaused flag to allow starting next print after pause->stop scenario.
|
|
isPrintPaused = false; //clear isPrintPaused flag to allow starting next print after pause->stop scenario.
|
|
}
|
|
}
|
|
@@ -7359,73 +7376,95 @@ void lcd_belttest_print(const char* msg, uint16_t X, uint16_t Y)
|
|
}
|
|
}
|
|
void lcd_belttest()
|
|
void lcd_belttest()
|
|
{
|
|
{
|
|
- int _progress = 0;
|
|
|
|
bool _result = true;
|
|
bool _result = true;
|
|
|
|
+
|
|
|
|
+ #ifdef TMC2130 // Belttest requires high power mode. Enable it.
|
|
|
|
+ FORCE_HIGH_POWER_START;
|
|
|
|
+ #endif
|
|
|
|
+
|
|
uint16_t X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X));
|
|
uint16_t X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X));
|
|
uint16_t Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
|
|
uint16_t Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
|
|
lcd_belttest_print(_i("Checking X..."), X, Y);
|
|
lcd_belttest_print(_i("Checking X..."), X, Y);
|
|
|
|
|
|
- _delay(2000);
|
|
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
-
|
|
|
|
|
|
+
|
|
_result = lcd_selfcheck_axis_sg(X_AXIS);
|
|
_result = lcd_selfcheck_axis_sg(X_AXIS);
|
|
X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X));
|
|
X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X));
|
|
- if (!_result){
|
|
|
|
- lcd_belttest_print(_i("Error"), X, Y);
|
|
|
|
- return;
|
|
|
|
|
|
+ if (_result){
|
|
|
|
+ lcd_belttest_print(_i("Checking Y..."), X, Y);
|
|
|
|
+ _result = lcd_selfcheck_axis_sg(Y_AXIS);
|
|
|
|
+ Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
|
|
}
|
|
}
|
|
-
|
|
|
|
- lcd_belttest_print(_i("Checking Y..."), X, Y);
|
|
|
|
- _result = lcd_selfcheck_axis_sg(Y_AXIS);
|
|
|
|
- Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
|
|
|
|
-
|
|
|
|
- if (!_result){
|
|
|
|
|
|
+
|
|
|
|
+ if (!_result) {
|
|
lcd_belttest_print(_i("Error"), X, Y);
|
|
lcd_belttest_print(_i("Error"), X, Y);
|
|
- lcd_clear();
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- lcd_belttest_print(_i("Done"), X, Y);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ lcd_belttest_print(_i("Done"), X, Y);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ #ifdef TMC2130
|
|
|
|
+ FORCE_HIGH_POWER_END;
|
|
|
|
+ #endif
|
|
|
|
+
|
|
KEEPALIVE_STATE(NOT_BUSY);
|
|
KEEPALIVE_STATE(NOT_BUSY);
|
|
_delay(3000);
|
|
_delay(3000);
|
|
}
|
|
}
|
|
#endif //TMC2130
|
|
#endif //TMC2130
|
|
|
|
|
|
-#if IR_SENSOR_ANALOG
|
|
|
|
-static bool lcd_selftest_IRsensor()
|
|
|
|
|
|
+#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)
|
|
{
|
|
{
|
|
-bool bAction;
|
|
|
|
-bool bPCBrev03b;
|
|
|
|
-uint16_t volt_IR_int;
|
|
|
|
-float volt_IR;
|
|
|
|
|
|
+ bool bAction;
|
|
|
|
+ bool bPCBrev03b;
|
|
|
|
+ uint16_t volt_IR_int;
|
|
|
|
+ float volt_IR;
|
|
|
|
|
|
-volt_IR_int=current_voltage_raw_IR;
|
|
|
|
-bPCBrev03b=(volt_IR_int<((int)IRsensor_Hopen_TRESHOLD));
|
|
|
|
-volt_IR=VOLT_DIV_REF*((float)volt_IR_int/(1023*OVERSAMPLENR));
|
|
|
|
-printf_P(PSTR("Measured filament sensor high level: %4.2fV\n"),volt_IR);
|
|
|
|
-if(volt_IR_int<((int)IRsensor_Hmin_TRESHOLD))
|
|
|
|
- {
|
|
|
|
- lcd_selftest_error(TestError::FsensorLevel,"HIGH","");
|
|
|
|
- return(false);
|
|
|
|
- }
|
|
|
|
-lcd_show_fullscreen_message_and_wait_P(_i("Please insert filament (but not load them!) into extruder and then press the knob."));
|
|
|
|
-volt_IR_int=current_voltage_raw_IR;
|
|
|
|
-volt_IR=VOLT_DIV_REF*((float)volt_IR_int/(1023*OVERSAMPLENR));
|
|
|
|
-printf_P(PSTR("Measured filament sensor low level: %4.2fV\n"),volt_IR);
|
|
|
|
-if(volt_IR_int>((int)IRsensor_Lmax_TRESHOLD))
|
|
|
|
- {
|
|
|
|
- lcd_selftest_error(TestError::FsensorLevel,"LOW","");
|
|
|
|
- return(false);
|
|
|
|
- }
|
|
|
|
-if((bPCBrev03b?1:0)!=(uint8_t)oFsensorPCB) // safer then "(uint8_t)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;
|
|
|
|
- eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB);
|
|
|
|
- }
|
|
|
|
-return(true);
|
|
|
|
|
|
+ volt_IR_int=current_voltage_raw_IR;
|
|
|
|
+ bPCBrev03b=(volt_IR_int<((int)IRsensor_Hopen_TRESHOLD));
|
|
|
|
+ volt_IR=VOLT_DIV_REF*((float)volt_IR_int/(1023*OVERSAMPLENR));
|
|
|
|
+ printf_P(PSTR("Measured filament sensor high level: %4.2fV\n"),volt_IR);
|
|
|
|
+ if(volt_IR_int < ((int)IRsensor_Hmin_TRESHOLD)){
|
|
|
|
+ if(!bStandalone)
|
|
|
|
+ lcd_selftest_error(TestError::FsensorLevel,"HIGH","");
|
|
|
|
+ return(false);
|
|
|
|
+ }
|
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_i("Please insert filament (but not load them!) into extruder and then press the knob."));
|
|
|
|
+ volt_IR_int=current_voltage_raw_IR;
|
|
|
|
+ volt_IR=VOLT_DIV_REF*((float)volt_IR_int/(1023*OVERSAMPLENR));
|
|
|
|
+ printf_P(PSTR("Measured filament sensor low level: %4.2fV\n"),volt_IR);
|
|
|
|
+ if(volt_IR_int > ((int)IRsensor_Lmax_TRESHOLD)){
|
|
|
|
+ if(!bStandalone)
|
|
|
|
+ lcd_selftest_error(TestError::FsensorLevel,"LOW","");
|
|
|
|
+ return(false);
|
|
|
|
+ }
|
|
|
|
+ if((bPCBrev03b?1:0)!=(uint8_t)oFsensorPCB){ // safer then "(uint8_t)bPCBrev03b"
|
|
|
|
+ printf_IRSensorAnalogBoardChange(bPCBrev03b);
|
|
|
|
+ oFsensorPCB=bPCBrev03b?ClFsensorPCB::_Rev03b:ClFsensorPCB::_Old;
|
|
|
|
+ eeprom_update_byte((uint8_t*)EEPROM_FSENSOR_PCB,(uint8_t)oFsensorPCB);
|
|
|
|
+ }
|
|
|
|
+ return(true);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void lcd_detect_IRsensor(){
|
|
|
|
+ bool bAction;
|
|
|
|
+
|
|
|
|
+ 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);
|
|
|
|
+ if(bAction){
|
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_i("Please unload the filament first, then repeat this action."));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ bAction = lcd_selftest_IRsensor(true);
|
|
|
|
+ if(bAction)
|
|
|
|
+ lcd_show_fullscreen_message_and_wait_P(_i("Sensor verified, remove 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()"
|
|
}
|
|
}
|
|
#endif //IR_SENSOR_ANALOG
|
|
#endif //IR_SENSOR_ANALOG
|
|
|
|
|
|
@@ -7439,7 +7478,8 @@ bool lcd_selftest()
|
|
int _progress = 0;
|
|
int _progress = 0;
|
|
bool _result = true;
|
|
bool _result = true;
|
|
bool _swapped_fan = false;
|
|
bool _swapped_fan = false;
|
|
-#if IR_SENSOR_ANALOG
|
|
|
|
|
|
+//#ifdef IR_SENSOR_ANALOG
|
|
|
|
+#if (0)
|
|
bool bAction;
|
|
bool bAction;
|
|
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)
|
|
@@ -7451,10 +7491,7 @@ bool lcd_selftest()
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
FORCE_HIGH_POWER_START;
|
|
FORCE_HIGH_POWER_START;
|
|
#endif // TMC2130
|
|
#endif // TMC2130
|
|
- _delay(2000);
|
|
|
|
-
|
|
|
|
- FORCE_BL_ON_START;
|
|
|
|
-
|
|
|
|
|
|
+ FORCE_BL_ON_START;
|
|
_delay(2000);
|
|
_delay(2000);
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
KEEPALIVE_STATE(IN_HANDLER);
|
|
|
|
|
|
@@ -7522,11 +7559,7 @@ bool lcd_selftest()
|
|
if (_result)
|
|
if (_result)
|
|
{
|
|
{
|
|
_progress = lcd_selftest_screen(TestScreen::FansOk, _progress, 3, true, 2000);
|
|
_progress = lcd_selftest_screen(TestScreen::FansOk, _progress, 3, true, 2000);
|
|
-#ifndef TMC2130
|
|
|
|
- _result = lcd_selfcheck_endstops();
|
|
|
|
-#else
|
|
|
|
- _result = true;
|
|
|
|
-#endif
|
|
|
|
|
|
+ _result = lcd_selfcheck_endstops(); //With TMC2130, only the Z probe is tested.
|
|
}
|
|
}
|
|
|
|
|
|
if (_result)
|
|
if (_result)
|
|
@@ -7577,21 +7610,31 @@ bool lcd_selftest()
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
tmc2130_home_exit();
|
|
tmc2130_home_exit();
|
|
enable_endstops(false);
|
|
enable_endstops(false);
|
|
- current_position[X_AXIS] = current_position[X_AXIS] + 14;
|
|
|
|
- current_position[Y_AXIS] = current_position[Y_AXIS] + 12;
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
//homeaxis(X_AXIS);
|
|
//homeaxis(X_AXIS);
|
|
//homeaxis(Y_AXIS);
|
|
//homeaxis(Y_AXIS);
|
|
|
|
+ current_position[X_AXIS] += pgm_read_float(bed_ref_points_4);
|
|
|
|
+ current_position[Y_AXIS] += pgm_read_float(bed_ref_points_4+1);
|
|
|
|
+#ifdef TMC2130
|
|
|
|
+ //current_position[X_AXIS] += 0;
|
|
|
|
+ current_position[Y_AXIS] += 4;
|
|
|
|
+#endif //TMC2130
|
|
current_position[Z_AXIS] = current_position[Z_AXIS] + 10;
|
|
current_position[Z_AXIS] = current_position[Z_AXIS] + 10;
|
|
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
|
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
|
st_synchronize();
|
|
st_synchronize();
|
|
|
|
+ set_destination_to_current();
|
|
_progress = lcd_selftest_screen(TestScreen::AxisZ, _progress, 3, true, 1500);
|
|
_progress = lcd_selftest_screen(TestScreen::AxisZ, _progress, 3, true, 1500);
|
|
- _result = lcd_selfcheck_axis(2, Z_MAX_POS);
|
|
|
|
- if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) {
|
|
|
|
- enquecommand_P(PSTR("G28 W"));
|
|
|
|
- enquecommand_P(PSTR("G1 Z15 F1000"));
|
|
|
|
- }
|
|
|
|
|
|
+#ifdef TMC2130
|
|
|
|
+ homeaxis(Z_AXIS); //In case of failure, the code gets stuck in this function.
|
|
|
|
+#else
|
|
|
|
+ _result = lcd_selfcheck_axis(Z_AXIS, Z_MAX_POS);
|
|
|
|
+#endif //TMC2130
|
|
|
|
+
|
|
|
|
+ //raise Z to not damage the bed during and hotend testing
|
|
|
|
+ current_position[Z_AXIS] += 20;
|
|
|
|
+ plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
|
|
|
+ st_synchronize();
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef TMC2130
|
|
#ifdef TMC2130
|
|
@@ -7648,7 +7691,8 @@ bool lcd_selftest()
|
|
_progress = lcd_selftest_screen(TestScreen::FsensorOk, _progress, 3, true, 2000); //fil sensor OK
|
|
_progress = lcd_selftest_screen(TestScreen::FsensorOk, _progress, 3, true, 2000); //fil sensor OK
|
|
}
|
|
}
|
|
#endif //PAT9125
|
|
#endif //PAT9125
|
|
-#if IR_SENSOR_ANALOG
|
|
|
|
|
|
+//#ifdef IR_SENSOR_ANALOG
|
|
|
|
+#if (0)
|
|
_progress = lcd_selftest_screen(TestScreen::Fsensor, _progress, 3, true, 2000); //check filament sensor
|
|
_progress = lcd_selftest_screen(TestScreen::Fsensor, _progress, 3, true, 2000); //check filament sensor
|
|
_result = lcd_selftest_IRsensor();
|
|
_result = lcd_selftest_IRsensor();
|
|
if (_result)
|
|
if (_result)
|
|
@@ -7715,9 +7759,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) {
|
|
enable_endstops(true);
|
|
enable_endstops(true);
|
|
|
|
|
|
if (axis == X_AXIS) { //there is collision between cables and PSU cover in X axis if Z coordinate is too low
|
|
if (axis == X_AXIS) { //there is collision between cables and PSU cover in X axis if Z coordinate is too low
|
|
-
|
|
|
|
- current_position[Z_AXIS] += 17;
|
|
|
|
- plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
|
|
|
|
|
+ raise_z_above(17,true);
|
|
tmc2130_home_enter(Z_AXIS_MASK);
|
|
tmc2130_home_enter(Z_AXIS_MASK);
|
|
st_synchronize();
|
|
st_synchronize();
|
|
tmc2130_home_exit();
|
|
tmc2130_home_exit();
|
|
@@ -7814,7 +7856,7 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) {
|
|
}
|
|
}
|
|
#endif //TMC2130
|
|
#endif //TMC2130
|
|
|
|
|
|
-//#ifndef TMC2130
|
|
|
|
|
|
+#ifndef TMC2130
|
|
|
|
|
|
static bool lcd_selfcheck_axis(int _axis, int _travel)
|
|
static bool lcd_selfcheck_axis(int _axis, int _travel)
|
|
{
|
|
{
|
|
@@ -7913,12 +7955,13 @@ static bool lcd_selfcheck_axis(int _axis, int _travel)
|
|
{
|
|
{
|
|
lcd_selftest_error(TestError::Motor, _error_1, _error_2);
|
|
lcd_selftest_error(TestError::Motor, _error_1, _error_2);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ current_position[_axis] = 0; //simulate axis home to avoid negative numbers for axis position, especially Z.
|
|
|
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
|
|
|
|
return _stepresult;
|
|
return _stepresult;
|
|
}
|
|
}
|
|
|
|
|
|
-#ifndef TMC2130
|
|
|
|
static bool lcd_selfcheck_pulleys(int axis)
|
|
static bool lcd_selfcheck_pulleys(int axis)
|
|
{
|
|
{
|
|
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
|
|
float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD;
|
|
@@ -7963,9 +8006,6 @@ static bool lcd_selfcheck_pulleys(int axis)
|
|
((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1)) {
|
|
((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1)) {
|
|
endstop_triggered = true;
|
|
endstop_triggered = true;
|
|
if (current_position_init - 1 <= current_position[axis] && current_position_init + 1 >= current_position[axis]) {
|
|
if (current_position_init - 1 <= current_position[axis] && current_position_init + 1 >= current_position[axis]) {
|
|
- current_position[axis] += (axis == X_AXIS) ? 13 : 9;
|
|
|
|
- plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
|
|
|
- st_synchronize();
|
|
|
|
return(true);
|
|
return(true);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -7985,31 +8025,42 @@ static bool lcd_selfcheck_pulleys(int axis)
|
|
}
|
|
}
|
|
return(true);
|
|
return(true);
|
|
}
|
|
}
|
|
|
|
+#endif //not defined TMC2130
|
|
|
|
|
|
|
|
|
|
static bool lcd_selfcheck_endstops()
|
|
static bool lcd_selfcheck_endstops()
|
|
{
|
|
{
|
|
bool _result = true;
|
|
bool _result = true;
|
|
|
|
|
|
- if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ||
|
|
|
|
|
|
+ if (
|
|
|
|
+ #ifndef TMC2130
|
|
|
|
+ ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ||
|
|
((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ||
|
|
((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ||
|
|
|
|
+ #endif //!TMC2130
|
|
((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1))
|
|
((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1))
|
|
{
|
|
{
|
|
|
|
+ #ifndef TMC2130
|
|
if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) current_position[0] += 10;
|
|
if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) current_position[0] += 10;
|
|
if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) current_position[1] += 10;
|
|
if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) current_position[1] += 10;
|
|
|
|
+ #endif //!TMC2130
|
|
if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) current_position[2] += 10;
|
|
if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) current_position[2] += 10;
|
|
}
|
|
}
|
|
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
|
plan_buffer_line_curposXYZE(manual_feedrate[0] / 60, active_extruder);
|
|
- _delay(500);
|
|
|
|
|
|
+ st_synchronize();
|
|
|
|
|
|
- if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ||
|
|
|
|
|
|
+ if (
|
|
|
|
+ #ifndef TMC2130
|
|
|
|
+ ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ||
|
|
((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ||
|
|
((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ||
|
|
|
|
+ #endif //!TMC2130
|
|
((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1))
|
|
((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1))
|
|
{
|
|
{
|
|
_result = false;
|
|
_result = false;
|
|
char _error[4] = "";
|
|
char _error[4] = "";
|
|
|
|
+ #ifndef TMC2130
|
|
if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "X");
|
|
if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "X");
|
|
if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Y");
|
|
if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Y");
|
|
|
|
+ #endif //!TMC2130
|
|
if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Z");
|
|
if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Z");
|
|
lcd_selftest_error(TestError::Endstops, _error, "");
|
|
lcd_selftest_error(TestError::Endstops, _error, "");
|
|
}
|
|
}
|
|
@@ -8017,7 +8068,6 @@ static bool lcd_selfcheck_endstops()
|
|
manage_inactivity(true);
|
|
manage_inactivity(true);
|
|
return _result;
|
|
return _result;
|
|
}
|
|
}
|
|
-#endif //not defined TMC2130
|
|
|
|
|
|
|
|
static bool lcd_selfcheck_check_heater(bool _isbed)
|
|
static bool lcd_selfcheck_check_heater(bool _isbed)
|
|
{
|
|
{
|