finda runout sensor can be turned on/off from menu

This commit is contained in:
PavelSindler 2018-08-27 05:20:42 +02:00
parent ceb49d1262
commit 03fffae4c3
4 changed files with 110 additions and 75 deletions

View file

@ -1962,7 +1962,7 @@ void loop()
checkHitEndstops(); checkHitEndstops();
lcd_update(0); lcd_update(0);
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mcode_in_progress != 600) //M600 not in progress if (mcode_in_progress != 600 && !mmu_enabled) //M600 not in progress
fsensor_update(); fsensor_update();
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
#ifdef TMC2130 #ifdef TMC2130
@ -3170,7 +3170,10 @@ void gcode_M701()
custom_message_type = CUSTOM_MSG_TYPE_F_LOAD; custom_message_type = CUSTOM_MSG_TYPE_F_LOAD;
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false)
{
fsensor_oq_meassure_start(40); fsensor_oq_meassure_start(40);
}
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT));
@ -3212,6 +3215,8 @@ void gcode_M701()
custom_message_type = CUSTOM_MSG_TYPE_STATUS; custom_message_type = CUSTOM_MSG_TYPE_STATUS;
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false)
{
fsensor_oq_meassure_stop(); fsensor_oq_meassure_stop();
if (!fsensor_oq_result()) if (!fsensor_oq_result())
@ -3222,6 +3227,7 @@ void gcode_M701()
if (disable) if (disable)
fsensor_disable(); fsensor_disable();
} }
}
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
} }
} }
@ -7303,6 +7309,8 @@ static void handleSafetyTimer()
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
{ {
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false)
{
if (mcode_in_progress != 600) //M600 not in progress if (mcode_in_progress != 600) //M600 not in progress
{ {
if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL))
@ -7336,6 +7344,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
else else
fsensor_autoload_check_stop(); fsensor_autoload_check_stop();
} }
}
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
#ifdef SAFETYTIMER #ifdef SAFETYTIMER

View file

