Merge remote-tracking branch 'my_dev/MK3' into dev
This commit is contained in:
commit
1742dbdb9e
16 changed files with 220 additions and 134 deletions
19
.gitignore
vendored
19
.gitignore
vendored
|
@ -16,6 +16,25 @@ Firmware/Doc
|
|||
/html
|
||||
/latex
|
||||
/Doxyfile
|
||||
/Firmware/builds/1_75mm_MK3-EINY04-E3Dv6full
|
||||
/Firmware/Configuration_prusa.h.bak
|
||||
/Firmware/Configuration_prusa_backup.h
|
||||
/Firmware/ultralcd_implementation_hitachi_HD44780.h.bak
|
||||
/Firmware/ultralcd.cpp.bak
|
||||
/Firmware/temperature.cpp.bak
|
||||
/Firmware/pins.h.bak
|
||||
/Firmware/Marlin_main.cpp.bak
|
||||
/Firmware/language_pl.h.bak
|
||||
/Firmware/language_it.h.bak
|
||||
/Firmware/language_es.h.bak
|
||||
/Firmware/language_en.h.bak
|
||||
/Firmware/language_de.h.bak
|
||||
/Firmware/language_cz.h.bak
|
||||
/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h
|
||||
/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h
|
||||
/Firmware/variants/1_75mm_MK2-EINY01-E3Dv6full.h.bak
|
||||
/Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h
|
||||
/Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h
|
||||
/lang/*.bin
|
||||
/lang/*.hex
|
||||
/lang/*.dat
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// The firmware should only be checked into github with this symbol.
|
||||
#define FW_DEV_VERSION FW_VERSION_UNKNOWN
|
||||
#define FW_REPOSITORY "Unknown"
|
||||
#define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR)
|
||||
#define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR) "a"
|
||||
|
||||
// Debug version has debugging enabled (the symbol DEBUG_BUILD is set).
|
||||
// The debug build may be a bit slower than the non-debug build, therefore the debug build should
|
||||
|
@ -475,7 +475,8 @@ your extruder heater takes 2 minutes to hit the target on heating.
|
|||
// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
|
||||
// which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
|
||||
// is too low, you should also increment SOFT_PWM_SCALE.
|
||||
//#define FAN_SOFT_PWM
|
||||
#define FAN_SOFT_PWM
|
||||
#define FAN_SOFT_PWM_BITS 4 //PWM bit resolution = 4bits, freq = 62.5Hz
|
||||
|
||||
// Incrementing this by 1 will double the software PWM frequency,
|
||||
// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -991,6 +991,10 @@ void setup()
|
|||
|
||||
ultralcd_init();
|
||||
|
||||
#if (LCD_BL_PIN != -1)
|
||||
analogWrite(LCD_BL_PIN, 255); //set full brightnes
|
||||
#endif //(LCD_BL_PIN != -1)
|
||||
|
||||
spi_init();
|
||||
|
||||
lcd_splash();
|
||||
|
@ -1478,9 +1482,9 @@ void setup()
|
|||
setup_fan_interrupt();
|
||||
#endif //DEBUG_DISABLE_FANCHECK
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
#ifdef PAT9125
|
||||
fsensor_setup_interrupt();
|
||||
#endif //FILAMENT_SENSOR
|
||||
#endif //PAT9125
|
||||
for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
|
||||
|
||||
#ifndef DEBUG_DISABLE_STARTMSGS
|
||||
|
@ -1612,7 +1616,6 @@ void setup()
|
|||
|
||||
}
|
||||
#endif //UVLO_SUPPORT
|
||||
|
||||
KEEPALIVE_STATE(NOT_BUSY);
|
||||
#ifdef WATCHDOG
|
||||
wdt_enable(WDTO_4S);
|
||||
|
@ -3450,11 +3453,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) {
|
||||
|
@ -7105,7 +7108,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;
|
||||
|
||||
|
@ -7474,7 +7476,9 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
|||
{
|
||||
if (fsensor_check_autoload())
|
||||
{
|
||||
#ifdef PAT9125
|
||||
fsensor_autoload_check_stop();
|
||||
#endif //PAT9125
|
||||
if (degHotend0() > EXTRUDE_MINTEMP)
|
||||
{
|
||||
if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE))
|
||||
|
@ -7494,7 +7498,9 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef PAT9125
|
||||
fsensor_autoload_check_stop();
|
||||
#endif //PAT9125
|
||||
fsensor_update();
|
||||
}
|
||||
}
|
||||
|
@ -8329,8 +8335,8 @@ void uvlo_()
|
|||
// are in action.
|
||||
planner_abort_hard();
|
||||
|
||||
// Store the current extruder position.
|
||||
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E), st_get_position_mm(E_AXIS));
|
||||
// Store the current extruder position.
|
||||
eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E), st_get_position_mm(E_AXIS));
|
||||
eeprom_update_byte((uint8_t*)EEPROM_UVLO_E_ABS, axis_relative_modes[3]?0:1);
|
||||
|
||||
// Clean the input command queue.
|
||||
|
@ -8686,8 +8692,7 @@ void restore_print_from_eeprom() {
|
|||
enquecommand(cmd);
|
||||
uint32_t position = eeprom_read_dword((uint32_t*)(EEPROM_FILE_POSITION));
|
||||
SERIAL_ECHOPGM("Position read from eeprom:");
|
||||
MYSERIAL.println(position);
|
||||
|
||||
MYSERIAL.println(position);
|
||||
// E axis relative mode.
|
||||
enquecommand_P(PSTR("M83"));
|
||||
// Move to the XY print position in logical coordinates, where the print has been killed.
|
||||
|
@ -9188,9 +9193,9 @@ void M600_load_filament() {
|
|||
//load_filament_time = millis();
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
#ifdef PAT9125
|
||||
fsensor_autoload_check_start();
|
||||
#endif //FILAMENT_SENSOR
|
||||
#endif //PAT9125
|
||||
while(!lcd_clicked())
|
||||
{
|
||||
manage_heater();
|
||||
|
@ -9206,9 +9211,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
|||
}
|
||||
#endif //FILAMENT_SENSOR
|
||||
}
|
||||
#ifdef FILAMENT_SENSOR
|
||||
#ifdef PAT9125
|
||||
fsensor_autoload_check_stop();
|
||||
#endif //FILAMENT_SENSOR
|
||||
#endif //PAT9125
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
|
||||
#ifdef FSENSOR_QUALITY
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -184,7 +197,9 @@ void fsensor_disable(void)
|
|||
|
||||
void fsensor_autoload_set(bool State)
|
||||
{
|
||||
#ifdef PAT9125
|
||||
if (!State) fsensor_autoload_check_stop();
|
||||
#endif //PAT9125
|
||||
fsensor_autoload_enabled = State;
|
||||
eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, fsensor_autoload_enabled);
|
||||
}
|
||||
|
@ -197,6 +212,7 @@ void pciSetup(byte pin)
|
|||
PCICR |= bit (digitalPinToPCICRbit(pin)); // enable interrupt for the group
|
||||
}
|
||||
|
||||
#ifdef PAT9125
|
||||
void fsensor_autoload_check_start(void)
|
||||
{
|
||||
// puts_P(_N("fsensor_autoload_check_start\n"));
|
||||
|
@ -223,6 +239,7 @@ void fsensor_autoload_check_start(void)
|
|||
|
||||
void fsensor_autoload_check_stop(void)
|
||||
{
|
||||
|
||||
// puts_P(_N("fsensor_autoload_check_stop\n"));
|
||||
if (!fsensor_enabled) return;
|
||||
// puts_P(_N("fsensor_autoload_check_stop 1\n"));
|
||||
|
@ -235,11 +252,22 @@ void fsensor_autoload_check_stop(void)
|
|||
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 +311,7 @@ bool fsensor_check_autoload(void)
|
|||
// puts_P(_N("fsensor_check_autoload = true !!!\n"));
|
||||
return true;
|
||||
}
|
||||
#endif //PAT9125
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -359,10 +388,10 @@ bool fsensor_oq_result(void)
|
|||
printf_P(_N("fsensor_oq_result %S\n"), (res?_OK:_NG));
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef PAT9125
|
||||
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;
|
||||
|
@ -446,6 +475,23 @@ ISR(FSENSOR_INT_PIN_VECT)
|
|||
return;
|
||||
}
|
||||
|
||||
void fsensor_setup_interrupt(void)
|
||||
{
|
||||
|
||||
pinMode(FSENSOR_INT_PIN, OUTPUT);
|
||||
digitalWrite(FSENSOR_INT_PIN, LOW);
|
||||
fsensor_int_pin_old = 0;
|
||||
|
||||
//pciSetup(FSENSOR_INT_PIN);
|
||||
// !!! "pciSetup()" does not provide the correct results for some MCU pins
|
||||
// so interrupt registers settings:
|
||||
FSENSOR_INT_PIN_PCMSK_REG |= bit(FSENSOR_INT_PIN_PCMSK_BIT); // enable corresponding PinChangeInterrupt (individual pin)
|
||||
PCIFR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // clear previous occasional interrupt (set of pins)
|
||||
PCICR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // enable corresponding PinChangeInterrupt (set of pins)
|
||||
}
|
||||
|
||||
#endif //PAT9125
|
||||
|
||||
void fsensor_st_block_begin(block_t* bl)
|
||||
{
|
||||
if (!fsensor_enabled) return;
|
||||
|
@ -477,17 +523,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)
|
||||
{
|
||||
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();
|
||||
|
@ -495,51 +542,47 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
void fsensor_setup_interrupt(void)
|
||||
{
|
||||
|
||||
pinMode(FSENSOR_INT_PIN, OUTPUT);
|
||||
digitalWrite(FSENSOR_INT_PIN, LOW);
|
||||
fsensor_int_pin_old = 0;
|
||||
|
||||
//pciSetup(FSENSOR_INT_PIN);
|
||||
// !!! "pciSetup()" does not provide the correct results for some MCU pins
|
||||
// so interrupt registers settings:
|
||||
FSENSOR_INT_PIN_PCMSK_REG |= bit(FSENSOR_INT_PIN_PCMSK_BIT); // enable corresponding PinChangeInterrupt (individual pin)
|
||||
PCIFR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // clear previous occasional interrupt (set of pins)
|
||||
PCICR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // enable corresponding PinChangeInterrupt (set of pins)
|
||||
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
|
||||
}
|
||||
|
|
|
@ -35,14 +35,16 @@ extern bool fsensor_autoload_enabled;
|
|||
extern void fsensor_autoload_set(bool State);
|
||||
|
||||
extern void fsensor_update(void);
|
||||
|
||||
#ifdef PAT9125
|
||||
//! setup pin-change interrupt
|
||||
extern void fsensor_setup_interrupt(void);
|
||||
|
||||
//! @name autoload support
|
||||
//! @{
|
||||
|
||||
extern void fsensor_autoload_check_start(void);
|
||||
extern void fsensor_autoload_check_stop(void);
|
||||
#endif //PAT9125
|
||||
extern bool fsensor_check_autoload(void);
|
||||
//! @}
|
||||
|
||||
|
|
|
@ -20,8 +20,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)
|
||||
|
@ -42,7 +40,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;
|
||||
|
@ -117,23 +115,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;
|
||||
}
|
||||
|
@ -225,8 +231,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;
|
||||
|
@ -302,7 +306,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
|
||||
|
@ -318,7 +324,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
|
||||
ad_markDepleted(mmu_extruder);
|
||||
|
@ -343,7 +349,7 @@ void mmu_loop(void)
|
|||
case 3: //response to mmu commands
|
||||
if (mmu_idl_sens)
|
||||
{
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) == 0 && mmu_loading_flag)
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0 && mmu_loading_flag)
|
||||
{
|
||||
#ifdef MMU_DEBUG
|
||||
printf_P(PSTR("MMU <= 'A'\n"));
|
||||
|
@ -471,7 +477,7 @@ void mmu_load_step(bool synchronize)
|
|||
//! off E-stepper to prevent over-heating and allow filament pull-out if necessary
|
||||
bool can_extrude()
|
||||
{
|
||||
if ((degHotend(active_extruder) < EXTRUDE_MINTEMP) || !mmu_idler_sensor_detected)
|
||||
if ((degHotend(active_extruder) < EXTRUDE_MINTEMP) || !ir_sensor_detected)
|
||||
{
|
||||
disable_e0();
|
||||
delay_keep_alive(100);
|
||||
|
@ -501,10 +507,10 @@ bool mmu_get_response(uint8_t move)
|
|||
mmu_loading_flag = true;
|
||||
if (can_extrude()) 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
|
||||
{
|
||||
if (can_extrude())
|
||||
{
|
||||
|
@ -522,7 +528,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
|
||||
{
|
||||
if (can_extrude())
|
||||
{
|
||||
|
@ -700,7 +706,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;
|
||||
}
|
||||
|
@ -1356,16 +1362,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);
|
||||
|
@ -1392,7 +1398,7 @@ void mmu_continue_loading()
|
|||
isPrintPaused = true;
|
||||
}
|
||||
}
|
||||
else { //mmu_idler_sensor_detected == false
|
||||
else { //mmu_ir_sensor_detected == false
|
||||
mmu_command(MMU_CMD_C0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,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;
|
||||
|
@ -59,7 +59,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);
|
||||
|
||||
|
|
|
@ -99,10 +99,7 @@
|
|||
|
||||
//#define KILL_PIN 32
|
||||
|
||||
|
||||
//#define LCD_PWM_PIN -1//32 // lcd backlight brightnes pwm control pin
|
||||
//#define LCD_PWM_MAX 0x0f // lcd pwm maximum value (0x07=64Hz, 0x0f=32Hz, 0x1f=16Hz)
|
||||
|
||||
#define LCD_BL_PIN 5 //backlight control pin
|
||||
#define BEEPER 84 // Beeper on AUX-4
|
||||
#define LCD_PINS_RS 82
|
||||
#define LCD_PINS_ENABLE 61 // !!! changed from 18 (EINY03)
|
||||
|
@ -121,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.
|
||||
|
|
|
@ -1057,7 +1057,7 @@ void tp_init()
|
|||
setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
|
||||
#endif
|
||||
#ifdef FAN_SOFT_PWM
|
||||
soft_pwm_fan = fanSpeedSoftPwm / 2;
|
||||
soft_pwm_fan = fanSpeedSoftPwm / (1 << (8 - FAN_SOFT_PWM_BITS));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -1630,12 +1630,15 @@ ISR(TIMER2_COMPB_vect)
|
|||
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
|
||||
soft_pwm_b = soft_pwm_bed;
|
||||
//if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); else WRITE(HEATER_BED_PIN,0);
|
||||
#endif
|
||||
#ifdef FAN_SOFT_PWM
|
||||
soft_pwm_fan = fanSpeedSoftPwm / 2;
|
||||
if(soft_pwm_fan > 0) WRITE(FAN_PIN,1); else WRITE(FAN_PIN,0);
|
||||
#endif
|
||||
}
|
||||
#ifdef FAN_SOFT_PWM
|
||||
if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0)
|
||||
{
|
||||
soft_pwm_fan = fanSpeedSoftPwm / (1 << (8 - FAN_SOFT_PWM_BITS));
|
||||
if(soft_pwm_fan > 0) WRITE(FAN_PIN,1); else WRITE(FAN_PIN,0);
|
||||
}
|
||||
#endif
|
||||
if(soft_pwm_0 < pwm_count)
|
||||
{
|
||||
WRITE(HEATER_0_PIN,0);
|
||||
|
@ -1654,7 +1657,7 @@ ISR(TIMER2_COMPB_vect)
|
|||
if(soft_pwm_b < pwm_count) WRITE(HEATER_BED_PIN,0);
|
||||
#endif
|
||||
#ifdef FAN_SOFT_PWM
|
||||
if(soft_pwm_fan < pwm_count) WRITE(FAN_PIN,0);
|
||||
if (soft_pwm_fan < (pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1))) WRITE(FAN_PIN,0);
|
||||
#endif
|
||||
|
||||
pwm_count += (1 << SOFT_PWM_SCALE);
|
||||
|
@ -1841,8 +1844,8 @@ ISR(TIMER2_COMPB_vect)
|
|||
#endif
|
||||
|
||||
#ifdef FAN_SOFT_PWM
|
||||
if (pwm_count == 0){
|
||||
soft_pwm_fan = fanSpeedSoftPwm / 2;
|
||||
if ((pwm_count & ((1 << FAN_SOFT_PWM_BITS) - 1)) == 0)
|
||||
soft_pwm_fan = fanSpeedSoftPwm / (1 << (8 - FAN_SOFT_PWM_BITS));
|
||||
if (soft_pwm_fan > 0) WRITE(FAN_PIN,1); else WRITE(FAN_PIN,0);
|
||||
}
|
||||
if (soft_pwm_fan < pwm_count) WRITE(FAN_PIN,0);
|
||||
|
|
|
@ -3678,8 +3678,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:"));
|
||||
|
@ -6450,25 +6450,31 @@ bool lcd_selftest()
|
|||
{
|
||||
_progress = lcd_selftest_screen(testScreen::hotendOk, _progress, 3, true, 2000); //nozzle ok
|
||||
}
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(testScreen::fsensor, _progress, 3, true, 2000); //check filaments sensor
|
||||
|
||||
if (mmu_enabled)
|
||||
{
|
||||
{
|
||||
_progress = lcd_selftest_screen(testScreen::fsensor, _progress, 3, true, 2000); //check filaments sensor
|
||||
_result = selftest_irsensor();
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(testScreen::fsensorOk, _progress, 3, true, 2000); //fil sensor OK
|
||||
}
|
||||
} else
|
||||
{
|
||||
#ifdef PAT9125
|
||||
_progress = lcd_selftest_screen(testScreen::fsensor, _progress, 3, true, 2000); //check filaments sensor
|
||||
_result = lcd_selftest_fsensor();
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(testScreen::fsensorOk, _progress, 3, true, 2000); //fil sensor OK
|
||||
}
|
||||
#endif //PAT9125
|
||||
}
|
||||
}
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(testScreen::fsensorOk, _progress, 3, true, 2000); //fil sensor OK
|
||||
}
|
||||
#endif // FILAMENT_SENSOR
|
||||
|
||||
#endif //FILAMENT_SENSOR
|
||||
if (_result)
|
||||
{
|
||||
_progress = lcd_selftest_screen(testScreen::allCorrect, _progress, 3, true, 5000); //all correct
|
||||
|
@ -7036,7 +7042,7 @@ static bool lcd_selftest_fsensor(void)
|
|||
//! * Pre-heat to PLA extrude temperature.
|
||||
//! * Unload filament possibly present.
|
||||
//! * Move extruder idler same way as during filament load
|
||||
//! and sample MMU_IDLER_SENSOR_PIN.
|
||||
//! and sample IR_SENSOR_PIN.
|
||||
//! * Check that pin doesn't go low.
|
||||
//!
|
||||
//! @retval true passed
|
||||
|
@ -7073,7 +7079,7 @@ static bool selftest_irsensor()
|
|||
mmu_load_step(false);
|
||||
while (blocks_queued())
|
||||
{
|
||||
if (PIN_GET(MMU_IDLER_SENSOR_PIN) == 0) return false;
|
||||
if (PIN_GET(IR_SENSOR_PIN) == 0) return false;
|
||||
#ifdef TMC2130
|
||||
manage_heater();
|
||||
// Vojtech: Don't disable motors inside the planner!
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -112,8 +112,10 @@
|
|||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
#define FILAMENT_SENSOR
|
||||
#define PAT9125
|
||||
#define IR_SENSOR
|
||||
|
||||
|
||||
#define DEBUG_DCODE3
|
||||
|
||||
|
|
|
@ -133,9 +133,9 @@
|
|||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
||||
|
||||
// Filament sensor
|
||||
#define PAT9125
|
||||
#define FILAMENT_SENSOR
|
||||
|
||||
//#define PAT9125
|
||||
#define IR_SENSOR
|
||||
// Backlash -
|
||||
//#define BACKLASH_X
|
||||
//#define BACKLASH_Y
|
||||
|
@ -623,7 +623,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 a new issue