From 2fa97d5dfe1bab52399b7697fc48da81a897b6e3 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 2 May 2017 19:21:52 +0200 Subject: [PATCH] Added messages in czech and english for SNMM, service menu for adjusting bowden lengths; updated service menu to be extendable; M600: loading filament for SNMM updated; unload all filaments updated --- Firmware/Configuration.h | 1 + Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 357 ++++++++++-------- Firmware/language_all.cpp | 99 +++++ Firmware/language_all.h | 18 + Firmware/language_cz.h | 9 + Firmware/language_en.h | 10 + Firmware/ultralcd.cpp | 167 ++++++-- Firmware/ultralcd.h | 1 + .../ultralcd_implementation_hitachi_HD44780.h | 14 +- 10 files changed, 468 insertions(+), 209 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index c3459ebf..c2f568a2 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -46,6 +46,7 @@ #define EEPROM_PRINT_FLAG (EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY-1) #define EEPROM_PROBE_TEMP_SHIFT (EEPROM_PRINT_FLAG - 2*5) //5 x int for storing pinda probe temp shift relative to 50 C; unit: motor steps #define EEPROM_TEMP_CAL_ACTIVE (EEPROM_PROBE_TEMP_SHIFT - 1) +#define EEPROM_BOWDEN_LENGTH (EEPROM_TEMP_CAL_ACTIVE - 2*4) //4 x int for bowden lengths for multimaterial // Currently running firmware, each digit stored as uint16_t. // The flavor differentiates a dev, alpha, beta, release candidate or a release version. diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index c33ccb39..a8dd4eab 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -282,6 +282,7 @@ extern float retract_recover_length, retract_recover_length_swap, retract_recove extern unsigned long starttime; extern unsigned long stoptime; +extern int bowden_length[4]; extern bool is_usb_printing; extern bool homing_flag; extern bool temp_cal_active; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0f8d9fd0..0d3efd88 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -247,6 +247,8 @@ int extruder_multiply[EXTRUDERS] = {100 #endif }; +int bowden_length[4]; + bool is_usb_printing = false; bool homing_flag = false; @@ -265,6 +267,8 @@ float pause_lastpos[4]; unsigned long pause_time = 0; unsigned long start_pause_print = millis(); +unsigned long load_filament_time; + bool mesh_bed_leveling_flag = false; unsigned char lang_selected = 0; @@ -897,7 +901,7 @@ int er_progress = 0; void factory_reset(char level, bool quiet) { lcd_implementation_clear(); - + int cursor_pos = 0; switch (level) { // Level 0: Language reset @@ -968,6 +972,9 @@ void factory_reset(char level, bool quiet) } + break; + case 4: + bowden_menu(); break; default: @@ -983,178 +990,182 @@ void factory_reset(char level, bool quiet) // are initialized by the main() routine provided by the Arduino framework. void setup() { - setup_killpin(); - setup_powerhold(); - MYSERIAL.begin(BAUDRATE); - SERIAL_PROTOCOLLNPGM("start"); - SERIAL_ECHO_START; + setup_killpin(); + setup_powerhold(); + MYSERIAL.begin(BAUDRATE); + SERIAL_PROTOCOLLNPGM("start"); + SERIAL_ECHO_START; #if 0 - SERIAL_ECHOLN("Reading eeprom from 0 to 100: start"); - for (int i = 0; i < 4096; ++ i) { - int b = eeprom_read_byte((unsigned char*)i); - if (b != 255) { - SERIAL_ECHO(i); - SERIAL_ECHO(":"); - SERIAL_ECHO(b); - SERIAL_ECHOLN(""); - } - } - SERIAL_ECHOLN("Reading eeprom from 0 to 100: done"); - #endif + SERIAL_ECHOLN("Reading eeprom from 0 to 100: start"); + for (int i = 0; i < 4096; ++i) { + int b = eeprom_read_byte((unsigned char*)i); + if (b != 255) { + SERIAL_ECHO(i); + SERIAL_ECHO(":"); + SERIAL_ECHO(b); + SERIAL_ECHOLN(""); + } + } + SERIAL_ECHOLN("Reading eeprom from 0 to 100: done"); +#endif - // Check startup - does nothing if bootloader sets MCUSR to 0 - byte mcu = MCUSR; - if(mcu & 1) SERIAL_ECHOLNRPGM(MSG_POWERUP); - if(mcu & 2) SERIAL_ECHOLNRPGM(MSG_EXTERNAL_RESET); - if(mcu & 4) SERIAL_ECHOLNRPGM(MSG_BROWNOUT_RESET); - if(mcu & 8) SERIAL_ECHOLNRPGM(MSG_WATCHDOG_RESET); - if(mcu & 32) SERIAL_ECHOLNRPGM(MSG_SOFTWARE_RESET); - MCUSR=0; + // Check startup - does nothing if bootloader sets MCUSR to 0 + byte mcu = MCUSR; + if (mcu & 1) SERIAL_ECHOLNRPGM(MSG_POWERUP); + if (mcu & 2) SERIAL_ECHOLNRPGM(MSG_EXTERNAL_RESET); + if (mcu & 4) SERIAL_ECHOLNRPGM(MSG_BROWNOUT_RESET); + if (mcu & 8) SERIAL_ECHOLNRPGM(MSG_WATCHDOG_RESET); + if (mcu & 32) SERIAL_ECHOLNRPGM(MSG_SOFTWARE_RESET); + MCUSR = 0; - //SERIAL_ECHORPGM(MSG_MARLIN); - //SERIAL_ECHOLNRPGM(VERSION_STRING); - - #ifdef STRING_VERSION_CONFIG_H - #ifdef STRING_CONFIG_H_AUTHOR - SERIAL_ECHO_START; - SERIAL_ECHORPGM(MSG_CONFIGURATION_VER); - SERIAL_ECHOPGM(STRING_VERSION_CONFIG_H); - SERIAL_ECHORPGM(MSG_AUTHOR); - SERIAL_ECHOLNPGM(STRING_CONFIG_H_AUTHOR); - SERIAL_ECHOPGM("Compiled: "); - SERIAL_ECHOLNPGM(__DATE__); - #endif - #endif - - SERIAL_ECHO_START; - SERIAL_ECHORPGM(MSG_FREE_MEMORY); - SERIAL_ECHO(freeMemory()); - SERIAL_ECHORPGM(MSG_PLANNER_BUFFER_BYTES); - SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE); - lcd_update_enable(false); - // loads data from EEPROM if available else uses defaults (and resets step acceleration rate) - Config_RetrieveSettings(); - SdFatUtil::set_stack_guard(); //writes magic number at the end of static variables to protect against overwriting static memory by stack - tp_init(); // Initialize temperature loop - plan_init(); // Initialize planner; - watchdog_init(); - st_init(); // Initialize stepper, this enables interrupts! - setup_photpin(); - servo_init(); - // Reset the machine correction matrix. - // It does not make sense to load the correction matrix until the machine is homed. - world2machine_reset(); - - lcd_init(); - if (!READ(BTN_ENC)) - { - _delay_ms(1000); - if (!READ(BTN_ENC)) - { - lcd_implementation_clear(); - - - lcd_printPGM(PSTR("Factory RESET")); - - - SET_OUTPUT(BEEPER); - WRITE(BEEPER, HIGH); - - while (!READ(BTN_ENC)); - - WRITE(BEEPER, LOW); - - + //SERIAL_ECHORPGM(MSG_MARLIN); + //SERIAL_ECHOLNRPGM(VERSION_STRING); - _delay_ms(2000); - - char level = reset_menu(); - factory_reset(level, false); - - switch (level) { - case 0: _delay_ms(0); break; - case 1: _delay_ms(0); break; - case 2: _delay_ms(0); break; - case 3: _delay_ms(0); break; - } - // _delay_ms(100); -/* -#ifdef MESH_BED_LEVELING - _delay_ms(2000); +#ifdef STRING_VERSION_CONFIG_H +#ifdef STRING_CONFIG_H_AUTHOR + SERIAL_ECHO_START; + SERIAL_ECHORPGM(MSG_CONFIGURATION_VER); + SERIAL_ECHOPGM(STRING_VERSION_CONFIG_H); + SERIAL_ECHORPGM(MSG_AUTHOR); + SERIAL_ECHOLNPGM(STRING_CONFIG_H_AUTHOR); + SERIAL_ECHOPGM("Compiled: "); + SERIAL_ECHOLNPGM(__DATE__); +#endif +#endif - if (!READ(BTN_ENC)) - { - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); - _delay_ms(200); - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); + SERIAL_ECHO_START; + SERIAL_ECHORPGM(MSG_FREE_MEMORY); + SERIAL_ECHO(freeMemory()); + SERIAL_ECHORPGM(MSG_PLANNER_BUFFER_BYTES); + SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE); + lcd_update_enable(false); + // loads data from EEPROM if available else uses defaults (and resets step acceleration rate) + Config_RetrieveSettings(); + SdFatUtil::set_stack_guard(); //writes magic number at the end of static variables to protect against overwriting static memory by stack + tp_init(); // Initialize temperature loop + plan_init(); // Initialize planner; + watchdog_init(); + st_init(); // Initialize stepper, this enables interrupts! + setup_photpin(); + servo_init(); + // Reset the machine correction matrix. + // It does not make sense to load the correction matrix until the machine is homed. + world2machine_reset(); - int _z = 0; - calibration_status_store(CALIBRATION_STATUS_CALIBRATED); - EEPROM_save_B(EEPROM_BABYSTEP_X, &_z); - EEPROM_save_B(EEPROM_BABYSTEP_Y, &_z); - EEPROM_save_B(EEPROM_BABYSTEP_Z, &_z); - } - else - { + lcd_init(); + if (!READ(BTN_ENC)) + { + _delay_ms(1000); + if (!READ(BTN_ENC)) + { + lcd_implementation_clear(); - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); - } -#endif // mesh */ - - } - } - else - { - _delay_ms(1000); // wait 1sec to display the splash screen - } - + lcd_printPGM(PSTR("Factory RESET")); - #if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 - SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan - #endif - #ifdef DIGIPOT_I2C - digipot_i2c_init(); - #endif - setup_homepin(); + SET_OUTPUT(BEEPER); + WRITE(BEEPER, HIGH); + + while (!READ(BTN_ENC)); + + WRITE(BEEPER, LOW); + + + + _delay_ms(2000); + + char level = reset_menu(); + factory_reset(level, false); + + switch (level) { + case 0: _delay_ms(0); break; + case 1: _delay_ms(0); break; + case 2: _delay_ms(0); break; + case 3: _delay_ms(0); break; + } + // _delay_ms(100); + /* + #ifdef MESH_BED_LEVELING + _delay_ms(2000); + + if (!READ(BTN_ENC)) + { + WRITE(BEEPER, HIGH); + _delay_ms(100); + WRITE(BEEPER, LOW); + _delay_ms(200); + WRITE(BEEPER, HIGH); + _delay_ms(100); + WRITE(BEEPER, LOW); + + int _z = 0; + calibration_status_store(CALIBRATION_STATUS_CALIBRATED); + EEPROM_save_B(EEPROM_BABYSTEP_X, &_z); + EEPROM_save_B(EEPROM_BABYSTEP_Y, &_z); + EEPROM_save_B(EEPROM_BABYSTEP_Z, &_z); + } + else + { + + WRITE(BEEPER, HIGH); + _delay_ms(100); + WRITE(BEEPER, LOW); + } + #endif // mesh */ + + } + } + else + { + _delay_ms(1000); // wait 1sec to display the splash screen + } + + + +#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1 + SET_OUTPUT(CONTROLLERFAN_PIN); //Set pin used for driver cooling fan +#endif + +#ifdef DIGIPOT_I2C + digipot_i2c_init(); +#endif + setup_homepin(); #if defined(Z_AXIS_ALWAYS_ON) - enable_z(); + enable_z(); #endif - farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE); - EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no); - if ((farm_mode == 0xFF && farm_no == 0) || (farm_no == 0xFFFF)) farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode - if (farm_no == 0xFFFF) farm_no = 0; - if (farm_mode) - { - prusa_statistics(8); - } + farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE); + EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no); + if ((farm_mode == 0xFF && farm_no == 0) || (farm_no == 0xFFFF)) farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode + if (farm_no == 0xFFFF) farm_no = 0; + if (farm_mode) + { + prusa_statistics(8); + } - // Enable Toshiba FlashAir SD card / WiFi enahanced card. - card.ToshibaFlashAir_enable(eeprom_read_byte((unsigned char*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY) == 1); - // Force SD card update. Otherwise the SD card update is done from loop() on card.checkautostart(false), - // but this times out if a blocking dialog is shown in setup(). - card.initsd(); + // Enable Toshiba FlashAir SD card / WiFi enahanced card. + card.ToshibaFlashAir_enable(eeprom_read_byte((unsigned char*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY) == 1); + // Force SD card update. Otherwise the SD card update is done from loop() on card.checkautostart(false), + // but this times out if a blocking dialog is shown in setup(). + card.initsd(); - if (eeprom_read_dword((uint32_t*)(EEPROM_TOP-4)) == 0x0ffffffff && - eeprom_read_dword((uint32_t*)(EEPROM_TOP-8)) == 0x0ffffffff && - eeprom_read_dword((uint32_t*)(EEPROM_TOP-12)) == 0x0ffffffff) { - // Maiden startup. The firmware has been loaded and first started on a virgin RAMBo board, - // where all the EEPROM entries are set to 0x0ff. - // Once a firmware boots up, it forces at least a language selection, which changes - // EEPROM_LANG to number lower than 0x0ff. - // 1) Set a high power mode. - eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0); - } + if (eeprom_read_dword((uint32_t*)(EEPROM_TOP - 4)) == 0x0ffffffff && + eeprom_read_dword((uint32_t*)(EEPROM_TOP - 8)) == 0x0ffffffff && + eeprom_read_dword((uint32_t*)(EEPROM_TOP - 12)) == 0x0ffffffff) { + // Maiden startup. The firmware has been loaded and first started on a virgin RAMBo board, + // where all the EEPROM entries are set to 0x0ff. + // Once a firmware boots up, it forces at least a language selection, which changes + // EEPROM_LANG to number lower than 0x0ff. + // 1) Set a high power mode. + eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0); + } + if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM + int _z = BOWDEN_LENGTH; + for(int i = 0; i<4; i++) EEPROM_save_B(EEPROM_BOWDEN_LENGTH + i * 2, &_z); + } // In the future, somewhere here would one compare the current firmware version against the firmware version stored in the EEPROM. // If they differ, an update procedure may need to be performed. At the end of this block, the current firmware version @@ -5151,8 +5162,10 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp uint8_t cnt=0; int counterBeep = 0; lcd_wait_interact(); + load_filament_time = millis(); while(!lcd_clicked()){ - cnt++; + + cnt++; manage_heater(); manage_inactivity(true); if(cnt==0) @@ -5164,7 +5177,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp SET_OUTPUT(BEEPER); if (counterBeep== 0){ WRITE(BEEPER,HIGH); - } + } if (counterBeep== 20){ WRITE(BEEPER,LOW); } @@ -5177,14 +5190,34 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp #endif #endif } +#ifdef SNMM + if (millis() - load_filament_time > 2) { + load_filament_time = millis(); + target[E_AXIS] += 0.001; + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 1000, active_extruder); + } +#endif } //Filament inserted WRITE(BEEPER,LOW); - - //Feed the filament to the end of nozzle quickly - target[E_AXIS]+= FILAMENTCHANGE_FIRSTFEED ; - plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EFEED, active_extruder); + + //Feed the filament to the end of nozzle quickly +#ifdef SNMM + + st_synchronize(); + target[E_AXIS] += BOWDEN_LENGTH; + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 3000, active_extruder); + target[E_AXIS] += FIL_LOAD_LENGTH - 60; + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 1400, active_extruder); + target[E_AXIS] += 40; + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder); + target[E_AXIS] += 10; + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder); +#else + target[E_AXIS] += FILAMENTCHANGE_FIRSTFEED; + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EFEED, active_extruder); +#endif // SNMM //Extrude some filament target[E_AXIS]+= FILAMENTCHANGE_FINALFEED ; diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 9fc3afbf..c5abd2fa 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -1300,6 +1300,50 @@ const char * const MSG_LOAD_FILAMENT_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_LOAD_FILAMENT_DE }; +const char MSG_LOAD_FILAMENT_1_EN[] PROGMEM = "Load filament 1"; +const char MSG_LOAD_FILAMENT_1_CZ[] PROGMEM = "Zavest filament 1"; +const char * const MSG_LOAD_FILAMENT_1_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_LOAD_FILAMENT_1_EN, + MSG_LOAD_FILAMENT_1_CZ, + MSG_LOAD_FILAMENT_1_EN, + MSG_LOAD_FILAMENT_1_EN, + MSG_LOAD_FILAMENT_1_EN, + MSG_LOAD_FILAMENT_1_EN +}; + +const char MSG_LOAD_FILAMENT_2_EN[] PROGMEM = "Load filament 2"; +const char MSG_LOAD_FILAMENT_2_CZ[] PROGMEM = "Zavest filament 2"; +const char * const MSG_LOAD_FILAMENT_2_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_LOAD_FILAMENT_2_EN, + MSG_LOAD_FILAMENT_2_CZ, + MSG_LOAD_FILAMENT_2_EN, + MSG_LOAD_FILAMENT_2_EN, + MSG_LOAD_FILAMENT_2_EN, + MSG_LOAD_FILAMENT_2_EN +}; + +const char MSG_LOAD_FILAMENT_3_EN[] PROGMEM = "Load filament 3"; +const char MSG_LOAD_FILAMENT_3_CZ[] PROGMEM = "Zavest filament 3"; +const char * const MSG_LOAD_FILAMENT_3_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_LOAD_FILAMENT_3_EN, + MSG_LOAD_FILAMENT_3_CZ, + MSG_LOAD_FILAMENT_3_EN, + MSG_LOAD_FILAMENT_3_EN, + MSG_LOAD_FILAMENT_3_EN, + MSG_LOAD_FILAMENT_3_EN +}; + +const char MSG_LOAD_FILAMENT_4_EN[] PROGMEM = "Load filament 4"; +const char MSG_LOAD_FILAMENT_4_CZ[] PROGMEM = "Zavest filament 4"; +const char * const MSG_LOAD_FILAMENT_4_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_LOAD_FILAMENT_4_EN, + MSG_LOAD_FILAMENT_4_CZ, + MSG_LOAD_FILAMENT_4_EN, + MSG_LOAD_FILAMENT_4_EN, + MSG_LOAD_FILAMENT_4_EN, + MSG_LOAD_FILAMENT_4_EN +}; + const char MSG_LOOSE_PULLEY_EN[] PROGMEM = "Loose pulley"; const char MSG_LOOSE_PULLEY_CZ[] PROGMEM = "Uvolnena remenicka"; const char MSG_LOOSE_PULLEY_IT[] PROGMEM = "Puleggia lenta"; @@ -2947,6 +2991,17 @@ const char * const MSG_UNLOADING_FILAMENT_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_UNLOADING_FILAMENT_DE }; +const char MSG_UNLOAD_ALL_EN[] PROGMEM = "Unload all"; +const char MSG_UNLOAD_ALL_CZ[] PROGMEM = "Vyjmout vse"; +const char * const MSG_UNLOAD_ALL_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_UNLOAD_ALL_EN, + MSG_UNLOAD_ALL_CZ, + MSG_UNLOAD_ALL_EN, + MSG_UNLOAD_ALL_EN, + MSG_UNLOAD_ALL_EN, + MSG_UNLOAD_ALL_EN +}; + const char MSG_UNLOAD_FILAMENT_EN[] PROGMEM = "Unload filament"; const char MSG_UNLOAD_FILAMENT_CZ[] PROGMEM = "Vyjmout filament"; const char MSG_UNLOAD_FILAMENT_IT[] PROGMEM = "Scarica filamento"; @@ -2962,6 +3017,50 @@ const char * const MSG_UNLOAD_FILAMENT_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_UNLOAD_FILAMENT_DE }; +const char MSG_UNLOAD_FILAMENT_1_EN[] PROGMEM = "Unload filament 1"; +const char MSG_UNLOAD_FILAMENT_1_CZ[] PROGMEM = "Vyjmout filament 1"; +const char * const MSG_UNLOAD_FILAMENT_1_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_UNLOAD_FILAMENT_1_EN, + MSG_UNLOAD_FILAMENT_1_CZ, + MSG_UNLOAD_FILAMENT_1_EN, + MSG_UNLOAD_FILAMENT_1_EN, + MSG_UNLOAD_FILAMENT_1_EN, + MSG_UNLOAD_FILAMENT_1_EN +}; + +const char MSG_UNLOAD_FILAMENT_2_EN[] PROGMEM = "Unload filament 2"; +const char MSG_UNLOAD_FILAMENT_2_CZ[] PROGMEM = "Vyjmout filament 2"; +const char * const MSG_UNLOAD_FILAMENT_2_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_UNLOAD_FILAMENT_2_EN, + MSG_UNLOAD_FILAMENT_2_CZ, + MSG_UNLOAD_FILAMENT_2_EN, + MSG_UNLOAD_FILAMENT_2_EN, + MSG_UNLOAD_FILAMENT_2_EN, + MSG_UNLOAD_FILAMENT_2_EN +}; + +const char MSG_UNLOAD_FILAMENT_3_EN[] PROGMEM = "Unload filament 3"; +const char MSG_UNLOAD_FILAMENT_3_CZ[] PROGMEM = "Vyjmout filament 3"; +const char * const MSG_UNLOAD_FILAMENT_3_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_UNLOAD_FILAMENT_3_EN, + MSG_UNLOAD_FILAMENT_3_CZ, + MSG_UNLOAD_FILAMENT_3_EN, + MSG_UNLOAD_FILAMENT_3_EN, + MSG_UNLOAD_FILAMENT_3_EN, + MSG_UNLOAD_FILAMENT_3_EN +}; + +const char MSG_UNLOAD_FILAMENT_4_EN[] PROGMEM = "Unload filament 4"; +const char MSG_UNLOAD_FILAMENT_4_CZ[] PROGMEM = "Vyjmout filament 4"; +const char * const MSG_UNLOAD_FILAMENT_4_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_UNLOAD_FILAMENT_4_EN, + MSG_UNLOAD_FILAMENT_4_CZ, + MSG_UNLOAD_FILAMENT_4_EN, + MSG_UNLOAD_FILAMENT_4_EN, + MSG_UNLOAD_FILAMENT_4_EN, + MSG_UNLOAD_FILAMENT_4_EN +}; + const char MSG_USB_PRINTING_EN[] PROGMEM = "USB printing "; const char MSG_USB_PRINTING_CZ[] PROGMEM = "Tisk z USB "; const char MSG_USB_PRINTING_IT[] PROGMEM = "Stampa da USB"; diff --git a/Firmware/language_all.h b/Firmware/language_all.h index 968a074f..575b8af6 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -259,6 +259,14 @@ extern const char* const MSG_LOAD_EPROM_LANG_TABLE[1]; #define MSG_LOAD_EPROM LANG_TABLE_SELECT_EXPLICIT(MSG_LOAD_EPROM_LANG_TABLE, 0) extern const char* const MSG_LOAD_FILAMENT_LANG_TABLE[LANG_NUM]; #define MSG_LOAD_FILAMENT LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_LANG_TABLE) +extern const char* const MSG_LOAD_FILAMENT_1_LANG_TABLE[LANG_NUM]; +#define MSG_LOAD_FILAMENT_1 LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_1_LANG_TABLE) +extern const char* const MSG_LOAD_FILAMENT_2_LANG_TABLE[LANG_NUM]; +#define MSG_LOAD_FILAMENT_2 LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_2_LANG_TABLE) +extern const char* const MSG_LOAD_FILAMENT_3_LANG_TABLE[LANG_NUM]; +#define MSG_LOAD_FILAMENT_3 LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_3_LANG_TABLE) +extern const char* const MSG_LOAD_FILAMENT_4_LANG_TABLE[LANG_NUM]; +#define MSG_LOAD_FILAMENT_4 LANG_TABLE_SELECT(MSG_LOAD_FILAMENT_4_LANG_TABLE) extern const char* const MSG_LOOSE_PULLEY_LANG_TABLE[LANG_NUM]; #define MSG_LOOSE_PULLEY LANG_TABLE_SELECT(MSG_LOOSE_PULLEY_LANG_TABLE) extern const char* const MSG_M104_INVALID_EXTRUDER_LANG_TABLE[1]; @@ -555,8 +563,18 @@ extern const char* const MSG_UNKNOWN_COMMAND_LANG_TABLE[1]; #define MSG_UNKNOWN_COMMAND LANG_TABLE_SELECT_EXPLICIT(MSG_UNKNOWN_COMMAND_LANG_TABLE, 0) extern const char* const MSG_UNLOADING_FILAMENT_LANG_TABLE[LANG_NUM]; #define MSG_UNLOADING_FILAMENT LANG_TABLE_SELECT(MSG_UNLOADING_FILAMENT_LANG_TABLE) +extern const char* const MSG_UNLOAD_ALL_LANG_TABLE[LANG_NUM]; +#define MSG_UNLOAD_ALL LANG_TABLE_SELECT(MSG_UNLOAD_ALL_LANG_TABLE) extern const char* const MSG_UNLOAD_FILAMENT_LANG_TABLE[LANG_NUM]; #define MSG_UNLOAD_FILAMENT LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_LANG_TABLE) +extern const char* const MSG_UNLOAD_FILAMENT_1_LANG_TABLE[LANG_NUM]; +#define MSG_UNLOAD_FILAMENT_1 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_1_LANG_TABLE) +extern const char* const MSG_UNLOAD_FILAMENT_2_LANG_TABLE[LANG_NUM]; +#define MSG_UNLOAD_FILAMENT_2 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_2_LANG_TABLE) +extern const char* const MSG_UNLOAD_FILAMENT_3_LANG_TABLE[LANG_NUM]; +#define MSG_UNLOAD_FILAMENT_3 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_3_LANG_TABLE) +extern const char* const MSG_UNLOAD_FILAMENT_4_LANG_TABLE[LANG_NUM]; +#define MSG_UNLOAD_FILAMENT_4 LANG_TABLE_SELECT(MSG_UNLOAD_FILAMENT_4_LANG_TABLE) extern const char* const MSG_USB_PRINTING_LANG_TABLE[LANG_NUM]; #define MSG_USB_PRINTING LANG_TABLE_SELECT(MSG_USB_PRINTING_LANG_TABLE) extern const char* const MSG_USERWAIT_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_cz.h b/Firmware/language_cz.h index f92e6d6e..cadba987 100644 --- a/Firmware/language_cz.h +++ b/Firmware/language_cz.h @@ -74,6 +74,15 @@ #define MSG_PREHEAT "Predehrev" #define MSG_UNLOAD_FILAMENT "Vyjmout filament" #define MSG_LOAD_FILAMENT "Zavest filament" +#define MSG_LOAD_FILAMENT_1 "Zavest filament 1" +#define MSG_LOAD_FILAMENT_2 "Zavest filament 2" +#define MSG_LOAD_FILAMENT_3 "Zavest filament 3" +#define MSG_LOAD_FILAMENT_4 "Zavest filament 4" +#define MSG_UNLOAD_FILAMENT_1 "Vyjmout filament 1" +#define MSG_UNLOAD_FILAMENT_2 "Vyjmout filament 2" +#define MSG_UNLOAD_FILAMENT_3 "Vyjmout filament 3" +#define MSG_UNLOAD_FILAMENT_4 "Vyjmout filament 4" +#define MSG_UNLOAD_ALL "Vyjmout vse" #define MSG_RECTRACT "Rectract" #define MSG_ERROR "CHYBA:" diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 204cc70c..245ad732 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -71,6 +71,16 @@ #define MSG_PREHEAT "Preheat" #define MSG_UNLOAD_FILAMENT "Unload filament" #define MSG_LOAD_FILAMENT "Load filament" +#define MSG_LOAD_FILAMENT_1 "Load filament 1" +#define MSG_LOAD_FILAMENT_2 "Load filament 2" +#define MSG_LOAD_FILAMENT_3 "Load filament 3" +#define MSG_LOAD_FILAMENT_4 "Load filament 4" +#define MSG_UNLOAD_FILAMENT_1 "Unload filament 1" +#define MSG_UNLOAD_FILAMENT_2 "Unload filament 2" +#define MSG_UNLOAD_FILAMENT_3 "Unload filament 3" +#define MSG_UNLOAD_FILAMENT_4 "Unload filament 4" +#define MSG_UNLOAD_ALL "Unload all" + #define MSG_RECTRACT "Rectract" #define MSG_ERROR "ERROR:" diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5a9461f3..d0d544fb 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2825,38 +2825,103 @@ void lcd_mylang() { } +void bowden_menu() { + int enc_dif = encoderDiff; + int cursor_pos = 0; + lcd_implementation_clear(); + lcd.setCursor(0, 0); + lcd.print(">"); + for (int i = 0; i < 4; i++) { + lcd.setCursor(1, i); + lcd.print("Extruder "); + lcd.print(i); + lcd.print(": "); + EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]); + lcd.print(bowden_length[i]); + + } + enc_dif = encoderDiff; + while (1) { + + manage_heater(); + manage_inactivity(true); + + lcd.setCursor(0, 0); + lcd.print(" "); + lcd.setCursor(0, 1); + lcd.print(" "); + lcd.setCursor(0, 2); + lcd.print(" "); + lcd.setCursor(0, 3); + lcd.print(" "); + lcd.setCursor(0, cursor_pos); + lcd.print(">"); + + + if (abs((enc_dif - encoderDiff)) > 4) { + + if ((abs(enc_dif - encoderDiff)) > 1) { + if (enc_dif > encoderDiff) { + bowden_length[cursor_pos]--; + lcd.setCursor(13, cursor_pos); + lcd.print(bowden_length[cursor_pos]); + enc_dif = encoderDiff; + } + + if (enc_dif < encoderDiff) { + bowden_length[cursor_pos]++; + lcd.setCursor(13, cursor_pos); + lcd.print(bowden_length[cursor_pos]); + enc_dif = encoderDiff; + } + } + } + delay(100); + if (lcd_clicked()) { + while (lcd_clicked()); + delay(10); + while (lcd_clicked()); + EEPROM_save_B(EEPROM_BOWDEN_LENGTH + cursor_pos * 2, &bowden_length[cursor_pos]); + if (cursor_pos == 3) return; + else { + cursor_pos++; + } + } + + + } +} + char reset_menu() { +#ifdef SNMM + int items_no = 5; +#else + int items_no = 4; +#endif + static int first = 0; int enc_dif = 0; char cursor_pos = 0; - - lcd_implementation_clear(); - - lcd.setCursor(1, 0); - - lcd_printPGM(PSTR("Language")); - - - lcd.setCursor(1, 1); - - lcd_printPGM(PSTR("Statistics")); - - - lcd.setCursor(1, 2); + const char *item [items_no]; - lcd_printPGM(PSTR("Shiping prep")); - - lcd.setCursor(1, 3); - - lcd_printPGM(PSTR("All data")); - - lcd.setCursor(0, 0); - - lcd.print(">"); - + item[0] = "Language"; + item[1] = "Statistics"; + item[2] = "Shipping prep"; + item[3] = "All Data"; +#ifdef SNMM + item[4] = "Bowden length"; +#endif // SNMM enc_dif = encoderDiff; + lcd_implementation_clear(); + lcd.setCursor(0, 0); + lcd.print(">"); - while (1) { + while (1) { + + for (int i = 0; i < 4; i++) { + lcd.setCursor(1, i); + lcd.print(item[first + i]); + } manage_heater(); manage_inactivity(true); @@ -2874,10 +2939,18 @@ char reset_menu() { if (cursor_pos > 3) { cursor_pos = 3; + if (first < items_no - 4) { + first++; + lcd_implementation_clear(); + } } if (cursor_pos < 0) { cursor_pos = 0; + if (first > 0) { + first--; + lcd_implementation_clear(); + } } lcd.setCursor(0, 0); lcd.print(" "); @@ -2899,7 +2972,7 @@ char reset_menu() { while (lcd_clicked()); delay(10); while (lcd_clicked()); - return(cursor_pos); + return(cursor_pos + first); } } @@ -3141,9 +3214,21 @@ static void extr_change_3() { //wrapper functions for unloading filament static void extr_unload_all() { - for (int i = 0; i < 4; i++) { - change_extr(i); - extr_unload(); + if (degHotend0() > EXTRUDE_MINTEMP) { + for (int i = 0; i < 4; i++) { + change_extr(i); + extr_unload(); + } + } + else { + lcd_implementation_clear(); + lcd.setCursor(0, 0); + lcd_printPGM(MSG_ERROR); + lcd.setCursor(0, 2); + lcd_printPGM(MSG_PREHEAT_NOZZLE); + delay(2000); + lcd_implementation_clear(); + lcd_return_to_status(); } } @@ -3169,10 +3254,10 @@ static void fil_load_menu() { START_MENU(); MENU_ITEM(back, MSG_MAIN, lcd_main_menu); - MENU_ITEM(function, PSTR("Load filament 1"), extr_adj_0); - MENU_ITEM(function, PSTR("Load filament 2 "), extr_adj_1); - MENU_ITEM(function, PSTR("Load filament 3"), extr_adj_2); - MENU_ITEM(function, PSTR("Load filament 4"), extr_adj_3); + MENU_ITEM(function, MSG_LOAD_FILAMENT_1, extr_adj_0); + MENU_ITEM(function, MSG_LOAD_FILAMENT_2, extr_adj_1); + MENU_ITEM(function, MSG_LOAD_FILAMENT_3, extr_adj_2); + MENU_ITEM(function, MSG_LOAD_FILAMENT_4, extr_adj_3); END_MENU(); } @@ -3182,16 +3267,16 @@ static void fil_unload_menu() { START_MENU(); MENU_ITEM(back, MSG_MAIN, lcd_main_menu); - MENU_ITEM(function, PSTR("Unload all"), extr_unload_all); - MENU_ITEM(function, PSTR("Unload filament 1"), extr_unload_0); - MENU_ITEM(function, PSTR("Unload filament 2"), extr_unload_1); - MENU_ITEM(function, PSTR("Unload filament 3"), extr_unload_2); - MENU_ITEM(function, PSTR("Unload filament 4"), extr_unload_3); + MENU_ITEM(function, MSG_UNLOAD_ALL, extr_unload_all); + MENU_ITEM(function, MSG_UNLOAD_FILAMENT_1, extr_unload_0); + MENU_ITEM(function, MSG_UNLOAD_FILAMENT_2, extr_unload_1); + MENU_ITEM(function, MSG_UNLOAD_FILAMENT_3, extr_unload_2); + MENU_ITEM(function, MSG_UNLOAD_FILAMENT_4, extr_unload_3); END_MENU(); } -static void change_extr_menu(){ +/*static void change_extr_menu(){ START_MENU(); MENU_ITEM(back, MSG_MAIN, lcd_main_menu); MENU_ITEM(function, PSTR("Extruder 1"), extr_change_0); @@ -3200,7 +3285,7 @@ static void change_extr_menu(){ MENU_ITEM(function, PSTR("Extruder 4"), extr_change_3); END_MENU(); -} +}*/ #endif @@ -3468,7 +3553,7 @@ static void lcd_main_menu() #ifdef SNMM MENU_ITEM(submenu, MSG_LOAD_FILAMENT, fil_load_menu); MENU_ITEM(submenu, MSG_UNLOAD_FILAMENT, fil_unload_menu); - MENU_ITEM(submenu, MSG_CHANGE_EXTR, change_extr_menu); + //MENU_ITEM(submenu, MSG_CHANGE_EXTR, change_extr_menu); #endif MENU_ITEM(submenu, MSG_SETTINGS, lcd_settings_menu); if(!isPrintPaused) MENU_ITEM(submenu, MSG_MENU_CALIBRATION, lcd_calibration_menu); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 865be3f1..bba3f7d1 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -241,6 +241,7 @@ void lcd_extr_cal_reset(); union MenuData; +void bowden_menu(); char reset_menu(); void lcd_pinda_calibration_menu(); diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index d82d023d..8b1ed3de 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -776,15 +776,17 @@ static void lcd_implementation_status_screen() } else { - lcd.setCursor(LCD_WIDTH - 8 - 2, 2); - lcd_printPGM(PSTR(" ")); - } - #ifdef SNMM lcd_printPGM(PSTR(" E")); - lcd.print(get_ext_nr()+1); - + lcd.print(get_ext_nr() + 1); + +#else + lcd.setCursor(LCD_WIDTH - 8 - 2, 2); + lcd_printPGM(PSTR(" ")); #endif + } + + //Print time elapsed lcd.setCursor(LCD_WIDTH - 8 -1, 2);