@ -198,7 +198,7 @@ void mmu_loop(void)
fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer
printf_P(PSTR("MMU => '%dok'\n"), mmu_finda); printf_P(PSTR("MMU => '%dok'\n"), mmu_finda);
//printf_P(PSTR("Eact: %d\n"), int(e_active())); //printf_P(PSTR("Eact: %d\n"), int(e_active()));
if (!mmu_finda && CHECK_FINDA) { if (!mmu_finda && CHECK_FINDA && fsensor_enabled) {
fsensor_stop_and_save_print(); fsensor_stop_and_save_print();
enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover
enquecommand_front_P(PSTR("M600")); //save print and run M600 command enquecommand_front_P(PSTR("M600")); //save print and run M600 command

View file

@ -41,6 +41,8 @@
int fsensor_counter = 0; //counter for e-steps int fsensor_counter = 0; //counter for e-steps
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
#include "mmu.h"
#ifdef DEBUG_STACK_MONITOR #ifdef DEBUG_STACK_MONITOR
uint16_t SP_min = 0x21FF; uint16_t SP_min = 0x21FF;
#endif //DEBUG_STACK_MONITOR #endif //DEBUG_STACK_MONITOR
@ -470,8 +472,11 @@ FORCE_INLINE void stepper_next_block()
#endif #endif
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false)
{
fsensor_counter = 0; fsensor_counter = 0;
fsensor_st_block_begin(current_block); fsensor_st_block_begin(current_block);
}
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
// The busy flag is set by the plan_get_current_block() call. // The busy flag is set by the plan_get_current_block() call.
// current_block->busy = true; // current_block->busy = true;
@ -901,7 +906,10 @@ FORCE_INLINE void isr() {
if (step_loops < estep_loops) if (step_loops < estep_loops)
estep_loops = step_loops; estep_loops = step_loops;
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false)
{
fsensor_counter += estep_loops; fsensor_counter += estep_loops;
}
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
do { do {
WRITE_NC(E0_STEP_PIN, !INVERT_E_STEP_PIN); WRITE_NC(E0_STEP_PIN, !INVERT_E_STEP_PIN);
@ -1027,7 +1035,9 @@ FORCE_INLINE void isr() {
// There is not enough time to fit even a single additional tick. // There is not enough time to fit even a single additional tick.
// Tick all the extruder ticks now. // Tick all the extruder ticks now.
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false) {
fsensor_counter += e_steps; fsensor_counter += e_steps;
}
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
MSerial.checkRx(); // Check for serial chars. MSerial.checkRx(); // Check for serial chars.
do { do {
@ -1049,15 +1059,17 @@ FORCE_INLINE void isr() {
// If current block is finished, reset pointer // If current block is finished, reset pointer
if (step_events_completed.wide >= current_block->step_event_count.wide) { if (step_events_completed.wide >= current_block->step_event_count.wide) {
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false) {
fsensor_st_block_chunk(current_block, fsensor_counter); fsensor_st_block_chunk(current_block, fsensor_counter);
fsensor_counter = 0; fsensor_counter = 0;
}
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
current_block = NULL; current_block = NULL;
plan_discard_current_block(); plan_discard_current_block();
} }
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
else if (fsensor_counter >= fsensor_chunk_len) else if ((fsensor_counter >= fsensor_chunk_len) && (mmu_enabled == false))
{ {
fsensor_st_block_chunk(current_block, fsensor_counter); fsensor_st_block_chunk(current_block, fsensor_counter);
fsensor_counter = 0; fsensor_counter = 0;

View file

@ -1882,7 +1882,8 @@ static void lcd_menu_extruder_info()
// Shutter register is an index of LASER shutter time. It is automatically controlled by the chip's internal // Shutter register is an index of LASER shutter time. It is automatically controlled by the chip's internal
// auto-exposure algorithm. When the chip is tracking on a good reflection surface, the Shutter is small. // auto-exposure algorithm. When the chip is tracking on a good reflection surface, the Shutter is small.
// When the chip is tracking on a poor reflection surface, the Shutter is large. Value ranges from 0 to 46. // When the chip is tracking on a poor reflection surface, the Shutter is large. Value ranges from 0 to 46.
if (mmu_enabled == false)
{
if (!fsensor_enabled) if (!fsensor_enabled)
lcd_puts_P(_N("Filament sensor\n" "is disabled.")); lcd_puts_P(_N("Filament sensor\n" "is disabled."));
else else
@ -1897,6 +1898,7 @@ static void lcd_menu_extruder_info()
pat9125_b, pat9125_s pat9125_b, pat9125_s
); );
} }
}
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
menu_back_if_clicked(); menu_back_if_clicked();
@ -4042,11 +4044,12 @@ static void lcd_fsensor_state_set()
FSensorStateMenu = !FSensorStateMenu; //set also from fsensor_enable() and fsensor_disable() FSensorStateMenu = !FSensorStateMenu; //set also from fsensor_enable() and fsensor_disable()
if (!FSensorStateMenu) { if (!FSensorStateMenu) {
fsensor_disable(); fsensor_disable();
if (fsensor_autoload_enabled) if (fsensor_autoload_enabled && !mmu_enabled)
menu_submenu(lcd_filament_autoload_info); menu_submenu(lcd_filament_autoload_info);
}else{ }
else {
fsensor_enable(); fsensor_enable();
if (fsensor_not_responding) if (fsensor_not_responding && !mmu_enabled)
menu_submenu(lcd_fsensor_fail); menu_submenu(lcd_fsensor_fail);
} }
} }
@ -4546,18 +4549,24 @@ static void lcd_settings_menu()
{ {
// Filament sensor turned off, working, no problems // Filament sensor turned off, working, no problems
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_OFF), lcd_fsensor_state_set); MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_OFF), lcd_fsensor_state_set);
if (mmu_enabled == false)
{
MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_filament_autoload_info); MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_filament_autoload_info);
} }
} }
}
else else
{ {
// Filament sensor turned on, working, no problems // Filament sensor turned on, working, no problems
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_ON), lcd_fsensor_state_set); MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_ON), lcd_fsensor_state_set);
if (mmu_enabled == false)
{
if (fsensor_autoload_enabled) if (fsensor_autoload_enabled)
MENU_ITEM_FUNCTION_P(_i("F. autoload [on]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_ON c=17 r=1 MENU_ITEM_FUNCTION_P(_i("F. autoload [on]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_ON c=17 r=1
else else
MENU_ITEM_FUNCTION_P(_i("F. autoload [off]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_OFF c=17 r=1 MENU_ITEM_FUNCTION_P(_i("F. autoload [off]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_OFF c=17 r=1
} }
}
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
if (fans_check_enabled == true) if (fans_check_enabled == true)
@ -5558,7 +5567,7 @@ static void lcd_main_menu()
else else
{ {
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if ( ((fsensor_autoload_enabled == true) && (fsensor_enabled == true))) if ((fsensor_autoload_enabled == true) && (fsensor_enabled == true) && (mmu_enabled == false))
MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=17 r=0 MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=17 r=0
else else
#endif //FILAMENT_SENSOR #endif //FILAMENT_SENSOR
@ -6079,14 +6088,19 @@ bool lcd_selftest()
{ {
_progress = lcd_selftest_screen(8, _progress, 3, true, 2000); //bed ok _progress = lcd_selftest_screen(8, _progress, 3, true, 2000); //bed ok
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false) {
_progress = lcd_selftest_screen(9, _progress, 3, true, 2000); //check filaments sensor _progress = lcd_selftest_screen(9, _progress, 3, true, 2000); //check filaments sensor
_result = lcd_selftest_fsensor(); _result = lcd_selftest_fsensor();
}
#endif // FILAMENT_SENSOR #endif // FILAMENT_SENSOR
} }
if (_result) if (_result)
{ {
#ifdef FILAMENT_SENSOR #ifdef FILAMENT_SENSOR
if (mmu_enabled == false)
{
_progress = lcd_selftest_screen(10, _progress, 3, true, 2000); //fil sensor OK _progress = lcd_selftest_screen(10, _progress, 3, true, 2000); //fil sensor OK
}
#endif // FILAMENT_SENSOR #endif // FILAMENT_SENSOR
_progress = lcd_selftest_screen(11, _progress, 3, true, 5000); //all correct _progress = lcd_selftest_screen(11, _progress, 3, true, 5000); //all correct
} }