version which should on all printer versions: autoload, selftest, filament detection, filament sensors initialization, filament menus
This commit is contained in:
parent
2df9788c84
commit
e0c1e4a02d
@ -372,6 +372,7 @@ extern LongTimer safetyTimer;
|
||||
|
||||
#define PRINT_PERCENT_DONE_INIT 0xff
|
||||
#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CUSTOM_MSG_TYPE_TEMCAL) || saved_printing || (lcd_commands_type == LCD_COMMAND_V2_CAL) || card.paused || mmu_print_saved)
|
||||
#define CHECK_FSENSOR ((IS_SD_PRINTING || is_usb_printing) && (mcode_in_progress != 600) && !saved_printing && e_active())
|
||||
|
||||
extern void calculate_extruder_multipliers();
|
||||
|
||||
|
@ -1615,7 +1615,6 @@ void setup()
|
||||
|
||||
}
|
||||
#endif //UVLO_SUPPORT
|
||||
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
#ifdef WATCHDOG
|
||||
wdt_enable(WDTO_4S);
|
||||
@ -1835,15 +1834,6 @@ void loop()
|
||||
isPrintPaused ? manage_inactivity(true) : manage_inactivity(false);
|
||||
checkHitEndstops();
|
||||
lcd_update(0);
|
||||
#ifdef NEW_FILAMENT_SENSOR
|
||||
if (mcode_in_progress != 600 && !mmu_enabled) //M600 not in progress
|
||||
{
|
||||
if (IS_SD_PRINTING)
|
||||
{
|
||||
fsensor_update();
|
||||
}
|
||||
}
|
||||
#endif //NEW_FILAMENT_SENSOR
|
||||
#ifdef TMC2130
|
||||
tmc2130_check_overtemp();
|
||||
if (tmc2130_sg_crash)
|
||||
@ -3462,11 +3452,11 @@ void process_commands()
|
||||
}
|
||||
#endif //BACKLASH_Y
|
||||
#endif //TMC2130
|
||||
#ifdef PAT9125
|
||||
#ifdef FILAMENT_SENSOR
|
||||
else if (code_seen("FSENSOR_RECOVER")) { //! FSENSOR_RECOVER
|
||||
fsensor_restore_print_and_continue();
|
||||
}
|
||||
#endif //PAT9125
|
||||
#endif //FILAMENT_SENSOR
|
||||
else if(code_seen("PRUSA")){
|
||||
if (code_seen("Ping")) { //! PRUSA Ping
|
||||
if (farm_mode) {
|
||||
@ -7113,7 +7103,6 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||
dcode_8(); break;
|
||||
case 9: //! D9 - Read/Write ADC
|
||||
dcode_9(); break;
|
||||
|
||||
case 10: //! D10 - XYZ calibration = OK
|
||||
dcode_10(); break;
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "ultralcd.h"
|
||||
#include "ConfigurationStore.h"
|
||||
#include "mmu.h"
|
||||
#include "cardreader.h"
|
||||
|
||||
//! @name Basic parameters
|
||||
//! @{
|
||||
@ -120,17 +121,20 @@ void fsensor_stop_and_save_print(void)
|
||||
void fsensor_restore_print_and_continue(void)
|
||||
{
|
||||
printf_P(PSTR("fsensor_restore_print_and_continue\n"));
|
||||
fsensor_watch_runout = true;
|
||||
fsensor_err_cnt = 0;
|
||||
fsensor_watch_runout = true;
|
||||
fsensor_err_cnt = 0;
|
||||
restore_print_from_ram_and_continue(0); //XYZ = orig, E - no change
|
||||
}
|
||||
|
||||
void fsensor_init(void)
|
||||
{
|
||||
#ifdef PAT9125
|
||||
uint8_t pat9125 = pat9125_init();
|
||||
printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
|
||||
#endif //PAT9125
|
||||
uint8_t fsensor = eeprom_read_byte((uint8_t*)EEPROM_FSENSOR);
|
||||
fsensor_autoload_enabled=eeprom_read_byte((uint8_t*)EEPROM_FSENS_AUTOLOAD_ENABLED);
|
||||
#ifdef PAT9125
|
||||
uint8_t oq_meassure_enabled = eeprom_read_byte((uint8_t*)EEPROM_FSENS_OQ_MEASS_ENABLED);
|
||||
fsensor_oq_meassure_enabled = (oq_meassure_enabled == 1)?true:false;
|
||||
fsensor_chunk_len = (int16_t)(FSENSOR_CHUNK_LEN * cs.axis_steps_per_unit[E_AXIS]);
|
||||
@ -142,15 +146,19 @@ void fsensor_init(void)
|
||||
}
|
||||
else
|
||||
fsensor_not_responding = false;
|
||||
#endif //PAT9125
|
||||
if (fsensor)
|
||||
fsensor_enable();
|
||||
else
|
||||
fsensor_disable();
|
||||
printf_P(PSTR("FSensor %S\n"), (fsensor_enabled?PSTR("ENABLED"):PSTR("DISABLED\n")));
|
||||
if (check_for_ir_sensor()) ir_sensor_detected = true;
|
||||
|
||||
}
|
||||
|
||||
bool fsensor_enable(void)
|
||||
{
|
||||
#ifdef PAT9125
|
||||
if (mmu_enabled == false) { //filament sensor is pat9125, enable only if it is working
|
||||
uint8_t pat9125 = pat9125_init();
|
||||
printf_P(PSTR("PAT9125_init:%hhu\n"), pat9125);
|
||||
@ -172,6 +180,11 @@ bool fsensor_enable(void)
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x01);
|
||||
FSensorStateMenu = 1;
|
||||
}
|
||||
#else
|
||||
fsensor_enabled = true;
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FSENSOR, 0x01);
|
||||
FSensorStateMenu = 1;
|
||||
#endif
|
||||
return fsensor_enabled;
|
||||
}
|
||||
|
||||
@ -223,6 +236,7 @@ void fsensor_autoload_check_start(void)
|
||||
|
||||
void fsensor_autoload_check_stop(void)
|
||||
{
|
||||
#ifdef PAT9125
|
||||
// puts_P(_N("fsensor_autoload_check_stop\n"));
|
||||
if (!fsensor_enabled) return;
|
||||
// puts_P(_N("fsensor_autoload_check_stop 1\n"));
|
||||
@ -234,12 +248,23 @@ void fsensor_autoload_check_stop(void)
|
||||
fsensor_watch_autoload = false;
|
||||
fsensor_watch_runout = true;
|
||||
fsensor_err_cnt = 0;
|
||||
#endif //PAT9125
|
||||
}
|
||||
|
||||
bool fsensor_check_autoload(void)
|
||||
{
|
||||
if (!fsensor_enabled) return false;
|
||||
if (!fsensor_autoload_enabled) return false;
|
||||
if (ir_sensor_detected) {
|
||||
if (digitalRead(IR_SENSOR_PIN) == 1) {
|
||||
fsensor_watch_autoload = true;
|
||||
}
|
||||
else if (fsensor_watch_autoload == true) {
|
||||
fsensor_watch_autoload = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#ifdef PAT9125
|
||||
if (!fsensor_watch_autoload)
|
||||
{
|
||||
fsensor_autoload_check_start();
|
||||
@ -283,6 +308,7 @@ bool fsensor_check_autoload(void)
|
||||
// puts_P(_N("fsensor_check_autoload = true !!!\n"));
|
||||
return true;
|
||||
}
|
||||
#endif //PAT9125
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -362,7 +388,7 @@ bool fsensor_oq_result(void)
|
||||
|
||||
ISR(FSENSOR_INT_PIN_VECT)
|
||||
{
|
||||
if (mmu_enabled) return;
|
||||
if (mmu_enabled || ir_sensor_detected) return;
|
||||
if (!((fsensor_int_pin_old ^ FSENSOR_INT_PIN_PIN_REG) & FSENSOR_INT_PIN_MASK)) return;
|
||||
fsensor_int_pin_old = FSENSOR_INT_PIN_PIN_REG;
|
||||
static bool _lock = false;
|
||||
@ -477,29 +503,18 @@ void fsensor_st_block_chunk(block_t* bl, int cnt)
|
||||
//! If there is still no plausible signal from filament sensor plans M600 (Filament change).
|
||||
void fsensor_update(void)
|
||||
{
|
||||
#ifdef NEW_FILAMENT_SENSOR
|
||||
if (digitalRead(A8) == 1)
|
||||
{
|
||||
fsensor_stop_and_save_print();
|
||||
printf_P(PSTR("fsensor_update - M600\n"));
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1);
|
||||
eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1);
|
||||
enquecommand_front_P(PSTR("FSENSOR_RECOVER"));
|
||||
enquecommand_front_P((PSTR("M600")));
|
||||
fsensor_watch_runout = false;
|
||||
}
|
||||
#else //NEW_FILAMENT_SENSOR
|
||||
if (fsensor_enabled && fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX))
|
||||
{
|
||||
bool autoload_enabled_tmp = fsensor_autoload_enabled;
|
||||
fsensor_autoload_enabled = false;
|
||||
bool oq_meassure_enabled_tmp = fsensor_oq_meassure_enabled;
|
||||
fsensor_oq_meassure_enabled = true;
|
||||
#ifdef PAT9125
|
||||
if (fsensor_enabled && fsensor_watch_runout && (fsensor_err_cnt > FSENSOR_ERR_MAX))
|
||||
{
|
||||
bool autoload_enabled_tmp = fsensor_autoload_enabled;
|
||||
fsensor_autoload_enabled = false;
|
||||
bool oq_meassure_enabled_tmp = fsensor_oq_meassure_enabled;
|
||||
fsensor_oq_meassure_enabled = true;
|
||||
|
||||
fsensor_stop_and_save_print();
|
||||
fsensor_stop_and_save_print();
|
||||
|
||||
fsensor_err_cnt = 0;
|
||||
fsensor_oq_meassure_start(0);
|
||||
fsensor_err_cnt = 0;
|
||||
fsensor_oq_meassure_start(0);
|
||||
|
||||
enquecommand_front_P((PSTR("G1 E-3 F200")));
|
||||
process_commands();
|
||||
@ -507,39 +522,49 @@ void fsensor_update(void)
|
||||
cmdqueue_pop_front();
|
||||
st_synchronize();
|
||||
|
||||
enquecommand_front_P((PSTR("G1 E3 F200")));
|
||||
process_commands();
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
cmdqueue_pop_front();
|
||||
st_synchronize();
|
||||
enquecommand_front_P((PSTR("G1 E3 F200")));
|
||||
process_commands();
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
cmdqueue_pop_front();
|
||||
st_synchronize();
|
||||
|
||||
uint8_t err_cnt = fsensor_err_cnt;
|
||||
fsensor_oq_meassure_stop();
|
||||
uint8_t err_cnt = fsensor_err_cnt;
|
||||
fsensor_oq_meassure_stop();
|
||||
|
||||
bool err = false;
|
||||
err |= (err_cnt > 1);
|
||||
bool err = false;
|
||||
err |= (err_cnt > 1);
|
||||
|
||||
err |= (fsensor_oq_er_sum > 2);
|
||||
err |= (fsensor_oq_yd_sum < (4 * FSENSOR_OQ_MIN_YD));
|
||||
err |= (fsensor_oq_er_sum > 2);
|
||||
err |= (fsensor_oq_yd_sum < (4 * FSENSOR_OQ_MIN_YD));
|
||||
|
||||
if (!err)
|
||||
{
|
||||
printf_P(PSTR("fsensor_err_cnt = 0\n"));
|
||||
fsensor_restore_print_and_continue();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf_P(PSTR("fsensor_update - M600\n"));
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1);
|
||||
eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1);
|
||||
enquecommand_front_P(PSTR("FSENSOR_RECOVER"));
|
||||
enquecommand_front_P((PSTR("M600")));
|
||||
fsensor_watch_runout = false;
|
||||
}
|
||||
fsensor_autoload_enabled = autoload_enabled_tmp;
|
||||
fsensor_oq_meassure_enabled = oq_meassure_enabled_tmp;
|
||||
}
|
||||
#endif //NEW_FILAMENT_SENSOR
|
||||
if (!err)
|
||||
{
|
||||
printf_P(PSTR("fsensor_err_cnt = 0\n"));
|
||||
fsensor_restore_print_and_continue();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf_P(PSTR("fsensor_update - M600\n"));
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1);
|
||||
eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1);
|
||||
enquecommand_front_P(PSTR("FSENSOR_RECOVER"));
|
||||
enquecommand_front_P((PSTR("M600")));
|
||||
fsensor_watch_runout = false;
|
||||
}
|
||||
fsensor_autoload_enabled = autoload_enabled_tmp;
|
||||
fsensor_oq_meassure_enabled = oq_meassure_enabled_tmp;
|
||||
}
|
||||
#else //PAT9125
|
||||
if ((digitalRead(IR_SENSOR_PIN) == 1) && CHECK_FSENSOR && fsensor_enabled && ir_sensor_detected)
|
||||
{
|
||||
fsensor_stop_and_save_print();
|
||||
printf_P(PSTR("fsensor_update - M600\n"));
|
||||
eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT) + 1);
|
||||
eeprom_update_word((uint16_t*)EEPROM_FERROR_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) + 1);
|
||||
enquecommand_front_P(PSTR("FSENSOR_RECOVER"));
|
||||
enquecommand_front_P((PSTR("M600")));
|
||||
}
|
||||
#endif //PAT9125
|
||||
}
|
||||
|
||||
void fsensor_setup_interrupt(void)
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include "tmc2130.h"
|
||||
#endif //TMC2130
|
||||
|
||||
#define CHECK_FINDA ((IS_SD_PRINTING || is_usb_printing) && (mcode_in_progress != 600) && !saved_printing && e_active())
|
||||
|
||||
#define MMU_TODELAY 100
|
||||
#define MMU_TIMEOUT 10
|
||||
#define MMU_CMD_TIMEOUT 45000ul //5min timeout for mmu commands (except P0)
|
||||
@ -41,7 +39,7 @@ uint8_t mmu_cmd = 0;
|
||||
|
||||
//idler ir sensor
|
||||
uint8_t mmu_idl_sens = 0;
|
||||
bool mmu_idler_sensor_detected = false;
|
||||
bool ir_sensor_detected = false;
|
||||
bool mmu_loading_flag = false;
|
||||
|
||||
uint8_t mmu_extruder = MMU_FILAMENT_UNKNOWN;
|
||||
@ -116,23 +114,31 @@ void mmu_init(void)
|
||||
_delay_ms(10); //wait 10ms for sure
|
||||
mmu_reset(); //reset mmu (HW or SW), do not wait for response
|
||||
mmu_state = -1;
|
||||
PIN_INP(MMU_IDLER_SENSOR_PIN); //input mode
|
||||
PIN_SET(MMU_IDLER_SENSOR_PIN); //pullup
|
||||
PIN_INP(IR_SENSOR_PIN); //input mode
|
||||
PIN_SET(IR_SENSOR_PIN); //pullup
|
||||
}
|
||||
|
||||
//returns true if idler IR sensor was detected, otherwise returns false
|
||||
bool check_for_idler_sensor()
|
||||
bool check_for_ir_sensor()
|
||||
{
|
||||
#ifdef IR_SENSOR
|
||||
return true;
|
||||
#endif //IR_SENSOR
|
||||
|
||||
bool detected = false;
|
||||
//if MMU_IDLER_SENSOR_PIN input is low and pat9125sensor is not present we detected idler sensor
|
||||
if ((PIN_GET(MMU_IDLER_SENSOR_PIN) == 0) && fsensor_not_responding)
|
||||
{
|
||||
detected = true;
|
||||
//printf_P(PSTR("Idler IR sensor detected\n"));
|
||||
//if IR_SENSOR_PIN input is low and pat9125sensor is not present we detected idler sensor
|
||||
if ((PIN_GET(IR_SENSOR_PIN) == 0)
|
||||
#ifdef PAT9125
|
||||
&& fsensor_not_responding
|
||||
#endif //PAT9125
|
||||
)
|
||||
{
|
||||
detected = true;
|
||||
//printf_P(PSTR("Idler IR sensor detected\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf_P(PSTR("Idler IR sensor not detected\n"));
|
||||
//printf_P(PSTR("Idler IR sensor not detected\n"));
|
||||
}
|
||||
return detected;
|
||||
}
|
||||
@ -224,8 +230,6 @@ void mmu_loop(void)
|
||||
#endif //MMU_DEBUG && MMU_FINDA_DEBUG
|
||||
puts_P(PSTR("MMU - ENABLED"));
|
||||
mmu_enabled = true;
|
||||
//if we have filament loaded into the nozzle, we can decide if printer has idler sensor right now; otherwise we will will wait till start of T-code so it will be detected on beginning of second T-code
|
||||
if(check_for_idler_sensor()) mmu_idler_sensor_detected = true;
|
||||
mmu_state = 1;
|
||||
}
|
||||
return;
|
||||
@ -241,7 +245,7 @@ void mmu_loop(void)
|
||||
mmu_printf_P(PSTR("T%d\n"), filament);
|
||||
mmu_state = 3; // wait for response
|
||||
mmu_fil_loaded = true;
|
||||
if(mmu_idler_sensor_detected) mmu_idl_sens = 1; //if idler sensor detected, use it for T-code
|
||||
if(ir_sensor_detected) mmu_idl_sens = 1; //if idler sensor detected, use it for T-code
|
||||
}
|
||||
else if ((mmu_cmd >= MMU_CMD_L0) && (mmu_cmd <= MMU_CMD_L4))
|
||||
{
|
||||
@ -259,7 +263,7 @@ void mmu_loop(void)
|
||||
#endif //MMU_DEBUG
|
||||
mmu_puts_P(PSTR("C0\n")); //send 'continue loading'
|
||||
mmu_state = 3;
|
||||
if(mmu_idler_sensor_detected) mmu_idl_sens = 1; //if idler sensor detected use it for C0 code
|
||||
if(ir_sensor_detected) mmu_idl_sens = 1; //if idler sensor detected use it for C0 code
|
||||
}
|
||||
else if (mmu_cmd == MMU_CMD_U0)
|
||||
{
|
||||
@ -301,7 +305,9 @@ void mmu_loop(void)
|
||||
}
|
||||
else if ((mmu_last_response + 300) < millis()) //request every 300ms
|
||||
{
|
||||
if(check_for_idler_sensor()) mmu_idler_sensor_detected = true;
|
||||
#ifndef IR_SENSOR
|
||||
if(check_for_ir_sensor()) ir_sensor_detected = true;
|
||||
#endif //IR_SENSOR not defined
|
||||
#if defined MMU_DEBUG && defined MMU_FINDA_DEBUG
|
||||
puts_P(PSTR("MMU <= 'P0'"));
|
||||
#endif //MMU_DEBUG && MMU_FINDA_DEBUG
|
||||
@ -317,7 +323,7 @@ void mmu_loop(void)
|
||||
printf_P(PSTR("MMU => '%dok'\n"), mmu_finda);
|
||||
#endif //MMU_DEBUG && MMU_FINDA_DEBUG
|
||||
//printf_P(PSTR("Eact: %d\n"), int(e_active()));
|
||||
if (!mmu_finda && CHECK_FINDA && fsensor_enabled) {
|
||||
if (!mmu_finda && CHECK_FSENSOR && fsensor_enabled) {
|
||||
fsensor_stop_and_save_print();
|
||||
enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover
|
||||
if (lcd_autoDepleteEnabled()) enquecommand_front_P(PSTR("M600 AUTO")); //save print and run M600 command
|
||||
@ -333,21 +339,18 @@ void mmu_loop(void)
|
||||
}
|
||||
return;
|
||||
case 3: //response to mmu commands
|
||||
if (mmu_idler_sensor_detected) {
|
||||
if (mmu_idl_sens)
|
||||
if (mmu_idl_sens && ir_sensor_detected) {
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0 && mmu_loading_flag)
|
||||
{
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) == 0 && mmu_loading_flag)
|
||||
{
|
||||
#ifdef MMU_DEBUG
|
||||
printf_P(PSTR("MMU <= 'A'\n"));
|
||||
#endif //MMU_DEBUG
|
||||
mmu_puts_P(PSTR("A\n")); //send 'abort' request
|
||||
mmu_idl_sens = 0;
|
||||
//printf_P(PSTR("MMU IDLER_SENSOR = 0 - ABORT\n"));
|
||||
}
|
||||
//else
|
||||
//printf_P(PSTR("MMU IDLER_SENSOR = 1 - WAIT\n"));
|
||||
}
|
||||
//else
|
||||
//printf_P(PSTR("MMU IDLER_SENSOR = 1 - WAIT\n"));
|
||||
}
|
||||
if (mmu_rx_ok() > 0)
|
||||
{
|
||||
@ -441,7 +444,7 @@ void mmu_load_step() {
|
||||
bool mmu_get_response(uint8_t move)
|
||||
{
|
||||
mmu_loading_flag = false;
|
||||
if (!mmu_idler_sensor_detected) move = MMU_NO_MOVE;
|
||||
if (!ir_sensor_detected) move = MMU_NO_MOVE;
|
||||
|
||||
printf_P(PSTR("mmu_get_response - begin move:%d\n"), move);
|
||||
KEEPALIVE_STATE(IN_PROCESS);
|
||||
@ -471,10 +474,10 @@ bool mmu_get_response(uint8_t move)
|
||||
mmu_loading_flag = true;
|
||||
mmu_load_step();
|
||||
//don't rely on "ok" signal from mmu unit; if filament detected by idler sensor during loading stop loading movements to prevent infinite loading
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) == 0) move = MMU_NO_MOVE;
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0) move = MMU_NO_MOVE;
|
||||
break;
|
||||
case MMU_UNLOAD_MOVE:
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) == 0) //filament is still detected by idler sensor, printer helps with unlading
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0) //filament is still detected by idler sensor, printer helps with unlading
|
||||
{
|
||||
printf_P(PSTR("Unload 1\n"));
|
||||
current_position[E_AXIS] = current_position[E_AXIS] - MMU_LOAD_FEEDRATE * MMU_LOAD_TIME_MS*0.001;
|
||||
@ -489,7 +492,7 @@ bool mmu_get_response(uint8_t move)
|
||||
}
|
||||
break;
|
||||
case MMU_TCODE_MOVE: //first do unload and then continue with infinite loading movements
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) == 0) //filament detected by idler sensor, we must unload first
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0) //filament detected by idler sensor, we must unload first
|
||||
{
|
||||
printf_P(PSTR("Unload 2\n"));
|
||||
current_position[E_AXIS] = current_position[E_AXIS] - MMU_LOAD_FEEDRATE * MMU_LOAD_TIME_MS*0.001;
|
||||
@ -674,7 +677,7 @@ void mmu_load_to_nozzle()
|
||||
|
||||
bool saved_e_relative_mode = axis_relative_modes[E_AXIS];
|
||||
if (!saved_e_relative_mode) axis_relative_modes[E_AXIS] = true;
|
||||
if (mmu_idler_sensor_detected)
|
||||
if (ir_sensor_detected)
|
||||
{
|
||||
current_position[E_AXIS] += 3.0f;
|
||||
}
|
||||
@ -1330,16 +1333,16 @@ void mmu_eject_filament(uint8_t filament, bool recover)
|
||||
void mmu_continue_loading()
|
||||
{
|
||||
|
||||
if (mmu_idler_sensor_detected) {
|
||||
if (ir_sensor_detected) {
|
||||
for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++) {
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) == 0) return;
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0) return;
|
||||
#ifdef MMU_DEBUG
|
||||
printf_P(PSTR("Additional load attempt nr. %d\n"), i);
|
||||
#endif // MMU_DEBUG
|
||||
mmu_command(MMU_CMD_C0);
|
||||
manage_response(true, true, MMU_LOAD_MOVE);
|
||||
}
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) != 0) {
|
||||
if (PIN_GET(IR_SENSOR_PIN) != 0) {
|
||||
uint8_t mmu_load_fail = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL);
|
||||
uint16_t mmu_load_fail_tot = eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT);
|
||||
if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1);
|
||||
@ -1365,7 +1368,7 @@ void mmu_continue_loading()
|
||||
mmu_fil_loaded = false; //so we can retry same T-code again
|
||||
}
|
||||
}
|
||||
else { //mmu_idler_sensor_detected == false
|
||||
else { //mmu_ir_sensor_detected == false
|
||||
mmu_command(MMU_CMD_C0);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ extern uint8_t mmu_extruder;
|
||||
extern uint8_t tmp_extruder;
|
||||
|
||||
extern int8_t mmu_finda;
|
||||
extern bool mmu_idler_sensor_detected;
|
||||
extern bool ir_sensor_detected;
|
||||
extern bool mmu_loading_flag;
|
||||
|
||||
extern int16_t mmu_version;
|
||||
@ -56,7 +56,7 @@ extern int mmu_printf_P(const char* format, ...);
|
||||
|
||||
extern int8_t mmu_rx_ok(void);
|
||||
|
||||
extern bool check_for_idler_sensor();
|
||||
extern bool check_for_ir_sensor();
|
||||
|
||||
extern void mmu_init(void);
|
||||
|
||||
|
@ -118,7 +118,7 @@
|
||||
#define TACH_0 79 // !!! changed from 81 (EINY03)
|
||||
#define TACH_1 80
|
||||
|
||||
#define MMU_IDLER_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8)
|
||||
#define IR_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8)
|
||||
|
||||
// Support for an 8 bit logic analyzer, for example the Saleae.
|
||||
// Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.
|
||||
|
@ -102,7 +102,7 @@
|
||||
|
||||
#define SDCARDDETECT 72
|
||||
|
||||
#define MMU_IDLER_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8)
|
||||
#define IR_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8)
|
||||
|
||||
// Support for an 8 bit logic analyzer, for example the Saleae.
|
||||
// Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.
|
||||
|
@ -102,7 +102,7 @@
|
||||
|
||||
#define SDCARDDETECT 15
|
||||
|
||||
#define MMU_IDLER_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8)
|
||||
#define IR_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8)
|
||||
|
||||
// Support for an 8 bit logic analyzer, for example the Saleae.
|
||||
// Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop.
|
||||
|
@ -3656,8 +3656,8 @@ static void lcd_show_sensors_state()
|
||||
if (mmu_enabled) {
|
||||
finda_state = mmu_finda;
|
||||
}
|
||||
if (mmu_idler_sensor_detected) {
|
||||
idler_state = !PIN_GET(MMU_IDLER_SENSOR_PIN);
|
||||
if (ir_sensor_detected) {
|
||||
idler_state = !PIN_GET(IR_SENSOR_PIN);
|
||||
}
|
||||
lcd_puts_at_P(0, 0, _i("Sensor state"));
|
||||
lcd_puts_at_P(1, 1, _i("PINDA:"));
|
||||
@ -6418,7 +6418,7 @@ bool lcd_selftest()
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(8, _progress, 3, true, 2000); //bed ok
|
||||
#ifdef FILAMENT_SENSOR
|
||||
#ifdef PAT9125
|
||||
if (mmu_enabled == false) {
|
||||
_progress = lcd_selftest_screen(9, _progress, 3, true, 2000); //check filaments sensor
|
||||
_result = lcd_selftest_fsensor();
|
||||
|
@ -110,8 +110,10 @@
|
||||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
#define FILAMENT_SENSOR
|
||||
#define PAT9125
|
||||
#define IR_SENSOR
|
||||
|
||||
|
||||
#define DEBUG_DCODE3
|
||||
|
||||
|
@ -111,8 +111,10 @@
|
||||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
#define FILAMENT_SENSOR
|
||||
#define PAT9125
|
||||
#define IR_SENSOR
|
||||
|
||||
|
||||
#define DEBUG_DCODE3
|
||||
|
||||
|
@ -132,10 +132,9 @@
|
||||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
#define FILAMENT_SENSOR
|
||||
//#define NEW_FILAMENT_SENSOR
|
||||
|
||||
//#define PAT9125
|
||||
#define IR_SENSOR
|
||||
// Backlash -
|
||||
//#define BACKLASH_X
|
||||
//#define BACKLASH_Y
|
||||
@ -615,7 +614,6 @@
|
||||
#define MMU_REQUIRED_FW_BUILDNR 83
|
||||
#define MMU_HWRESET
|
||||
#define MMU_DEBUG //print communication between MMU2 and printer on serial
|
||||
|
||||
#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning
|
||||
|
||||
#endif //__CONFIGURATION_PRUSA_H
|
||||
|
Loading…
Reference in New Issue
Block a user