From 93400ea4e072b57d267ea9fff7e12b5b02478c0f Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Sun, 25 Dec 2016 02:49:34 -0700 Subject: [PATCH 01/49] Fix ENCODER steps in Configuration.h Add temp tables for the E3D PT100 with Amplifier in thermistortables.h Make it easier to switch to the PT100 temperature sensor with appropriate PID values for the Extruder. --- Firmware/Configuration.h | 4 +- Firmware/thermistortables.h | 87 +++++++++++++++++++ .../variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 31 +++++++ 3 files changed, 120 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index ca7bdb58d..306ba2e0d 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -455,8 +455,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define SDSUPPORT // Enable SD Card Support in Hardware Console //#define SDSLOW // Use slower SD transfer mode (not normally needed - uncomment if you're getting volume init error) #define SD_CHECK_AND_RETRY // Use CRC checks and retries on the SD communication -#define ENCODER_PULSES_PER_STEP 2 // Increase if you have a high resolution encoder -#define ENCODER_STEPS_PER_MENU_ITEM 2 // Set according to ENCODER_PULSES_PER_STEP or your liking +#define ENCODER_PULSES_PER_STEP 4 // Increase if you have a high resolution encoder +#define ENCODER_STEPS_PER_MENU_ITEM 1 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store. //#define ULTIPANEL //the UltiPanel as on Thingiverse //#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click diff --git a/Firmware/thermistortables.h b/Firmware/thermistortables.h index ac1dea736..2b0f6ee63 100644 --- a/Firmware/thermistortables.h +++ b/Firmware/thermistortables.h @@ -1059,6 +1059,93 @@ const short temptable_147[][2] PROGMEM = { PtLine(200,100,4700) PtLine(250,100,4700) PtLine(300,100,4700) + PtLine(350,100,4700) + PtLine(400,100,4700) + PtLine(450,100,4700) + PtLine(500,100,4700) + PtLine(550,100,4700) + PtLine(600,100,4700) + PtLine(650,100,4700) + PtLine(700,100,4700) + PtLine(750,100,4700) + PtLine(800,100,4700) + PtLine(850,100,4700) + PtLine(900,100,4700) + PtLine(950,100,4700) + PtLine(1000,100,4700) + PtLine(1050,100,4700) + PtLine(1100,100,4700) +}; +#endif +#if (THERMISTORHEATER_0 == 148) || (THERMISTORHEATER_1 == 148) || (THERMISTORHEATER_2 == 148) || (THERMISTORBED == 148) // Pt100 with 4k7 MiniRambo pullup, no Amp. +const short temptable_148[][2] PROGMEM = { +// More raw data values avaliable via http://www.micropik.com/PDF/pt100.pdf +// This information is taken from http://shop.prusa3d.com/forum/improvements-f14/mini-rambo-1-3-and-e3d-with-pt100-t700-s40.html#p20938 +{0,0}, // first two entries are bogus, just to get the heater running +{286,50}, +{469,100}, +{531,150}, +{590,200}, +{649,250}, +{708,300}, +{763,350}, +{819,400}, +{872,450}, +}; +#endif +#if (THERMISTORHEATER_0 == 247) || (THERMISTORHEATER_1 == 247) || (THERMISTORHEATER_2 == 247) || (THERMISTORBED == 247) // Pt100 with 4k7 MiniRambo pullup & PT100 Amplifier +const short temptable_247[][2] PROGMEM = { +// Calculated from Bob-the-Kuhn's PT100 calculator listed in https://github.com/MarlinFirmware/Marlin/issues/5543 +// and the table provided by E3D at http://wiki.e3d-online.com/wiki/E3D_PT100_Amplifier_Documentation#Output_Characteristics. +{ 0 * OVERSAMPLENR, 0 }, +{ 244 * OVERSAMPLENR, 1 }, +{ 252 * OVERSAMPLENR, 10 }, +{ 262 * OVERSAMPLENR, 20 }, +{ 270 * OVERSAMPLENR, 30 }, +{ 278 * OVERSAMPLENR, 40 }, +{ 286 * OVERSAMPLENR, 50 }, +{ 294 * OVERSAMPLENR, 60 }, +{ 302 * OVERSAMPLENR, 70 }, +{ 310 * OVERSAMPLENR, 80 }, +{ 318 * OVERSAMPLENR, 90 }, +{ 326 * OVERSAMPLENR, 100 }, +{ 334 * OVERSAMPLENR, 110 }, +{ 344 * OVERSAMPLENR, 120 }, +{ 352 * OVERSAMPLENR, 130 }, +{ 358 * OVERSAMPLENR, 140 }, +{ 366 * OVERSAMPLENR, 150 }, +{ 374 * OVERSAMPLENR, 160 }, +{ 382 * OVERSAMPLENR, 170 }, +{ 390 * OVERSAMPLENR, 180 }, +{ 398 * OVERSAMPLENR, 190 }, +{ 406 * OVERSAMPLENR, 200 }, +{ 414 * OVERSAMPLENR, 210 }, +{ 422 * OVERSAMPLENR, 220 }, +{ 430 * OVERSAMPLENR, 230 }, +{ 436 * OVERSAMPLENR, 240 }, +{ 444 * OVERSAMPLENR, 250 }, +{ 452 * OVERSAMPLENR, 260 }, +{ 458 * OVERSAMPLENR, 270 }, +{ 466 * OVERSAMPLENR, 280 }, +{ 474 * OVERSAMPLENR, 290 }, +{ 480 * OVERSAMPLENR, 300 }, +{ 488 * OVERSAMPLENR, 310 }, +{ 496 * OVERSAMPLENR, 320 }, +{ 504 * OVERSAMPLENR, 330 }, +{ 510 * OVERSAMPLENR, 340 }, +{ 518 * OVERSAMPLENR, 350 }, +{ 524 * OVERSAMPLENR, 360 }, +{ 532 * OVERSAMPLENR, 370 }, +{ 538 * OVERSAMPLENR, 380 }, +{ 546 * OVERSAMPLENR, 390 }, +{ 554 * OVERSAMPLENR, 400 }, +{ 622 * OVERSAMPLENR, 500 }, +{ 688 * OVERSAMPLENR, 600 }, +{ 749 * OVERSAMPLENR, 700 }, +{ 809 * OVERSAMPLENR, 800 }, +{ 865 * OVERSAMPLENR, 900 }, +{ 919 * OVERSAMPLENR, 1000 }, +{ 969 * OVERSAMPLENR, 1100 }, }; #endif #if (THERMISTORHEATER_0 == 1010) || (THERMISTORHEATER_1 == 1010) || (THERMISTORHEATER_2 == 1010) || (THERMISTORBED == 1010) // Pt1000 with 1k0 pullup diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index c7e3ecb8a..43973fb1c 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -18,6 +18,12 @@ GENERAL SETTINGS // Electronics #define MOTHERBOARD BOARD_RAMBO_MINI_1_3 +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + /*------------------------------------ AXIS SETTINGS @@ -73,15 +79,26 @@ EXTRUDER SETTINGS #define BED_MINTEMP 15 // Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else #define HEATER_0_MAXTEMP 305 +#endif #define HEATER_1_MAXTEMP 305 #define HEATER_2_MAXTEMP 305 #define BED_MAXTEMP 150 +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else // Define PID constants for extruder #define DEFAULT_Kp 40.925 #define DEFAULT_Ki 4.875 #define DEFAULT_Kd 86.085 +#endif // Extrude mintemp #define EXTRUDE_MINTEMP 130 @@ -305,12 +322,26 @@ THERMISTORS SETTINGS // 1047 is Pt1000 with 4k7 pullup // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup +// 148 is Pt100 with 4k7 pullup and no PT100 Amplifier (in case type 147 doesn't work) +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier // 110 is Pt100 with 1k pullup (non standard) +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 147 +#else #define TEMP_SENSOR_0 5 +#endif #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 147 +#else #define TEMP_SENSOR_BED 1 +#endif #endif //__CONFIGURATION_PRUSA_H From ad5567480183d6e0525d971deea633a9a8ece38d Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Sun, 25 Dec 2016 03:03:33 -0700 Subject: [PATCH 02/49] Added PT100 bed PID values (copied from extruder PID and untested) --- Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 43973fb1c..60b74d413 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -243,9 +243,16 @@ BED SETTINGS #ifdef PIDTEMPBED //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else #define DEFAULT_bedKp 126.13 #define DEFAULT_bedKi 4.30 #define DEFAULT_bedKd 924.76 +#endif //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //from pidautotune From 0af1945d5e9194bb141143c99e9a7499180bf06a Mon Sep 17 00:00:00 2001 From: ayourk Date: Sun, 25 Dec 2016 04:20:39 -0700 Subject: [PATCH 03/49] Update thermistortables.h Update thermistortables.h to be more in line with the forum post. --- Firmware/thermistortables.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/thermistortables.h b/Firmware/thermistortables.h index 2b0f6ee63..28d0b8678 100644 --- a/Firmware/thermistortables.h +++ b/Firmware/thermistortables.h @@ -1081,8 +1081,8 @@ const short temptable_147[][2] PROGMEM = { const short temptable_148[][2] PROGMEM = { // More raw data values avaliable via http://www.micropik.com/PDF/pt100.pdf // This information is taken from http://shop.prusa3d.com/forum/improvements-f14/mini-rambo-1-3-and-e3d-with-pt100-t700-s40.html#p20938 -{0,0}, // first two entries are bogus, just to get the heater running -{286,50}, +{292,0}, // first two entries are bogus, just to get the heater running +{356,50}, {469,100}, {531,150}, {590,200}, From d5ce8dfa9617307019cc16d3c2f86a6fe3090898 Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Tue, 27 Dec 2016 15:19:18 -0700 Subject: [PATCH 04/49] Renamed fpos_t to filepos_t as per Github issue #9 to be more compatible with versions of Arduino newer than v1.6.8. --- Firmware/SdBaseFile.cpp | 6 +++--- Firmware/SdBaseFile.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/SdBaseFile.cpp b/Firmware/SdBaseFile.cpp index dbcf77fbd..be04ab1a2 100644 --- a/Firmware/SdBaseFile.cpp +++ b/Firmware/SdBaseFile.cpp @@ -294,7 +294,7 @@ bool SdBaseFile::getFilename(char* name) { return true; } //------------------------------------------------------------------------------ -void SdBaseFile::getpos(fpos_t* pos) { +void SdBaseFile::getpos(filepos_t* pos) { pos->position = curPosition_; pos->cluster = curCluster_; } @@ -925,7 +925,7 @@ bool SdBaseFile::openRoot(SdVolume* vol) { * \return The byte if no error and not at eof else -1; */ int SdBaseFile::peek() { - fpos_t pos; + filepos_t pos; getpos(&pos); int c = read(); if (c >= 0) setpos(&pos); @@ -1492,7 +1492,7 @@ bool SdBaseFile::seekSet(uint32_t pos) { return false; } //------------------------------------------------------------------------------ -void SdBaseFile::setpos(fpos_t* pos) { +void SdBaseFile::setpos(filepos_t* pos) { curPosition_ = pos->position; curCluster_ = pos->cluster; } diff --git a/Firmware/SdBaseFile.h b/Firmware/SdBaseFile.h index dea299a64..923a391dd 100644 --- a/Firmware/SdBaseFile.h +++ b/Firmware/SdBaseFile.h @@ -31,16 +31,16 @@ #include "SdVolume.h" //------------------------------------------------------------------------------ /** - * \struct fpos_t + * \struct filepos_t * \brief internal type for istream * do not use in user apps */ -struct fpos_t { +struct filepos_t { /** stream position */ uint32_t position; /** cluster for position */ uint32_t cluster; - fpos_t() : position(0), cluster(0) {} + filepos_t() : position(0), cluster(0) {} }; // use the gnu style oflag in open() @@ -196,11 +196,11 @@ class SdBaseFile { /** get position for streams * \param[out] pos struct to receive position */ - void getpos(fpos_t* pos); + void getpos(filepos_t* pos); /** set position for streams * \param[out] pos struct with value for new position */ - void setpos(fpos_t* pos); + void setpos(filepos_t* pos); //---------------------------------------------------------------------------- bool close(); bool contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock); From 6129c9167d342cf09413a04b837c58c76d10a9e5 Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Tue, 27 Dec 2016 16:43:43 -0700 Subject: [PATCH 05/49] Make an attempt at resuming previous fan speed when resuming from a paused SD card print via the menu. --- Firmware/ultralcd.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6827a60c5..63d0ac71f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -97,6 +97,7 @@ int8_t SilentModeMenu = 0; int lcd_commands_type=LCD_COMMAND_IDLE; int lcd_commands_step=0; bool isPrintPaused = false; +int oldFanSpeed = 0; bool farm_mode = false; int farm_no = 0; int farm_timer = 30; @@ -662,12 +663,19 @@ static void lcd_return_to_status() { } static void lcd_sdcard_pause() { + oldFanSpeed = fanSpeed; card.pauseSDPrint(); isPrintPaused = true; lcdDrawUpdate = 3; } static void lcd_sdcard_resume() { + if (oldFanSpeed) { + fanSpeed = oldFanSpeed; + SET_OUTPUT(FAN_PIN); + WRITE(FAN_PIN, fanSpeed); + oldFanSpeed = 0; + } card.startFileprint(); isPrintPaused = false; lcdDrawUpdate = 3; From 2db00510c2964e6feb80a7fc8c5c732b9eef4bd8 Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Sat, 31 Dec 2016 07:20:15 -0700 Subject: [PATCH 06/49] Add modifications from the Mini Rambo 1.3a header to the Mini Rambo 1.0a header. --- .../variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 2c49e68a8..a4b0f784f 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -18,6 +18,12 @@ GENERAL SETTINGS // Electronics #define MOTHERBOARD BOARD_RAMBO_MINI_1_0 +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + /*------------------------------------ AXIS SETTINGS @@ -73,15 +79,26 @@ EXTRUDER SETTINGS #define BED_MINTEMP 15 // Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else #define HEATER_0_MAXTEMP 305 +#endif #define HEATER_1_MAXTEMP 305 #define HEATER_2_MAXTEMP 305 #define BED_MAXTEMP 150 +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else // Define PID constants for extruder #define DEFAULT_Kp 40.925 #define DEFAULT_Ki 4.875 #define DEFAULT_Kd 86.085 +#endif // Extrude mintemp #define EXTRUDE_MINTEMP 130 @@ -226,9 +243,16 @@ BED SETTINGS #ifdef PIDTEMPBED //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else #define DEFAULT_bedKp 126.13 #define DEFAULT_bedKi 4.30 #define DEFAULT_bedKd 924.76 +#endif //120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) //from pidautotune @@ -305,12 +329,26 @@ THERMISTORS SETTINGS // 1047 is Pt1000 with 4k7 pullup // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup +// 148 is Pt100 with 4k7 pullup and no PT100 Amplifier (in case type 147 doesn't work) +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier // 110 is Pt100 with 1k pullup (non standard) +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 147 +#else #define TEMP_SENSOR_0 5 +#endif #define TEMP_SENSOR_1 0 #define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 147 +#else #define TEMP_SENSOR_BED 1 +#endif #endif //__CONFIGURATION_PRUSA_H From 3afe6d09e28822f0cf58b47e0236d0e982ac987c Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Sat, 31 Dec 2016 16:24:33 -0700 Subject: [PATCH 07/49] Rebase to upstream changes. --- Firmware/Marlin_main.cpp | 126 ++++++++++++++++++++++++++++++++++----- Firmware/stepper.cpp | 2 +- Firmware/ultralcd.cpp | 56 ++++++++++++++++- 3 files changed, 167 insertions(+), 17 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7d276cd87..9891d3c27 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -874,6 +874,88 @@ static void lcd_language_menu(); enum MeshLevelingState { MeshReport, MeshStart, MeshNext, MeshSet }; #endif + +// Factory reset function +// This function is used to erase parts or whole EEPROM memory which is used for storing calibration and and so on. +// Level input parameter sets depth of reset +// Quiet parameter masks all waitings for user interact. +int er_progress = 0; +void factory_reset(char level, bool quiet) +{ + + switch (level) { + + // Level 0: erase everything, whole EEPROM will be set to 0xFF + case 0: + + lcd_print_at_PGM(1,2,PSTR("ERASING all data")); + + WRITE(BEEPER, HIGH); + _delay_ms(100); + WRITE(BEEPER, LOW); + _delay_ms(100); + WRITE(BEEPER, HIGH); + _delay_ms(100); + WRITE(BEEPER, LOW); + _delay_ms(200); + + er_progress = 0; + lcd_print_at_PGM(3,3,PSTR(" ")); + lcd_implementation_print_at(3,3, er_progress); + + // Erase EEPROM + for (int i = 0; i < 4096; i++) { + eeprom_write_byte((uint8_t*)i, 0xFF); + + if (i % 41 == 0) { + er_progress++; + lcd_print_at_PGM(3,3,PSTR(" ")); + lcd_implementation_print_at(3,3, er_progress); + lcd_printPGM(PSTR("%")); + } + + } + + + break; + + + // Level 1: Language reset + case 1: + WRITE(BEEPER, HIGH); + _delay_ms(100); + WRITE(BEEPER, LOW); + + lcd_force_language_selection(); + break; + + + // Level 2: Prepare for shipping + case 2: + lcd_print_at_PGM(1,2,PSTR("Shipping prep")); + + // Force language selection at the next boot up. + lcd_force_language_selection(); + // Force the "Follow calibration flow" message at the next boot up. + calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION); + farm_no = 0; + EEPROM_save_B(EEPROM_FARM_MODE, &farm_no); + farm_mode = false; + + WRITE(BEEPER, HIGH); + _delay_ms(100); + WRITE(BEEPER, LOW); + + break; + + default: + break; + } + + +} + + // "Setup" function is called by the Arduino framework on startup. // Before startup, the Timers-functions (PWM)/Analog RW and HardwareSerial provided by the Arduino-code // are initialized by the main() routine provided by the Arduino framework. @@ -948,21 +1030,33 @@ void setup() _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); + + - // Force language selection at the next boot up. - lcd_force_language_selection(); - // Force the "Follow calibration flow" message at the next boot up. - calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION); - farm_no = 0; - EEPROM_save_B(EEPROM_FARM_MODE, &farm_no); - farm_mode = false; - - while (!READ(BTN_ENC)); - - WRITE(BEEPER, LOW); - + _delay_ms(2000); + if (!READ(BTN_ENC)) + { + + factory_reset(0,false); + } + else + { + factory_reset(2,false); + + } + + _delay_ms(2000); + +/* #ifdef MESH_BED_LEVELING _delay_ms(2000); @@ -989,8 +1083,8 @@ void setup() _delay_ms(100); WRITE(BEEPER, LOW); } -#endif // mesh - +#endif // mesh */ + } } else @@ -1806,6 +1900,10 @@ void process_commands() // Kick farm link timer kicktime = millis(); + } else if(code_seen("FR")) { + // Factory full reset + factory_reset(0,true); + } //else if (code_seen('Cal')) { // lcd_calibration(); diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 783299b97..919c55918 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -1017,7 +1017,7 @@ void digipot_init() //Initialize Digipot Motor Current pinMode(MOTOR_CURRENT_PWM_XY_PIN, OUTPUT); pinMode(MOTOR_CURRENT_PWM_Z_PIN, OUTPUT); pinMode(MOTOR_CURRENT_PWM_E_PIN, OUTPUT); - if(SilentMode == 0){ + if((SilentMode == 0) || (farm_mode) ){ motor_current_setting[0] = motor_current_setting_loud[0]; motor_current_setting[1] = motor_current_setting_loud[1]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 63d0ac71f..f85538819 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -25,6 +25,8 @@ extern int lcd_change_fil_state; //Function pointer to menu functions. typedef void (*menuFunc_t)(); +static void lcd_sd_updir(); + struct EditMenuParentState { //prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings. @@ -2155,7 +2157,7 @@ static void lcd_settings_menu() MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); } - if (SilentModeMenu == 0) { + if ((SilentModeMenu == 0) || (farm_mode) ) { MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); } else { MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); @@ -2518,7 +2520,57 @@ static void lcd_main_menu() MENU_ITEM(back, MSG_WATCH, lcd_status_screen); - + if (farm_mode && !IS_SD_PRINTING ) + { + + int tempScrool = 0; + if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) + //delay(100); + return; // nothing to do (so don't thrash the SD card) + uint16_t fileCnt = card.getnrfilenames(); + + card.getWorkDirName(); + if (card.filename[0] == '/') + { +#if SDCARDDETECT == -1 + MENU_ITEM(function, MSG_REFRESH, lcd_sd_refresh); +#endif + } else { + MENU_ITEM(function, PSTR(LCD_STR_FOLDER ".."), lcd_sd_updir); + } + + for (uint16_t i = 0; i < fileCnt; i++) + { + if (_menuItemNr == _lineNr) + { +#ifndef SDCARD_RATHERRECENTFIRST + card.getfilename(i); +#else + card.getfilename(fileCnt - 1 - i); +#endif + if (card.filenameIsDir) + { + MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename); + } else { + + MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename); + + + + + } + } else { + MENU_ITEM_DUMMY(); + } + } + + MENU_ITEM(back, PSTR("- - - - - - - - -"), lcd_status_screen); + + + } + + + if ( ( IS_SD_PRINTING || is_usb_printing ) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) ) { MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);//8 From 0181a17263ae37d6a0a0418e2f60355370b7d4d2 Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Mon, 9 Jan 2017 17:11:47 -0700 Subject: [PATCH 08/49] Revert "Rebase to upstream changes." This reverts commit 3afe6d09e28822f0cf58b47e0236d0e982ac987c. Resolves conflicts with upstream Pull request. --- Firmware/Marlin_main.cpp | 126 +++++---------------------------------- Firmware/stepper.cpp | 2 +- Firmware/ultralcd.cpp | 56 +---------------- 3 files changed, 17 insertions(+), 167 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 9891d3c27..7d276cd87 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -874,88 +874,6 @@ static void lcd_language_menu(); enum MeshLevelingState { MeshReport, MeshStart, MeshNext, MeshSet }; #endif - -// Factory reset function -// This function is used to erase parts or whole EEPROM memory which is used for storing calibration and and so on. -// Level input parameter sets depth of reset -// Quiet parameter masks all waitings for user interact. -int er_progress = 0; -void factory_reset(char level, bool quiet) -{ - - switch (level) { - - // Level 0: erase everything, whole EEPROM will be set to 0xFF - case 0: - - lcd_print_at_PGM(1,2,PSTR("ERASING all data")); - - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); - _delay_ms(100); - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); - _delay_ms(200); - - er_progress = 0; - lcd_print_at_PGM(3,3,PSTR(" ")); - lcd_implementation_print_at(3,3, er_progress); - - // Erase EEPROM - for (int i = 0; i < 4096; i++) { - eeprom_write_byte((uint8_t*)i, 0xFF); - - if (i % 41 == 0) { - er_progress++; - lcd_print_at_PGM(3,3,PSTR(" ")); - lcd_implementation_print_at(3,3, er_progress); - lcd_printPGM(PSTR("%")); - } - - } - - - break; - - - // Level 1: Language reset - case 1: - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); - - lcd_force_language_selection(); - break; - - - // Level 2: Prepare for shipping - case 2: - lcd_print_at_PGM(1,2,PSTR("Shipping prep")); - - // Force language selection at the next boot up. - lcd_force_language_selection(); - // Force the "Follow calibration flow" message at the next boot up. - calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION); - farm_no = 0; - EEPROM_save_B(EEPROM_FARM_MODE, &farm_no); - farm_mode = false; - - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); - - break; - - default: - break; - } - - -} - - // "Setup" function is called by the Arduino framework on startup. // Before startup, the Timers-functions (PWM)/Analog RW and HardwareSerial provided by the Arduino-code // are initialized by the main() routine provided by the Arduino framework. @@ -1030,33 +948,21 @@ void setup() _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); - - - _delay_ms(2000); - if (!READ(BTN_ENC)) - { - - factory_reset(0,false); - } - else - { - factory_reset(2,false); - - } - - _delay_ms(2000); - -/* + // Force language selection at the next boot up. + lcd_force_language_selection(); + // Force the "Follow calibration flow" message at the next boot up. + calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION); + farm_no = 0; + EEPROM_save_B(EEPROM_FARM_MODE, &farm_no); + farm_mode = false; + + while (!READ(BTN_ENC)); + + WRITE(BEEPER, LOW); + #ifdef MESH_BED_LEVELING _delay_ms(2000); @@ -1083,8 +989,8 @@ void setup() _delay_ms(100); WRITE(BEEPER, LOW); } -#endif // mesh */ - +#endif // mesh + } } else @@ -1900,10 +1806,6 @@ void process_commands() // Kick farm link timer kicktime = millis(); - } else if(code_seen("FR")) { - // Factory full reset - factory_reset(0,true); - } //else if (code_seen('Cal')) { // lcd_calibration(); diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 919c55918..783299b97 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -1017,7 +1017,7 @@ void digipot_init() //Initialize Digipot Motor Current pinMode(MOTOR_CURRENT_PWM_XY_PIN, OUTPUT); pinMode(MOTOR_CURRENT_PWM_Z_PIN, OUTPUT); pinMode(MOTOR_CURRENT_PWM_E_PIN, OUTPUT); - if((SilentMode == 0) || (farm_mode) ){ + if(SilentMode == 0){ motor_current_setting[0] = motor_current_setting_loud[0]; motor_current_setting[1] = motor_current_setting_loud[1]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f85538819..63d0ac71f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -25,8 +25,6 @@ extern int lcd_change_fil_state; //Function pointer to menu functions. typedef void (*menuFunc_t)(); -static void lcd_sd_updir(); - struct EditMenuParentState { //prevMenu and prevEncoderPosition are used to store the previous menu location when editing settings. @@ -2157,7 +2155,7 @@ static void lcd_settings_menu() MENU_ITEM(gcode, MSG_DISABLE_STEPPERS, PSTR("M84")); } - if ((SilentModeMenu == 0) || (farm_mode) ) { + if (SilentModeMenu == 0) { MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); } else { MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); @@ -2520,57 +2518,7 @@ static void lcd_main_menu() MENU_ITEM(back, MSG_WATCH, lcd_status_screen); - if (farm_mode && !IS_SD_PRINTING ) - { - - int tempScrool = 0; - if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) - //delay(100); - return; // nothing to do (so don't thrash the SD card) - uint16_t fileCnt = card.getnrfilenames(); - - card.getWorkDirName(); - if (card.filename[0] == '/') - { -#if SDCARDDETECT == -1 - MENU_ITEM(function, MSG_REFRESH, lcd_sd_refresh); -#endif - } else { - MENU_ITEM(function, PSTR(LCD_STR_FOLDER ".."), lcd_sd_updir); - } - - for (uint16_t i = 0; i < fileCnt; i++) - { - if (_menuItemNr == _lineNr) - { -#ifndef SDCARD_RATHERRECENTFIRST - card.getfilename(i); -#else - card.getfilename(fileCnt - 1 - i); -#endif - if (card.filenameIsDir) - { - MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename); - } else { - - MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename); - - - - - } - } else { - MENU_ITEM_DUMMY(); - } - } - - MENU_ITEM(back, PSTR("- - - - - - - - -"), lcd_status_screen); - - - } - - - + if ( ( IS_SD_PRINTING || is_usb_printing ) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) ) { MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);//8 From 7d5affa12e39f67fc58888c8feaaa3627bab0884 Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Thu, 12 Jan 2017 15:46:17 -0700 Subject: [PATCH 09/49] Add additional debugging information for temerature sensor calibration. --- Firmware/Marlin_main.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7d276cd87..c7b2fbdcc 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3520,11 +3520,18 @@ Sigma_Exit: #endif #ifdef SHOW_TEMP_ADC_VALUES + {float raw = 0.0; + #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 SERIAL_PROTOCOLPGM(" ADC B:"); SERIAL_PROTOCOL_F(degBed(),1); SERIAL_PROTOCOLPGM("C->"); - SERIAL_PROTOCOL_F(rawBedTemp()/OVERSAMPLENR,0); + raw = rawBedTemp(); + SERIAL_PROTOCOL_F(raw/OVERSAMPLENR,5); + SERIAL_PROTOCOLPGM(" Rb->"); + SERIAL_PROTOCOL_F(100 * (1 + (PtA * (raw/OVERSAMPLENR)) + (PtB * sq((raw/OVERSAMPLENR)))), 5); + SERIAL_PROTOCOLPGM(" Rxb->"); + SERIAL_PROTOCOL_F(raw, 5); #endif for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) { SERIAL_PROTOCOLPGM(" T"); @@ -3532,8 +3539,17 @@ Sigma_Exit: SERIAL_PROTOCOLPGM(":"); SERIAL_PROTOCOL_F(degHotend(cur_extruder),1); SERIAL_PROTOCOLPGM("C->"); - SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0); - } + raw = rawHotendTemp(cur_extruder); + SERIAL_PROTOCOL_F(raw/OVERSAMPLENR,5); + SERIAL_PROTOCOLPGM(" Rt"); + SERIAL_PROTOCOL(cur_extruder); + SERIAL_PROTOCOLPGM("->"); + SERIAL_PROTOCOL_F(100 * (1 + (PtA * (raw/OVERSAMPLENR)) + (PtB * sq((raw/OVERSAMPLENR)))), 5); + SERIAL_PROTOCOLPGM(" Rx"); + SERIAL_PROTOCOL(cur_extruder); + SERIAL_PROTOCOLPGM("->"); + SERIAL_PROTOCOL_F(raw, 5); + }} #endif SERIAL_PROTOCOLLN(""); From bcc0e83d76e88987a00b28e7b58a094f6aeab908 Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Thu, 12 Jan 2017 15:49:48 -0700 Subject: [PATCH 10/49] Fix up some accuracy issues with PT100 temp sensors in relation to the Rambo v1.3a --- Firmware/thermistortables.h | 189 ++++++++++-------- .../variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 4 +- .../variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 6 +- 3 files changed, 116 insertions(+), 83 deletions(-) diff --git a/Firmware/thermistortables.h b/Firmware/thermistortables.h index 28d0b8678..faa7e5667 100644 --- a/Firmware/thermistortables.h +++ b/Firmware/thermistortables.h @@ -1033,7 +1033,9 @@ const short temptable_12[][2] PROGMEM = { #define PtA 3.9083E-3 #define PtB -5.775E-7 +#define PtC -4.183E-12 #define PtRt(T,R0) ((R0)*(1.0+(PtA)*(T)+(PtB)*(T)*(T))) +#define PtRtNew(T,R0) ((R0)*(1.0+(PtA)*(T)+(PtB)*(T)*(T) + (T-100)*PtC*(T)*(T)*(T))) #define PtAdVal(T,R0,Rup) (short)(1024/(Rup/PtRt(T,R0)+1)) #define PtLine(T,R0,Rup) { PtAdVal(T,R0,Rup)*OVERSAMPLENR, T }, @@ -1059,93 +1061,124 @@ const short temptable_147[][2] PROGMEM = { PtLine(200,100,4700) PtLine(250,100,4700) PtLine(300,100,4700) - PtLine(350,100,4700) - PtLine(400,100,4700) - PtLine(450,100,4700) - PtLine(500,100,4700) - PtLine(550,100,4700) - PtLine(600,100,4700) - PtLine(650,100,4700) - PtLine(700,100,4700) - PtLine(750,100,4700) - PtLine(800,100,4700) - PtLine(850,100,4700) - PtLine(900,100,4700) - PtLine(950,100,4700) - PtLine(1000,100,4700) - PtLine(1050,100,4700) - PtLine(1100,100,4700) }; #endif -#if (THERMISTORHEATER_0 == 148) || (THERMISTORHEATER_1 == 148) || (THERMISTORHEATER_2 == 148) || (THERMISTORBED == 148) // Pt100 with 4k7 MiniRambo pullup, no Amp. +// E3D Pt100 with 4k7 MiniRambo pullup, no Amp on the MiniRambo v1.3a +#if (THERMISTORHEATER_0 == 148) || (THERMISTORHEATER_1 == 148) || (THERMISTORHEATER_2 == 148) || (THERMISTORBED == 148) const short temptable_148[][2] PROGMEM = { -// More raw data values avaliable via http://www.micropik.com/PDF/pt100.pdf -// This information is taken from http://shop.prusa3d.com/forum/improvements-f14/mini-rambo-1-3-and-e3d-with-pt100-t700-s40.html#p20938 -{292,0}, // first two entries are bogus, just to get the heater running -{356,50}, -{469,100}, -{531,150}, -{590,200}, -{649,250}, -{708,300}, -{763,350}, -{819,400}, -{872,450}, +// These values have been calculated and tested over many days. See https://docs.google.com/spreadsheets/d/1MJXa6feEe0mGVCT2TrBwLxVOMoLDkJlvfQ4JXhAdV_E +// Values that are missing from the 5C gap are missing due to resolution limits. +{19.00000 * OVERSAMPLENR, 0}, +{19.25000 * OVERSAMPLENR, 5}, +{19.50000 * OVERSAMPLENR, 10}, +{19.87500 * OVERSAMPLENR, 15}, +{20.25000 * OVERSAMPLENR, 20}, +{21.00000 * OVERSAMPLENR, 25}, +{21.75000 * OVERSAMPLENR, 35}, +{22.00000 * OVERSAMPLENR, 40}, +{23.00000 * OVERSAMPLENR, 50}, // 55C is more commonly used. +{23.75000 * OVERSAMPLENR, 60}, +{24.00000 * OVERSAMPLENR, 65}, +{24.06250 * OVERSAMPLENR, 70}, +{25.00000 * OVERSAMPLENR, 75}, +{25.50000 * OVERSAMPLENR, 85}, +{26.00000 * OVERSAMPLENR, 90}, +{26.93750 * OVERSAMPLENR,100}, +{27.00000 * OVERSAMPLENR,105}, +{27.37500 * OVERSAMPLENR,110}, +{28.00000 * OVERSAMPLENR,115}, +{29.00000 * OVERSAMPLENR,125}, +{29.25000 * OVERSAMPLENR,135}, +{30.00000 * OVERSAMPLENR,140}, +{35.50000 * OVERSAMPLENR,150}, +{31.00000 * OVERSAMPLENR,155}, +{32.00000 * OVERSAMPLENR,165}, +{32.18750 * OVERSAMPLENR,175}, +{33.00000 * OVERSAMPLENR,180}, +{33.62500 * OVERSAMPLENR,190}, +{34.00000 * OVERSAMPLENR,195}, +{35.00000 * OVERSAMPLENR,205}, +{35.50000 * OVERSAMPLENR,215}, +{36.00000 * OVERSAMPLENR,220}, +{36.75000 * OVERSAMPLENR,230}, +{37.00000 * OVERSAMPLENR,235}, +{37.75000 * OVERSAMPLENR,245}, +{38.00000 * OVERSAMPLENR,250}, +{38.12500 * OVERSAMPLENR,255}, +{39.00000 * OVERSAMPLENR,260}, +{40.00000 * OVERSAMPLENR,275}, +{40.25000 * OVERSAMPLENR,285}, +{41.00000 * OVERSAMPLENR,290}, +{41.25000 * OVERSAMPLENR,300}, +{42.00000 * OVERSAMPLENR,305}, +{43.00000 * OVERSAMPLENR,315}, +{43.25000 * OVERSAMPLENR,325}, +{44.00000 * OVERSAMPLENR,330}, +{44.18750 * OVERSAMPLENR,340}, +{45.00000 * OVERSAMPLENR,345}, +{45.25000 * OVERSAMPLENR,355}, +{46.00000 * OVERSAMPLENR,360}, +{46.62500 * OVERSAMPLENR,370}, +{47.00000 * OVERSAMPLENR,375}, +{47.25000 * OVERSAMPLENR,385}, +{48.00000 * OVERSAMPLENR,390}, +{48.75000 * OVERSAMPLENR,400}, +{49.00000 * OVERSAMPLENR,405}, }; #endif #if (THERMISTORHEATER_0 == 247) || (THERMISTORHEATER_1 == 247) || (THERMISTORHEATER_2 == 247) || (THERMISTORBED == 247) // Pt100 with 4k7 MiniRambo pullup & PT100 Amplifier const short temptable_247[][2] PROGMEM = { // Calculated from Bob-the-Kuhn's PT100 calculator listed in https://github.com/MarlinFirmware/Marlin/issues/5543 // and the table provided by E3D at http://wiki.e3d-online.com/wiki/E3D_PT100_Amplifier_Documentation#Output_Characteristics. -{ 0 * OVERSAMPLENR, 0 }, -{ 244 * OVERSAMPLENR, 1 }, -{ 252 * OVERSAMPLENR, 10 }, -{ 262 * OVERSAMPLENR, 20 }, -{ 270 * OVERSAMPLENR, 30 }, -{ 278 * OVERSAMPLENR, 40 }, -{ 286 * OVERSAMPLENR, 50 }, -{ 294 * OVERSAMPLENR, 60 }, -{ 302 * OVERSAMPLENR, 70 }, -{ 310 * OVERSAMPLENR, 80 }, -{ 318 * OVERSAMPLENR, 90 }, -{ 326 * OVERSAMPLENR, 100 }, -{ 334 * OVERSAMPLENR, 110 }, -{ 344 * OVERSAMPLENR, 120 }, -{ 352 * OVERSAMPLENR, 130 }, -{ 358 * OVERSAMPLENR, 140 }, -{ 366 * OVERSAMPLENR, 150 }, -{ 374 * OVERSAMPLENR, 160 }, -{ 382 * OVERSAMPLENR, 170 }, -{ 390 * OVERSAMPLENR, 180 }, -{ 398 * OVERSAMPLENR, 190 }, -{ 406 * OVERSAMPLENR, 200 }, -{ 414 * OVERSAMPLENR, 210 }, -{ 422 * OVERSAMPLENR, 220 }, -{ 430 * OVERSAMPLENR, 230 }, -{ 436 * OVERSAMPLENR, 240 }, -{ 444 * OVERSAMPLENR, 250 }, -{ 452 * OVERSAMPLENR, 260 }, -{ 458 * OVERSAMPLENR, 270 }, -{ 466 * OVERSAMPLENR, 280 }, -{ 474 * OVERSAMPLENR, 290 }, -{ 480 * OVERSAMPLENR, 300 }, -{ 488 * OVERSAMPLENR, 310 }, -{ 496 * OVERSAMPLENR, 320 }, -{ 504 * OVERSAMPLENR, 330 }, -{ 510 * OVERSAMPLENR, 340 }, -{ 518 * OVERSAMPLENR, 350 }, -{ 524 * OVERSAMPLENR, 360 }, -{ 532 * OVERSAMPLENR, 370 }, -{ 538 * OVERSAMPLENR, 380 }, -{ 546 * OVERSAMPLENR, 390 }, -{ 554 * OVERSAMPLENR, 400 }, -{ 622 * OVERSAMPLENR, 500 }, -{ 688 * OVERSAMPLENR, 600 }, -{ 749 * OVERSAMPLENR, 700 }, -{ 809 * OVERSAMPLENR, 800 }, -{ 865 * OVERSAMPLENR, 900 }, -{ 919 * OVERSAMPLENR, 1000 }, -{ 969 * OVERSAMPLENR, 1100 }, +{ 0 * OVERSAMPLENR, 0}, +{241 * OVERSAMPLENR, 1}, +{249 * OVERSAMPLENR, 10}, +{259 * OVERSAMPLENR, 20}, +{267 * OVERSAMPLENR, 30}, +{275 * OVERSAMPLENR, 40}, +{283 * OVERSAMPLENR, 50}, +{291 * OVERSAMPLENR, 60}, +{299 * OVERSAMPLENR, 70}, +{307 * OVERSAMPLENR, 80}, +{315 * OVERSAMPLENR, 90}, +{323 * OVERSAMPLENR, 100}, +{331 * OVERSAMPLENR, 110}, +{340 * OVERSAMPLENR, 120}, +{348 * OVERSAMPLENR, 130}, +{354 * OVERSAMPLENR, 140}, +{362 * OVERSAMPLENR, 150}, +{370 * OVERSAMPLENR, 160}, +{378 * OVERSAMPLENR, 170}, +{386 * OVERSAMPLENR, 180}, +{394 * OVERSAMPLENR, 190}, +{402 * OVERSAMPLENR, 200}, +{410 * OVERSAMPLENR, 210}, +{418 * OVERSAMPLENR, 220}, +{426 * OVERSAMPLENR, 230}, +{432 * OVERSAMPLENR, 240}, +{440 * OVERSAMPLENR, 250}, +{448 * OVERSAMPLENR, 260}, +{454 * OVERSAMPLENR, 270}, +{462 * OVERSAMPLENR, 280}, +{469 * OVERSAMPLENR, 290}, +{475 * OVERSAMPLENR, 300}, +{483 * OVERSAMPLENR, 310}, +{491 * OVERSAMPLENR, 320}, +{499 * OVERSAMPLENR, 330}, +{505 * OVERSAMPLENR, 340}, +{513 * OVERSAMPLENR, 350}, +{519 * OVERSAMPLENR, 360}, +{527 * OVERSAMPLENR, 370}, +{533 * OVERSAMPLENR, 380}, +{541 * OVERSAMPLENR, 390}, +{549 * OVERSAMPLENR, 400}, +{616 * OVERSAMPLENR, 500}, +{682 * OVERSAMPLENR, 600}, +{741 * OVERSAMPLENR, 700}, +{801 * OVERSAMPLENR, 800}, +{856 * OVERSAMPLENR, 900}, +{910 * OVERSAMPLENR, 1000}, +{960 * OVERSAMPLENR, 1100}, }; #endif #if (THERMISTORHEATER_0 == 1010) || (THERMISTORHEATER_1 == 1010) || (THERMISTORHEATER_2 == 1010) || (THERMISTORBED == 1010) // Pt1000 with 1k0 pullup diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index a4b0f784f..506495b03 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -336,7 +336,7 @@ THERMISTORS SETTINGS #if defined(E3D_PT100_EXTRUDER_WITH_AMP) #define TEMP_SENSOR_0 247 #elif defined(E3D_PT100_EXTRUDER_NO_AMP) -#define TEMP_SENSOR_0 147 +#define TEMP_SENSOR_0 148 #else #define TEMP_SENSOR_0 5 #endif @@ -345,7 +345,7 @@ THERMISTORS SETTINGS #if defined(E3D_PT100_BED_WITH_AMP) #define TEMP_SENSOR_BED 247 #elif defined(E3D_PT100_BED_NO_AMP) -#define TEMP_SENSOR_BED 147 +#define TEMP_SENSOR_BED 148 #else #define TEMP_SENSOR_BED 1 #endif diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 60b74d413..b0e1b9ae5 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -329,14 +329,14 @@ THERMISTORS SETTINGS // 1047 is Pt1000 with 4k7 pullup // 1010 is Pt1000 with 1k pullup (non standard) // 147 is Pt100 with 4k7 pullup -// 148 is Pt100 with 4k7 pullup and no PT100 Amplifier (in case type 147 doesn't work) +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a // 247 is Pt100 with 4k7 pullup and PT100 Amplifier // 110 is Pt100 with 1k pullup (non standard) #if defined(E3D_PT100_EXTRUDER_WITH_AMP) #define TEMP_SENSOR_0 247 #elif defined(E3D_PT100_EXTRUDER_NO_AMP) -#define TEMP_SENSOR_0 147 +#define TEMP_SENSOR_0 148 #else #define TEMP_SENSOR_0 5 #endif @@ -345,7 +345,7 @@ THERMISTORS SETTINGS #if defined(E3D_PT100_BED_WITH_AMP) #define TEMP_SENSOR_BED 247 #elif defined(E3D_PT100_BED_NO_AMP) -#define TEMP_SENSOR_BED 147 +#define TEMP_SENSOR_BED 148 #else #define TEMP_SENSOR_BED 1 #endif From c441b4acdb55e7af49d6892b718f028a1fb81be0 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 27 Feb 2017 17:24:26 +0100 Subject: [PATCH 11/49] temp calibration initial version --- Firmware/Configuration.h | 2 + Firmware/Marlin.h | 4 +- Firmware/Marlin_main.cpp | 177 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 182 insertions(+), 1 deletion(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 27a399130..3ac6ec213 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -34,6 +34,8 @@ #define EEPROM_FARM_MODE (EEPROM_BED_CALIBRATION_Z_JITTER-4) +#define EEPROM_PROBE_TEMP_SHIFT (EEPROM_FARM_MODE - 2*5) //5 x int for storing pinda probe temp shift relative to 50 C; unit: motor steps + // Correction of the bed leveling, in micrometers. // Maximum 50 micrometers allowed. // Bed correction is valid if set to 1. If set to zero or 255, the successive 4 bytes are invalid. diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index adcf8f201..466805b07 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -326,4 +326,6 @@ void d_setup(); float d_ReadData(); void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y); -#endif \ No newline at end of file +#endif +float temp_comp_interpolation(float temperature); +void temp_compensation_apply(); \ No newline at end of file diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 41328c2e1..c0b00713b 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2767,6 +2767,87 @@ void process_commands() * */ + case 76: //PINDA probe temperature compensation + { + setTargetBed(PINDA_MIN_T); + float zero_z; + int z_shift = 0; //unit: steps + int t_c; // temperature + + if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) { + // We don't know where we are! HOME! + // Push the commands to the front of the message queue in the reverse order! + // There shall be always enough space reserved for these commands. + repeatcommand_front(); // repeat G76 with all its parameters + enquecommand_front_P((PSTR("G28 W0"))); + break; + } + current_position[X_AXIS] = PINDA_PREHEAT_X; + current_position[Y_AXIS] = PINDA_PREHEAT_Y; + current_position[Z_AXIS] = 0; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); + st_synchronize(); + + while (degBed() < PINDA_MIN_T) delay_keep_alive(1000); + + //enquecommand_P(PSTR("M190 S50")); + + delay_keep_alive(PINDA_HEAT_T * 1000); + + current_position[Z_AXIS] = 5; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); + + current_position[X_AXIS] = pgm_read_float(bed_ref_points); + current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1); + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); + st_synchronize(); + + find_bed_induction_sensor_point_z(-1.f); + zero_z = current_position[Z_AXIS]; + + //current_position[Z_AXIS] + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("ZERO: "); + MYSERIAL.print(current_position[Z_AXIS]); + SERIAL_ECHOLNPGM(""); + + for (int i = 0; i<5; i++) { + + t_c = 60 + i * 10; + + setTargetBed(t_c); + current_position[X_AXIS] = PINDA_PREHEAT_X; + current_position[Y_AXIS] = PINDA_PREHEAT_Y; + current_position[Z_AXIS] = 0; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); + st_synchronize(); + while (degBed() < t_c) delay_keep_alive(1000); + delay_keep_alive(PINDA_HEAT_T * 1000); + current_position[Z_AXIS] = 5; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); + current_position[X_AXIS] = pgm_read_float(bed_ref_points); + current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1); + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); + st_synchronize(); + find_bed_induction_sensor_point_z(-1.f); + z_shift = (int)((current_position[Z_AXIS] - zero_z)*axis_steps_per_unit[Z_AXIS]); + + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("Temperature: "); + MYSERIAL.print(t_c); + SERIAL_ECHOPGM(" Z shift (mm):"); + MYSERIAL.print(current_position[Z_AXIS] - zero_z); + SERIAL_ECHOLNPGM(""); + + EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i*2, &z_shift); + + + } + setTargetBed(0); //set bed target temperature back to 0 + + } + break; + #ifdef DIS case 77: { @@ -2908,6 +2989,9 @@ void process_commands() } clean_up_after_endstop_move(); + + temp_compensation_apply(); //apply PINDA temperature compensation + // Apply Z height correction aka baby stepping before mesh bed leveing gets activated. babystep_apply(); @@ -6063,4 +6147,97 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ } +void temp_compensation_apply() { + int i_add; + int compensation_value; + int z_shift = 0; + float z_shift_mm; + + current_position[X_AXIS] = PINDA_PREHEAT_X; + current_position[Y_AXIS] = PINDA_PREHEAT_Y; + current_position[Z_AXIS] = 0; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); + st_synchronize(); + + while (fabs(degBed() - target_temperature_bed) > 3) delay_keep_alive(1000); + + delay_keep_alive(PINDA_HEAT_T * 1000); + + if (target_temperature_bed % 10 == 0 && target_temperature_bed >= 60 && target_temperature_bed <= 100) { + i_add = (target_temperature_bed - 60) / 10; + EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i_add * 2, &z_shift); + z_shift_mm = z_shift / axis_steps_per_unit[Z_AXIS]; + } + else { + //interpolation + z_shift_mm = temp_comp_interpolation(target_temperature_bed) / axis_steps_per_unit[Z_AXIS]; + } + SERIAL_PROTOCOLPGM("\n"); + SERIAL_PROTOCOLPGM("Z shift applied:"); + MYSERIAL.print(z_shift_mm); + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] - z_shift_mm, current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder); + st_synchronize(); + plan_set_z_position(current_position[Z_AXIS]); +} + +float temp_comp_interpolation(float temperature) { + //cubic spline interpolation + + int i; + int shift[6]; + float shift_f[6]; + float temp_C[6]; + + shift[0] = 0; //shift for 50 C is 0 + + int n, j, k; + float h[10], a, b, c, d, sum, s[10] = { 0 }, x[10], F[10], f[10], p, m[10][10] = { 0 }, temp; + + + for (i = 0; i < 6; i++) { + EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &shift[i + 1]); //read shift in steps from EEPROM + temp_C[i] = 50 + i * 10; //temperature in C + shift_f[i] = (float)shift[i]; + + } + for (i = 5; i > 0; i--) { + F[i] = (shift_f[i] - shift_f[i - 1]) / (temp_C[i] - temp_C[i - 1]); + h[i - 1] = temp_C[i] - temp_C[i - 1]; + } + + //*********** formation of h, s , f matrix **************// + for (i = 1; i<5; i++) { + m[i][i] = 2 * (h[i - 1] + h[i]); + if (i != 1) { + m[i][i - 1] = h[i - 1]; + m[i - 1][i] = h[i - 1]; + } + m[i][5] = 6 * (F[i + 1] - F[i]); + } + //*********** forward elimination **************// + for (i = 1; i<4; i++) { + temp = (m[i + 1][i] / m[i][i]); + for (j = 1; j <= 5; j++) + m[i + 1][j] -= temp*m[i][j]; + } + //*********** backward substitution *********// + for (i = 4; i>0; i--) { + sum = 0; + for (j = i; j <= 4; j++) + sum += m[i][j] * s[j]; + s[i] = (m[i][n - 1] - sum) / m[i][i]; + } + + for (i = 0; i<5; i++) + if (temp_C[i] <= temperature&&temperature <= temp_C[i + 1]) { + a = (s[i + 1] - s[i]) / (6 * h[i]); + b = s[i] / 2; + c = (shift[i + 1] - shift[i]) / h[i] - (2 * h[i] * s[i] + s[i + 1] * h[i]) / 6; + d = shift[i]; + sum = a*pow((p - temp_C[i]), 3) + b*pow((p - temp_C[i]), 2) + c*(p - temp_C[i]) + d; + } + return(sum); +} + + #endif \ No newline at end of file From fd3bb9c7e58dfad971c8c18cf59290ca83fd64e1 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 1 Mar 2017 11:10:29 +0100 Subject: [PATCH 12/49] delay_keep_alive function fixed, induction probe temperature calibration --- Firmware/Configuration.h | 2 +- Firmware/Marlin.h | 5 +++-- Firmware/Marlin_main.cpp | 29 ++++++++++++++++------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 3ac6ec213..fe5c18b7b 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -5,7 +5,7 @@ #include "Configuration_prusa.h" // Firmware version -#define FW_version "3.0.10" +#define FW_version "3.0.11" #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10 diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 466805b07..c9a20ac8d 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -316,7 +316,7 @@ extern void calculate_volumetric_multipliers(); // Similar to the default Arduino delay function, // but it keeps the background tasks running. -extern void delay_keep_alive(int ms); +extern void delay_keep_alive(unsigned int ms); extern void check_babystep(); @@ -328,4 +328,5 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ #endif float temp_comp_interpolation(float temperature); -void temp_compensation_apply(); \ No newline at end of file +void temp_compensation_apply(); +void temp_compensation_start(); \ No newline at end of file diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c0b00713b..ae54d136f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2791,8 +2791,7 @@ void process_commands() while (degBed() < PINDA_MIN_T) delay_keep_alive(1000); //enquecommand_P(PSTR("M190 S50")); - - delay_keep_alive(PINDA_HEAT_T * 1000); + for (int i = 0; i < PINDA_HEAT_T; i++) delay_keep_alive(1000); current_position[Z_AXIS] = 5; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); @@ -2822,7 +2821,7 @@ void process_commands() plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); st_synchronize(); while (degBed() < t_c) delay_keep_alive(1000); - delay_keep_alive(PINDA_HEAT_T * 1000); + for (int i = 0; i < PINDA_HEAT_T; i++) delay_keep_alive(1000); current_position[Z_AXIS] = 5; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); current_position[X_AXIS] = pgm_read_float(bed_ref_points); @@ -2890,7 +2889,7 @@ void process_commands() enquecommand_front_P((PSTR("G28 W0"))); break; } - + temp_compensation_start(); // Save custom message state, set a new custom message state to display: Calibrating point 9. bool custom_message_old = custom_message; unsigned int custom_message_type_old = custom_message_type; @@ -5880,7 +5879,7 @@ void calculate_volumetric_multipliers() { #endif } -void delay_keep_alive(int ms) +void delay_keep_alive(unsigned int ms) { for (;;) { manage_heater(); @@ -6147,12 +6146,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ } -void temp_compensation_apply() { - int i_add; - int compensation_value; - int z_shift = 0; - float z_shift_mm; - +void temp_compensation_start() { current_position[X_AXIS] = PINDA_PREHEAT_X; current_position[Y_AXIS] = PINDA_PREHEAT_Y; current_position[Z_AXIS] = 0; @@ -6161,7 +6155,16 @@ void temp_compensation_apply() { while (fabs(degBed() - target_temperature_bed) > 3) delay_keep_alive(1000); - delay_keep_alive(PINDA_HEAT_T * 1000); + for(int i = 0; i < PINDA_HEAT_T; i++) delay_keep_alive(1000); + + +} + +void temp_compensation_apply() { + int i_add; + int compensation_value; + int z_shift = 0; + float z_shift_mm; if (target_temperature_bed % 10 == 0 && target_temperature_bed >= 60 && target_temperature_bed <= 100) { i_add = (target_temperature_bed - 60) / 10; @@ -6170,7 +6173,7 @@ void temp_compensation_apply() { } else { //interpolation - z_shift_mm = temp_comp_interpolation(target_temperature_bed) / axis_steps_per_unit[Z_AXIS]; + //z_shift_mm = temp_comp_interpolation(target_temperature_bed) / axis_steps_per_unit[Z_AXIS]; } SERIAL_PROTOCOLPGM("\n"); SERIAL_PROTOCOLPGM("Z shift applied:"); From d31d73c56534b066ded6a0e7223ffdcf55b16aea Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 3 Mar 2017 14:12:37 +0100 Subject: [PATCH 13/49] changed eeprom address for temp shift, verbosity level for mesh bed leveling added, added debuging functions for temp calibration --- Firmware/Configuration.h | 3 +- Firmware/Marlin_main.cpp | 445 +++++++++++++++++++++++---------------- 2 files changed, 264 insertions(+), 184 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index fe5c18b7b..a0870ec60 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -34,8 +34,6 @@ #define EEPROM_FARM_MODE (EEPROM_BED_CALIBRATION_Z_JITTER-4) -#define EEPROM_PROBE_TEMP_SHIFT (EEPROM_FARM_MODE - 2*5) //5 x int for storing pinda probe temp shift relative to 50 C; unit: motor steps - // Correction of the bed leveling, in micrometers. // Maximum 50 micrometers allowed. // Bed correction is valid if set to 1. If set to zero or 255, the successive 4 bytes are invalid. @@ -46,6 +44,7 @@ #define EEPROM_BED_CORRECTION_REAR (EEPROM_BED_CORRECTION_FRONT-1) #define EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY (EEPROM_BED_CORRECTION_REAR-1) #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 // 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_main.cpp b/Firmware/Marlin_main.cpp index ae54d136f..b606a0697 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -27,14 +27,6 @@ http://reprap.org/pipermail/reprap-dev/2011-May/003323.html */ - - - - - - - - #include "Marlin.h" #ifdef ENABLE_AUTO_BED_LEVELING @@ -62,6 +54,7 @@ #include "pins_arduino.h" #include "math.h" #include "util.h" +//#include "spline.h" #ifdef BLINKM #include "BlinkM.h" @@ -2767,6 +2760,25 @@ void process_commands() * */ + case 73: + { + int i, read; + for (i = 0; i < 5; i++) { + EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &read); + MYSERIAL.print(read); + SERIAL_ECHOLNPGM(" "); + } + }break; + + case 74: + { + float result, temp; + if (code_seen('X')) temp = code_value(); + result = temp_comp_interpolation(temp); + MYSERIAL.print(result); + + }break; + case 76: //PINDA probe temperature compensation { setTargetBed(PINDA_MIN_T); @@ -2847,6 +2859,12 @@ void process_commands() } break; + case 75: + { + temp_compensation_start(); + } + break; + #ifdef DIS case 77: { @@ -2877,184 +2895,236 @@ void process_commands() #endif - case 80: - case_G80: - { - // Firstly check if we know where we are - if ( !( axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS] ) ){ - // We don't know where we are! HOME! - // Push the commands to the front of the message queue in the reverse order! - // There shall be always enough space reserved for these commands. - repeatcommand_front(); // repeat G80 with all its parameters - enquecommand_front_P((PSTR("G28 W0"))); - break; - } - temp_compensation_start(); - // Save custom message state, set a new custom message state to display: Calibrating point 9. - bool custom_message_old = custom_message; - unsigned int custom_message_type_old = custom_message_type; - unsigned int custom_message_state_old = custom_message_state; - custom_message = true; - custom_message_type = 1; - custom_message_state = (MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) + 10; - lcd_update(1); - - mbl.reset(); - // Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be - // consumed during the first movements following this statement. - babystep_undo(); + case 80: + case_G80: + { + int8_t verbosity_level = 0; + if (code_seen('V')) { + // Just 'V' without a number counts as V1. + char c = strchr_pointer[1]; + verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short(); + } + // Firstly check if we know where we are + if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) { + // We don't know where we are! HOME! + // Push the commands to the front of the message queue in the reverse order! + // There shall be always enough space reserved for these commands. + repeatcommand_front(); // repeat G80 with all its parameters + enquecommand_front_P((PSTR("G28 W0"))); + break; + } - // Cycle through all points and probe them - // First move up. During this first movement, the babystepping will be reverted. - current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder); - // The move to the first calibration point. - current_position[X_AXIS] = pgm_read_float(bed_ref_points); - current_position[Y_AXIS] = pgm_read_float(bed_ref_points+1); - world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); -// mbl.get_meas_xy(0, 0, current_position[X_AXIS], current_position[Y_AXIS], false); - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS]/30, active_extruder); - // Wait until the move is finished. - st_synchronize(); - - int mesh_point = 0; - - int ix = 0; - int iy = 0; - - int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS]/20; - int Z_PROBE_FEEDRATE = homing_feedrate[Z_AXIS]/60; - int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS]/40; - bool has_z = is_bed_z_jitter_data_valid(); - setup_for_endstop_move(false); - const char *kill_message = NULL; - while (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) { - // Get coords of a measuring point. - ix = mesh_point % MESH_MEAS_NUM_X_POINTS; - iy = mesh_point / MESH_MEAS_NUM_X_POINTS; - if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; // Zig zag - float z0 = 0.f; - if (has_z && mesh_point > 0) { - uint16_t z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * (ix + iy * 3 - 1))); - z0 = mbl.z_values[0][0] + *reinterpret_cast(&z_offset_u) * 0.01; - #if 0 - SERIAL_ECHOPGM("Bed leveling, point: "); - MYSERIAL.print(mesh_point); - SERIAL_ECHOPGM(", calibration z: "); - MYSERIAL.print(z0, 5); - SERIAL_ECHOLNPGM(""); - #endif - } - - // Move Z up to MESH_HOME_Z_SEARCH. - current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); - st_synchronize(); + // Save custom message state, set a new custom message state to display: Calibrating point 9. + bool custom_message_old = custom_message; + unsigned int custom_message_type_old = custom_message_type; + unsigned int custom_message_state_old = custom_message_state; + custom_message = true; + custom_message_type = 1; + custom_message_state = (MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) + 10; + lcd_update(1); - // Move to XY position of the sensor point. - current_position[X_AXIS] = pgm_read_float(bed_ref_points+2*mesh_point); - current_position[Y_AXIS] = pgm_read_float(bed_ref_points+2*mesh_point+1); - world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], XY_AXIS_FEEDRATE, active_extruder); - st_synchronize(); - - // Go down until endstop is hit - const float Z_CALIBRATION_THRESHOLD = 1.f; - if (! find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f)) { - kill_message = MSG_BED_LEVELING_FAILED_POINT_LOW; - break; - } - if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { - kill_message = MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED; - break; - } - if (has_z && fabs(z0 - current_position[Z_AXIS]) > Z_CALIBRATION_THRESHOLD) { - kill_message = MSG_BED_LEVELING_FAILED_POINT_HIGH; - break; - } + mbl.reset(); //reset mesh bed leveling - mbl.set_z(ix, iy, current_position[Z_AXIS]); + // Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be + // consumed during the first movements following this statement. + babystep_undo(); - custom_message_state--; - mesh_point++; - lcd_update(1); - } - current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS],current_position[Z_AXIS] , current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); - st_synchronize(); - if (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) { - kill(kill_message); - } - clean_up_after_endstop_move(); + // Cycle through all points and probe them + // First move up. During this first movement, the babystepping will be reverted. + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 60, active_extruder); + // The move to the first calibration point. + current_position[X_AXIS] = pgm_read_float(bed_ref_points); + current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 1); + bool clamped = world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); + + if (verbosity_level >= 1) { + clamped ? SERIAL_PROTOCOLPGM("First calibration point clamped.\n") : SERIAL_PROTOCOLPGM("No clamping for first calibration point.\n"); + } + // mbl.get_meas_xy(0, 0, current_position[X_AXIS], current_position[Y_AXIS], false); + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS] / 30, active_extruder); + // Wait until the move is finished. + st_synchronize(); + + int mesh_point = 0; //index number of calibration point + + int ix = 0; + int iy = 0; + + int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS] / 20; + int Z_PROBE_FEEDRATE = homing_feedrate[Z_AXIS] / 60; + int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40; + bool has_z = is_bed_z_jitter_data_valid(); //checks if we have data from Z calibration (offsets of the Z heiths of the 8 calibration points from the first point) + if (verbosity_level >= 1) { + has_z ? SERIAL_PROTOCOLPGM("Z jitter data from Z cal. valid.\n") : SERIAL_PROTOCOLPGM("Z jitter data from Z cal. not valid.\n"); + } + setup_for_endstop_move(false); //save feedrate and feedmultiply, sets feedmultiply to 100 + const char *kill_message = NULL; + while (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) { + if (verbosity_level >= 1) SERIAL_ECHOLNPGM(""); + // Get coords of a measuring point. + ix = mesh_point % MESH_MEAS_NUM_X_POINTS; // from 0 to MESH_NUM_X_POINTS - 1 + iy = mesh_point / MESH_MEAS_NUM_X_POINTS; + if (iy & 1) ix = (MESH_MEAS_NUM_X_POINTS - 1) - ix; // Zig zag + float z0 = 0.f; + if (has_z && mesh_point > 0) { + uint16_t z_offset_u = eeprom_read_word((uint16_t*)(EEPROM_BED_CALIBRATION_Z_JITTER + 2 * (ix + iy * 3 - 1))); + z0 = mbl.z_values[0][0] + *reinterpret_cast(&z_offset_u) * 0.01; + //#if 0 + if (verbosity_level >= 1) { + SERIAL_ECHOPGM("Bed leveling, point: "); + MYSERIAL.print(mesh_point); + SERIAL_ECHOPGM(", calibration z: "); + MYSERIAL.print(z0, 5); + SERIAL_ECHOLNPGM(""); + } + //#endif + } + + // Move Z up to MESH_HOME_Z_SEARCH. + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); + st_synchronize(); + + // Move to XY position of the sensor point. + current_position[X_AXIS] = pgm_read_float(bed_ref_points + 2 * mesh_point); + current_position[Y_AXIS] = pgm_read_float(bed_ref_points + 2 * mesh_point + 1); - temp_compensation_apply(); //apply PINDA temperature compensation - // Apply Z height correction aka baby stepping before mesh bed leveing gets activated. - babystep_apply(); + world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); + if (verbosity_level >= 1) { - bool eeprom_bed_correction_valid = eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1; - for (uint8_t i = 0; i < 4; ++ i) { - unsigned char codes[4] = { 'L', 'R', 'F', 'B' }; - long correction = 0; - if (code_seen(codes[i])) - correction = code_value_long(); - else if (eeprom_bed_correction_valid) { - unsigned char *addr = (i < 2) ? - ((i == 0) ? (unsigned char*)EEPROM_BED_CORRECTION_LEFT : (unsigned char*)EEPROM_BED_CORRECTION_RIGHT) : - ((i == 2) ? (unsigned char*)EEPROM_BED_CORRECTION_FRONT : (unsigned char*)EEPROM_BED_CORRECTION_REAR); - correction = eeprom_read_int8(addr); - } - if (correction == 0) - continue; - float offset = float(correction) * 0.001f; - if (fabs(offset) > 0.101f) { - SERIAL_ERROR_START; - SERIAL_ECHOPGM("Excessive bed leveling correction: "); - SERIAL_ECHO(offset); - SERIAL_ECHOLNPGM(" microns"); - } else { - switch (i) { - case 0: - for (uint8_t row = 0; row < 3; ++ row) { - mbl.z_values[row][1] += 0.5f * offset; - mbl.z_values[row][0] += offset; - } - break; - case 1: - for (uint8_t row = 0; row < 3; ++ row) { - mbl.z_values[row][1] += 0.5f * offset; - mbl.z_values[row][2] += offset; - } - break; - case 2: - for (uint8_t col = 0; col < 3; ++ col) { - mbl.z_values[1][col] += 0.5f * offset; - mbl.z_values[0][col] += offset; - } - break; - case 3: - for (uint8_t col = 0; col < 3; ++ col) { - mbl.z_values[1][col] += 0.5f * offset; - mbl.z_values[2][col] += offset; - } - break; - } - } - } + SERIAL_PROTOCOL(mesh_point); + clamped ? SERIAL_PROTOCOLPGM(": xy clamped.\n") : SERIAL_PROTOCOLPGM(": no xy clamping\n"); + } - mbl.upsample_3x3(); - mbl.active = 1; - go_home_with_z_lift(); - // Restore custom message state - custom_message = custom_message_old; - custom_message_type = custom_message_type_old; - custom_message_state = custom_message_state_old; - lcd_update(1); - } - break; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], XY_AXIS_FEEDRATE, active_extruder); + st_synchronize(); + + // Go down until endstop is hit + const float Z_CALIBRATION_THRESHOLD = 1.f; + if (!find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f)) { //if we have data from z calibration max allowed difference is 1mm for each point, if we dont have data max difference is 10mm from initial point + kill_message = MSG_BED_LEVELING_FAILED_POINT_LOW; + break; + } + if (MESH_HOME_Z_SEARCH - current_position[Z_AXIS] < 0.1f) { + kill_message = MSG_BED_LEVELING_FAILED_PROBE_DISCONNECTED; + break; + } + if (has_z && fabs(z0 - current_position[Z_AXIS]) > Z_CALIBRATION_THRESHOLD) { //if we have data from z calibration, max. allowed difference is 1mm for each point + kill_message = MSG_BED_LEVELING_FAILED_POINT_HIGH; + break; + } + + if (verbosity_level >= 10) { + SERIAL_ECHOPGM("X: "); + MYSERIAL.print(current_position[X_AXIS], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("Y: "); + MYSERIAL.print(current_position[Y_AXIS], 5); + SERIAL_PROTOCOLPGM("\n"); + } + + if (verbosity_level >= 1) { + SERIAL_ECHOPGM("mesh bed leveling: "); + MYSERIAL.print(current_position[Z_AXIS], 5); + SERIAL_ECHOLNPGM(""); + } + mbl.set_z(ix, iy, current_position[Z_AXIS]); //store measured z values z_values[iy][ix] = z; + + custom_message_state--; + mesh_point++; + lcd_update(1); + } + if (verbosity_level >= 20) SERIAL_ECHOLNPGM("Mesh bed leveling while loop finished."); + current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; + if (verbosity_level >= 20) { + SERIAL_ECHOLNPGM("MESH_HOME_Z_SEARCH: "); + MYSERIAL.print(current_position[Z_AXIS], 5); + } + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], Z_LIFT_FEEDRATE, active_extruder); + st_synchronize(); + if (mesh_point != MESH_MEAS_NUM_X_POINTS * MESH_MEAS_NUM_Y_POINTS) { + kill(kill_message); + SERIAL_ECHOLNPGM("killed"); + } + clean_up_after_endstop_move(); + SERIAL_ECHOLNPGM("clean up finished "); + temp_compensation_apply(); //apply PINDA temperature compensation + babystep_apply(); // Apply Z height correction aka baby stepping before mesh bed leveing gets activated. + SERIAL_ECHOLNPGM("babystep applied"); + bool eeprom_bed_correction_valid = eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1; + + if (verbosity_level >= 1) { + eeprom_bed_correction_valid ? SERIAL_PROTOCOLPGM("Bed correction data valid\n") : SERIAL_PROTOCOLPGM("Bed correction data not valid\n"); + } + + for (uint8_t i = 0; i < 4; ++i) { + unsigned char codes[4] = { 'L', 'R', 'F', 'B' }; + long correction = 0; + if (code_seen(codes[i])) + correction = code_value_long(); + else if (eeprom_bed_correction_valid) { + unsigned char *addr = (i < 2) ? + ((i == 0) ? (unsigned char*)EEPROM_BED_CORRECTION_LEFT : (unsigned char*)EEPROM_BED_CORRECTION_RIGHT) : + ((i == 2) ? (unsigned char*)EEPROM_BED_CORRECTION_FRONT : (unsigned char*)EEPROM_BED_CORRECTION_REAR); + correction = eeprom_read_int8(addr); + } + if (correction == 0) + continue; + float offset = float(correction) * 0.001f; + if (fabs(offset) > 0.101f) { + SERIAL_ERROR_START; + SERIAL_ECHOPGM("Excessive bed leveling correction: "); + SERIAL_ECHO(offset); + SERIAL_ECHOLNPGM(" microns"); + } + else { + switch (i) { + case 0: + for (uint8_t row = 0; row < 3; ++row) { + mbl.z_values[row][1] += 0.5f * offset; + mbl.z_values[row][0] += offset; + } + break; + case 1: + for (uint8_t row = 0; row < 3; ++row) { + mbl.z_values[row][1] += 0.5f * offset; + mbl.z_values[row][2] += offset; + } + break; + case 2: + for (uint8_t col = 0; col < 3; ++col) { + mbl.z_values[1][col] += 0.5f * offset; + mbl.z_values[0][col] += offset; + } + break; + case 3: + for (uint8_t col = 0; col < 3; ++col) { + mbl.z_values[1][col] += 0.5f * offset; + mbl.z_values[2][col] += offset; + } + break; + } + } + } + SERIAL_ECHOLNPGM("Bed leveling correction finished"); + mbl.upsample_3x3(); //bilinear interpolation from 3x3 to 7x7 points while using the same array z_values[iy][ix] for storing (just coppying measured data to new destination and interpolating between them) + SERIAL_ECHOLNPGM("Upsample finished"); + mbl.active = 1; //activate mesh bed leveling + SERIAL_ECHOLNPGM("Mesh bed leveling activated"); + go_home_with_z_lift(); + SERIAL_ECHOLNPGM("Go home finished"); + // Restore custom message state + custom_message = custom_message_old; + custom_message_type = custom_message_type_old; + custom_message_state = custom_message_state_old; + lcd_update(1); + } + break; /** * G81: Print mesh bed leveling status and bed profile if activated @@ -6166,14 +6236,14 @@ void temp_compensation_apply() { int z_shift = 0; float z_shift_mm; - if (target_temperature_bed % 10 == 0 && target_temperature_bed >= 60 && target_temperature_bed <= 100) { + if (target_temperature_bed % 10 == 0 && target_temperature_bed >= 50 && target_temperature_bed <= 100) { i_add = (target_temperature_bed - 60) / 10; EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i_add * 2, &z_shift); z_shift_mm = z_shift / axis_steps_per_unit[Z_AXIS]; } else { //interpolation - //z_shift_mm = temp_comp_interpolation(target_temperature_bed) / axis_steps_per_unit[Z_AXIS]; + z_shift_mm = temp_comp_interpolation(target_temperature_bed) / axis_steps_per_unit[Z_AXIS]; } SERIAL_PROTOCOLPGM("\n"); SERIAL_PROTOCOLPGM("Z shift applied:"); @@ -6183,6 +6253,12 @@ void temp_compensation_apply() { plan_set_z_position(current_position[Z_AXIS]); } +/*float temp_comp_interpolation(float temperature) { + +}*/ + + + float temp_comp_interpolation(float temperature) { //cubic spline interpolation @@ -6196,19 +6272,24 @@ float temp_comp_interpolation(float temperature) { int n, j, k; float h[10], a, b, c, d, sum, s[10] = { 0 }, x[10], F[10], f[10], p, m[10][10] = { 0 }, temp; - - for (i = 0; i < 6; i++) { + /*SERIAL_ECHOLNPGM("Reading shift data:"); + MYSERIAL.print(shift[i]);*/ + for (i = 0; i < 5; i++) { EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &shift[i + 1]); //read shift in steps from EEPROM + + //SERIAL_ECHOLNPGM(" "); + //MYSERIAL.print(shift[i + 1]); temp_C[i] = 50 + i * 10; //temperature in C shift_f[i] = (float)shift[i]; } + for (i = 5; i > 0; i--) { F[i] = (shift_f[i] - shift_f[i - 1]) / (temp_C[i] - temp_C[i - 1]); h[i - 1] = temp_C[i] - temp_C[i - 1]; } - //*********** formation of h, s , f matrix **************// + //*********** formation of h, s , f matrix ************* for (i = 1; i<5; i++) { m[i][i] = 2 * (h[i - 1] + h[i]); if (i != 1) { @@ -6217,13 +6298,13 @@ float temp_comp_interpolation(float temperature) { } m[i][5] = 6 * (F[i + 1] - F[i]); } - //*********** forward elimination **************// + //*********** forward elimination ************** for (i = 1; i<4; i++) { temp = (m[i + 1][i] / m[i][i]); for (j = 1; j <= 5; j++) m[i + 1][j] -= temp*m[i][j]; } - //*********** backward substitution *********// + //*********** backward substitution ********* for (i = 4; i>0; i--) { sum = 0; for (j = i; j <= 4; j++) From 822fbc00cb986fcccda9106e04983ef5c3ceda70 Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Sat, 4 Mar 2017 18:35:49 -0700 Subject: [PATCH 14/49] Fixing conficts due to recent changes involving "Farm Mode". --- Firmware/ultralcd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 63d0ac71f..0982a958f 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -97,8 +97,8 @@ int8_t SilentModeMenu = 0; int lcd_commands_type=LCD_COMMAND_IDLE; int lcd_commands_step=0; bool isPrintPaused = false; -int oldFanSpeed = 0; -bool farm_mode = false; +uint8_t oldFanSpeed = 0; +uint8_t farm_mode = 0; int farm_no = 0; int farm_timer = 30; int farm_status = 0; From f7a18d3a4ed8efe9c7372e1e8b213d6666d5709f Mon Sep 17 00:00:00 2001 From: Aaron Yourk Date: Sun, 5 Mar 2017 17:47:51 -0700 Subject: [PATCH 15/49] Attempt #2 at resolving conflicts with upstream for pull request. --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0982a958f..b75e09ebe 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -94,10 +94,10 @@ int8_t SDscrool = 0; int8_t SilentModeMenu = 0; +uint8_t oldFanSpeed = 0; int lcd_commands_type=LCD_COMMAND_IDLE; int lcd_commands_step=0; bool isPrintPaused = false; -uint8_t oldFanSpeed = 0; uint8_t farm_mode = 0; int farm_no = 0; int farm_timer = 30; From 7b4c79b4d04d29af4cd3293f86151c50249dc6cb Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 6 Mar 2017 11:19:21 +0100 Subject: [PATCH 16/49] Storing status for pinda probe calibration --- Firmware/Configuration.h | 19 ++-- Firmware/Marlin_main.cpp | 144 +++++++++++++----------------- Firmware/language_all.cpp | 10 +++ Firmware/language_all.h | 4 + Firmware/language_en.h | 3 + Firmware/mesh_bed_calibration.cpp | 2 +- Firmware/ultralcd.cpp | 7 ++ Firmware/ultralcd.h | 2 + 8 files changed, 99 insertions(+), 92 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index a0870ec60..4ff6d959d 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -700,17 +700,20 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // (unsigned char*)EEPROM_CALIBRATION_STATUS enum CalibrationStatus { - // Freshly assembled, needs to peform a self-test and the XYZ calibration. - CALIBRATION_STATUS_ASSEMBLED = 255, + // Freshly assembled, needs to peform a self-test and the XYZ calibration. + CALIBRATION_STATUS_ASSEMBLED = 255, - // For the wizard: self test has been performed, now the XYZ calibration is needed. - // CALIBRATION_STATUS_XYZ_CALIBRATION = 250, + // For the wizard: self test has been performed, now the XYZ calibration is needed. + // CALIBRATION_STATUS_XYZ_CALIBRATION = 250, - // For the wizard: factory assembled, needs to run Z calibration. - CALIBRATION_STATUS_Z_CALIBRATION = 240, + // For the wizard: factory assembled, needs to run Z calibration. + CALIBRATION_STATUS_Z_CALIBRATION = 240, - // The XYZ calibration has been performed, now it remains to run the V2Calibration.gcode. - CALIBRATION_STATUS_LIVE_ADJUST = 230, + // The XYZ calibration has been performed, now it remains to run the V2Calibration.gcode. + CALIBRATION_STATUS_LIVE_ADJUST = 230, + + //V2 calibration has been run, now run PINDA probe temperature calibration + CALIBRATION_STATUS_PINDA = 220, // Calibrated, ready to print. CALIBRATION_STATUS_CALIBRATED = 1, diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b606a0697..c85d6683d 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1162,6 +1162,9 @@ void setup() // Show the message. lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET); lcd_update_enable(true); + } else if (calibration_status() == CALIBRATION_STATUS_PINDA) { + lcd_show_fullscreen_message_and_wait_P(MSG_PINDA_NOT_CALIBRATED); + lcd_update_enable(true); } else if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION) { // Show the message. lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW); @@ -2760,26 +2763,7 @@ void process_commands() * */ - case 73: - { - int i, read; - for (i = 0; i < 5; i++) { - EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &read); - MYSERIAL.print(read); - SERIAL_ECHOLNPGM(" "); - } - }break; - - case 74: - { - float result, temp; - if (code_seen('X')) temp = code_value(); - result = temp_comp_interpolation(temp); - MYSERIAL.print(result); - - }break; - - case 76: //PINDA probe temperature compensation + case 76: //PINDA probe temperature calibration { setTargetBed(PINDA_MIN_T); float zero_z; @@ -2854,17 +2838,12 @@ void process_commands() } + calibration_status_store(CALIBRATION_STATUS_CALIBRATED); setTargetBed(0); //set bed target temperature back to 0 } break; - case 75: - { - temp_compensation_start(); - } - break; - #ifdef DIS case 77: { @@ -2914,6 +2893,7 @@ void process_commands() enquecommand_front_P((PSTR("G28 W0"))); break; } + temp_compensation_start(); // Save custom message state, set a new custom message state to display: Calibrating point 9. bool custom_message_old = custom_message; @@ -3220,7 +3200,7 @@ void process_commands() * This G-code will be performed at the end of a calibration script. */ case 87: - calibration_status_store(CALIBRATION_STATUS_CALIBRATED); + calibration_status_store(CALIBRATION_STATUS_PINDA); break; /** @@ -6215,6 +6195,7 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ card.closefile(); } +#endif void temp_compensation_start() { current_position[X_AXIS] = PINDA_PREHEAT_X; @@ -6236,92 +6217,89 @@ void temp_compensation_apply() { int z_shift = 0; float z_shift_mm; - if (target_temperature_bed % 10 == 0 && target_temperature_bed >= 50 && target_temperature_bed <= 100) { - i_add = (target_temperature_bed - 60) / 10; - EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i_add * 2, &z_shift); - z_shift_mm = z_shift / axis_steps_per_unit[Z_AXIS]; + if (calibration_status() == CALIBRATION_STATUS_CALIBRATED) { + if (target_temperature_bed % 10 == 0 && target_temperature_bed >= 50 && target_temperature_bed <= 100) { + i_add = (target_temperature_bed - 60) / 10; + EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i_add * 2, &z_shift); + z_shift_mm = z_shift / axis_steps_per_unit[Z_AXIS]; + } + else { + //interpolation + z_shift_mm = temp_comp_interpolation(target_temperature_bed) / axis_steps_per_unit[Z_AXIS]; + } + SERIAL_PROTOCOLPGM("\n"); + SERIAL_PROTOCOLPGM("Z shift applied:"); + MYSERIAL.print(z_shift_mm); + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] - z_shift_mm, current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder); + st_synchronize(); + plan_set_z_position(current_position[Z_AXIS]); } else { - //interpolation - z_shift_mm = temp_comp_interpolation(target_temperature_bed) / axis_steps_per_unit[Z_AXIS]; + //message that we have no temp compensation data } - SERIAL_PROTOCOLPGM("\n"); - SERIAL_PROTOCOLPGM("Z shift applied:"); - MYSERIAL.print(z_shift_mm); - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] - z_shift_mm, current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder); - st_synchronize(); - plan_set_z_position(current_position[Z_AXIS]); } -/*float temp_comp_interpolation(float temperature) { - -}*/ +float temp_comp_interpolation(float inp_temperature) { - - -float temp_comp_interpolation(float temperature) { //cubic spline interpolation - - int i; - int shift[6]; - float shift_f[6]; - float temp_C[6]; - - shift[0] = 0; //shift for 50 C is 0 - int n, j, k; + int n, i, j, k; float h[10], a, b, c, d, sum, s[10] = { 0 }, x[10], F[10], f[10], p, m[10][10] = { 0 }, temp; + int shift[10]; + int temp_C[10]; - /*SERIAL_ECHOLNPGM("Reading shift data:"); - MYSERIAL.print(shift[i]);*/ - for (i = 0; i < 5; i++) { - EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &shift[i + 1]); //read shift in steps from EEPROM + p = inp_temperature; + n = 6; //number of measured points - //SERIAL_ECHOLNPGM(" "); - //MYSERIAL.print(shift[i + 1]); + shift[0] = 0; + for (i = 0; i < n; i++) { + //scanf_s("%f%f", &x[i], &f[i]); + if (i>0) EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + (i-1) * 2, &shift[i]); //read shift in steps from EEPROM temp_C[i] = 50 + i * 10; //temperature in C - shift_f[i] = (float)shift[i]; - + + x[i] = (float)temp_C[i]; + f[i] = (float)shift[i]; } - for (i = 5; i > 0; i--) { - F[i] = (shift_f[i] - shift_f[i - 1]) / (temp_C[i] - temp_C[i - 1]); - h[i - 1] = temp_C[i] - temp_C[i - 1]; - } - //*********** formation of h, s , f matrix ************* - for (i = 1; i<5; i++) { + + for (i = n - 1; i>0; i--) { + F[i] = (f[i] - f[i - 1]) / (x[i] - x[i - 1]); + h[i - 1] = x[i] - x[i - 1]; + } + //*********** formation of h, s , f matrix ************** + for (i = 1; i0; i--) { + for (i = n - 2; i>0; i--) { sum = 0; - for (j = i; j <= 4; j++) + for (j = i; j <= n - 2; j++) sum += m[i][j] * s[j]; s[i] = (m[i][n - 1] - sum) / m[i][i]; } - for (i = 0; i<5; i++) - if (temp_C[i] <= temperature&&temperature <= temp_C[i + 1]) { - a = (s[i + 1] - s[i]) / (6 * h[i]); - b = s[i] / 2; - c = (shift[i + 1] - shift[i]) / h[i] - (2 * h[i] * s[i] + s[i + 1] * h[i]) / 6; - d = shift[i]; - sum = a*pow((p - temp_C[i]), 3) + b*pow((p - temp_C[i]), 2) + c*(p - temp_C[i]) + d; - } - return(sum); + for (i = 0; i Date: Mon, 6 Mar 2017 12:14:08 +0100 Subject: [PATCH 17/49] G80 - pinda heating and autohome added --- Firmware/Marlin_main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c85d6683d..8a944aa77 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2879,6 +2879,8 @@ void process_commands() case_G80: { int8_t verbosity_level = 0; + static bool run = false; + if (code_seen('V')) { // Just 'V' without a number counts as V1. char c = strchr_pointer[1]; @@ -2893,7 +2895,15 @@ void process_commands() enquecommand_front_P((PSTR("G28 W0"))); break; } - temp_compensation_start(); + + if (run == false) { + temp_compensation_start(); + run = true; + repeatcommand_front(); // repeat G80 with all its parameters + enquecommand_front_P((PSTR("G28 W0"))); + break; + } + run = false; // Save custom message state, set a new custom message state to display: Calibrating point 9. bool custom_message_old = custom_message; From 4eb45fadedc70913f850605390a1411b60492698 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 6 Mar 2017 16:24:23 +0100 Subject: [PATCH 18/49] changed version, pinda probe calibration menu --- Firmware/Configuration.h | 2 +- Firmware/ultralcd.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 4ff6d959d..7d99543dc 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -5,7 +5,7 @@ #include "Configuration_prusa.h" // Firmware version -#define FW_version "3.0.11" +#define FW_version "3.0.11-alpha" #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10 diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c4839100d..16f4813fe 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2230,7 +2230,7 @@ void lcd_mesh_calibration_z() void lcd_pinda_calibration() { - enquecommand_P(PSTR("M76")); + enquecommand_P(PSTR("G76")); lcd_return_to_status(); } From af962b74733991cdf9582cbc1be16b70eedc4735 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 15 Mar 2017 15:56:42 +0100 Subject: [PATCH 19/49] none --- Firmware/ConfigurationStore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index 7c900bd45..c67e35359 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -119,7 +119,7 @@ void Config_StoreSettings() EEPROM_WRITE_VAR(i, filament_size[2]); #endif #endif - + /*MYSERIAL.print("Top address used:\n"); MYSERIAL.print(i); MYSERIAL.print("\n"); From 31c7469b79f1f2debaa4a1133d679a04463b74a4 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 17 Mar 2017 10:26:15 +0100 Subject: [PATCH 20/49] long press init --- Firmware/Marlin_main.cpp | 25 +++++++++++----------- Firmware/ultralcd.cpp | 46 +++++++++++++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 18 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2ce62193c..6cd61afe8 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2765,19 +2765,6 @@ void process_commands() } break; - /** - * G80: Mesh-based Z probe, probes a grid and produces a - * mesh to compensate for variable bed height - * - * The S0 report the points as below - * - * +----> X-axis - * | - * | - * v Y-axis - * - */ - #ifdef DIS case 77: { @@ -2808,6 +2795,18 @@ void process_commands() #endif + /** + * G80: Mesh-based Z probe, probes a grid and produces a + * mesh to compensate for variable bed height + * + * The S0 report the points as below + * + * +----> X-axis + * | + * | + * v Y-axis + * + */ case 80: case_G80: { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 42a069022..70dfc5b86 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -106,6 +106,8 @@ int farm_status = 0; unsigned long allert_timer = millis(); bool printer_connected = true; +bool long_press = false; +long long_press_timer = millis(); bool menuExiting = false; @@ -4413,11 +4415,12 @@ void lcd_update_enable(bool enabled) void lcd_update(uint8_t lcdDrawUpdateOverride) { - if (lcdDrawUpdate < lcdDrawUpdateOverride) - lcdDrawUpdate = lcdDrawUpdateOverride; - if (! lcd_update_enabled) - return; + if (lcdDrawUpdate < lcdDrawUpdateOverride) + lcdDrawUpdate = lcdDrawUpdateOverride; + + if (!lcd_update_enabled) + return; #ifdef LCD_HAS_SLOW_BUTTONS slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context @@ -4484,8 +4487,41 @@ void lcd_update(uint8_t lcdDrawUpdateOverride) encoderDiff = 0; lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; } - if (LCD_CLICKED) + + if (LCD_CLICKED) { lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + }/* + for (int i = 0; i < 500; i++) { + //lcd_buttons_update(); + if (!LCD_CLICKED) i = 1000; + else delay(50); + + + // if (i >= 500) lcd_goto_menu(lcd_calibration_menu); + } + + } + */ + /*if(LCD_CLICKED){ + SERIAL_ECHOLNPGM("ok"); + lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; + if (long_press == false) { + long_press = true; + long_press_timer = millis(); + SERIAL_ECHOLNPGM("Su zde!"); + } + else { + if ((millis() - long_press_timer) > LONG_PRESS_TIME) { + SERIAL_ECHOLNPGM("Su tady!"); + lcd_goto_menu(lcd_settings_menu); + long_press = false; + } + } + } + else { + long_press = false; + SERIAL_ECHOLNPGM("Jaj!"); + }*/ #endif//ULTIPANEL #ifdef DOGLCD // Changes due to different driver architecture of the DOGM display From fb8ba9c151f1a69394d068d3d0fcf6d58dcc3ae1 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 20 Mar 2017 10:34:37 +0100 Subject: [PATCH 21/49] interrupt dont use, another iteration --- Firmware/Marlin_main.cpp | 1 + Firmware/temperature.cpp | 10 ++-- Firmware/ultralcd.cpp | 126 ++++++++++++++++++++++++++------------- Firmware/ultralcd.h | 1 + 4 files changed, 93 insertions(+), 45 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6cd61afe8..0adb8a888 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3123,6 +3123,7 @@ void process_commands() farm_mode = 0; lcd_printer_connected(); eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode); + lcd_update(2); break; diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index d2f6e3f88..851d1bfba 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1705,7 +1705,7 @@ ISR(TIMER0_COMPB_vect) ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07)); ADCSRA |= 1< 0) @@ -4488,40 +4521,7 @@ void lcd_update(uint8_t lcdDrawUpdateOverride) lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; } - if (LCD_CLICKED) { - lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; - }/* - for (int i = 0; i < 500; i++) { - //lcd_buttons_update(); - if (!LCD_CLICKED) i = 1000; - else delay(50); - - - // if (i >= 500) lcd_goto_menu(lcd_calibration_menu); - } - - } - */ - /*if(LCD_CLICKED){ - SERIAL_ECHOLNPGM("ok"); - lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; - if (long_press == false) { - long_press = true; - long_press_timer = millis(); - SERIAL_ECHOLNPGM("Su zde!"); - } - else { - if ((millis() - long_press_timer) > LONG_PRESS_TIME) { - SERIAL_ECHOLNPGM("Su tady!"); - lcd_goto_menu(lcd_settings_menu); - long_press = false; - } - } - } - else { - long_press = false; - SERIAL_ECHOLNPGM("Jaj!"); - }*/ + /*if (LCD_CLICKED)*/ lcd_timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; #endif//ULTIPANEL #ifdef DOGLCD // Changes due to different driver architecture of the DOGM display @@ -4656,9 +4656,55 @@ void lcd_buttons_update() if (READ(BTN_EN1) == 0) newbutton |= EN_A; if (READ(BTN_EN2) == 0) newbutton |= EN_B; #if BTN_ENC > 0 - if ((blocking_enc < millis()) && (READ(BTN_ENC) == 0)) - newbutton |= EN_C; -#endif + /* if (READ(BTN_ENC) == 0) { //button pressed + if (button_pressed == false) { + button_pressed = true; + long_press_delay = millis(); + } + if (((millis() - long_press_delay) > 2000) && long_press_active == false) { + long_press_active = true; + lcd_goto_menu(lcd_move_z); + } + } + else { //button not pressed + if (button_pressed) { + button_pressed = false; + if (long_press_active) + { + long_press_active = false; + } + else { + newbutton |= EN_C; + } + } + + }*/ + if (READ(BTN_ENC) == 0) { + if (button_pressed == false) { + long_press_delay = millis(); + //long_press_count = 0; + //if (blocking_enc < millis()) + button_pressed = true; + } + if (((millis() - long_press_delay) > 2000) && long_press_active == false) { + + // blocking_enc = millis() + 500; + long_press_active = true; + //lcd_ignore_click(true); + lcd_goto_menu(lcd_move_z); + } + + } + else if(button_pressed){ + if (long_press_active == false) { + newbutton |= EN_C; + } + /*else { + long_press_active = false; + }*/ + } + +#endif buttons = newbutton; #ifdef LCD_HAS_SLOW_BUTTONS buttons |= slow_buttons; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 76136ff8f..8a796687e 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -230,6 +230,7 @@ void lcd_farm_sdcard_menu_w(); void lcd_wait_for_cool_down(); void adjust_bed_reset(); void lcd_extr_cal_reset(); +//static void _lcd_move(const char *name, int axis, int min, int max, bool called_from_move_menu = true); union MenuData; From 0dc93b91bc79878a6759b4abbedd968a490493b3 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 20 Mar 2017 11:50:30 +0100 Subject: [PATCH 22/49] lcd_buttons_update in interrupt --- Firmware/temperature.cpp | 10 +++++----- Firmware/ultralcd.cpp | 22 ++-------------------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 851d1bfba..d2f6e3f88 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1705,7 +1705,7 @@ ISR(TIMER0_COMPB_vect) ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07)); ADCSRA |= 1< Date: Tue, 21 Mar 2017 17:10:04 +0100 Subject: [PATCH 23/49] long press in non-modal mode --- Firmware/ultralcd.cpp | 88 ++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 52 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e2a53e2a5..ac6c03289 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -106,13 +106,9 @@ int farm_status = 0; unsigned long allert_timer = millis(); bool printer_connected = true; -bool long_press = false; + bool long_press_active = false; long long_press_timer = millis(); -long long_press_delay = millis(); -int long_press_count = 0; -bool goto_move_z = false; -bool move_z_flag = false; bool button_pressed = false; bool menuExiting = false; @@ -282,6 +278,7 @@ bool lcd_oldcardstatus; #endif //ULTIPANEL menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */ +menuFunc_t savedMenu; uint32_t lcd_next_update_millis; uint8_t lcd_status_update_delay; bool ignore_click = false; @@ -1231,11 +1228,6 @@ static void _lcd_move(const char *name, int axis, int min, int max) { } if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis])); if (LCD_CLICKED) lcd_goto_menu(lcd_move_menu_axis); { - /*if(!long_press_active) lcd_goto_menu(lcd_move_menu_axis); - else { - long_press_active = false; - lcd_return_to_status(); - }*/ } } @@ -4284,9 +4276,8 @@ static void lcd_quick_feedback() { lcdDrawUpdate = 2; blocking_enc = millis() + 500; - //if (button_pressed && long_press_active) long_press_active = false; - button_pressed = false; + button_pressed = false; lcd_implementation_quick_feedback(); } @@ -4638,54 +4629,47 @@ void lcd_buttons_update() if (READ(BTN_EN1) == 0) newbutton |= EN_A; if (READ(BTN_EN2) == 0) newbutton |= EN_B; #if BTN_ENC > 0 - /* if (READ(BTN_ENC) == 0) { //button pressed - if (button_pressed == false) { - button_pressed = true; - long_press_delay = millis(); - } - if (((millis() - long_press_delay) > 2000) && long_press_active == false) { - long_press_active = true; - lcd_goto_menu(lcd_move_z); - } - } - else { //button not pressed - if (button_pressed) { - button_pressed = false; - if (long_press_active) - { - long_press_active = false; + if (lcd_update_enabled == true) { //if we are in non-modal mode, long press can be used and short press triggers with button release + if (READ(BTN_ENC) == 0) { //button is pressed + + if (button_pressed == false && long_press_active == false) { + long_press_timer = millis(); + button_pressed = true; } else { - newbutton |= EN_C; + if (millis() - long_press_timer > 500) { //long press activated + long_press_active = true; + move_menu_scale = 1.0; + savedMenu = currentMenu; + lcd_goto_menu(lcd_move_z); + } } } - - }*/ - if (READ(BTN_ENC) == 0) { - if (button_pressed == false) { - long_press_delay = millis(); - //long_press_count = 0; - //if (blocking_enc < millis()) - button_pressed = true; + else { //button not pressed + if (button_pressed) { //button was released + if (long_press_active == false) { //button released before long press gets activated + if (currentMenu == lcd_move_z) { + //return to previously active menu + //lcd_goto_menu(savedMenu); + lcd_goto_menu(lcd_main_menu); + lcd_return_to_status(); + } + else { + newbutton |= EN_C; + } + } + //button_pressed is set back to false via lcd_quick_feedback function + } + else { + long_press_active = false; + } } - if (((millis() - long_press_delay) > 2000) && long_press_active == false) { - - // blocking_enc = millis() + 500; - long_press_active = true; - //lcd_ignore_click(true); - lcd_goto_menu(lcd_move_z); - } - } - else if(button_pressed){ - if (long_press_active == false) { + else { //we are in modal mode + if (READ(BTN_ENC) == 0) newbutton |= EN_C; - } - /*else { - long_press_active = false; - }*/ } - + #endif buttons = newbutton; #ifdef LCD_HAS_SLOW_BUTTONS From ed5842d1d15357d22b0a992b6b37541dc9d5bdae Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 22 Mar 2017 18:43:19 +0100 Subject: [PATCH 24/49] Rx buffer overflow behavior improved --- Firmware/Configuration.h | 4 ---- Firmware/Marlin_main.cpp | 34 +++++++++++++++++++++++----------- Firmware/ultralcd.cpp | 4 ++-- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 502c7ec15..5fd68384c 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -722,8 +722,4 @@ enum CalibrationStatus #include "Configuration_adv.h" #include "thermistortables.h" - - - - #endif //__CONFIGURATION_H diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0adb8a888..abc47c2bd 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -429,7 +429,7 @@ static bool cmdbuffer_front_already_processed = false; // Debugging information will be sent to serial line. // #define CMDBUFFER_DEBUG -static int serial_count = 0; +static int serial_count = 0; //index of character read from serial line static boolean comment_mode = false; static char *strchr_pointer; // just a pointer to find chars in the command string like X, Y, Z, E, etc @@ -576,8 +576,8 @@ bool cmdqueue_could_enqueue_front(int len_asked) cmdqueue_pop_front(); cmdbuffer_front_already_processed = true; } - if (bufindr == bufindw && buflen > 0) - // Full buffer. + if (bufindr == bufindw && buflen > 0) + // Full buffer. return false; // Adjust the end of the write buffer based on whether a partial line is in the receive buffer. int endw = (serial_count > 0) ? (bufindw + MAX_CMD_SIZE + 1) : bufindw; @@ -615,9 +615,9 @@ bool cmdqueue_could_enqueue_back(int len_asked) if (len_asked >= MAX_CMD_SIZE) return false; - if (bufindr == bufindw && buflen > 0) - // Full buffer. - return false; + if (bufindr == bufindw && buflen > 0) + // Full buffer. + return false; if (serial_count > 0) { // If there is some data stored starting at bufindw, len_asked is certainly smaller than @@ -1323,10 +1323,16 @@ void loop() void get_command() { // Test and reserve space for the new command string. - if (! cmdqueue_could_enqueue_back(MAX_CMD_SIZE-1)) - return; + if (!cmdqueue_could_enqueue_back(MAX_CMD_SIZE - 1)) + return; + + bool rx_buffer_full = false; //flag that serial rx buffer is full while (MYSERIAL.available() > 0) { + if (MYSERIAL.available() == RX_BUFFER_SIZE - 1) { //compare number of chars buffered in rx buffer with rx buffer size + SERIAL_ECHOLNPGM("Full RX Buffer"); //if buffer was full, there is danger that reading of last gcode will not be completed + rx_buffer_full = true; //sets flag that buffer was full + } char serial_char = MYSERIAL.read(); TimeSent = millis(); TimeNow = millis(); @@ -1476,11 +1482,18 @@ void get_command() } } + //add comment + if (rx_buffer_full == true && serial_count > 0) { //if rx buffer was full and string was not properly terminated + rx_buffer_full = false; + bufindw = bufindw - serial_count; //adjust tail of the buffer to prepare buffer for writing new command + serial_count = 0; + } + #ifdef SDSUPPORT if(!card.sdprinting || serial_count!=0){ // If there is a half filled buffer from serial line, wait until return before // continuing with the serial line. - return; + return; } //'#' stops reading from SD to the buffer prematurely, so procedural macro calls are possible @@ -3878,8 +3891,7 @@ Sigma_Exit: SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0); } #endif - - SERIAL_PROTOCOLLN(""); + SERIAL_PROTOCOLLN(""); return; break; case 109: diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ac6c03289..acbd643bb 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4637,7 +4637,7 @@ void lcd_buttons_update() button_pressed = true; } else { - if (millis() - long_press_timer > 500) { //long press activated + if (millis() - long_press_timer > 1000) { //long press activated long_press_active = true; move_menu_scale = 1.0; savedMenu = currentMenu; @@ -4651,7 +4651,7 @@ void lcd_buttons_update() if (currentMenu == lcd_move_z) { //return to previously active menu //lcd_goto_menu(savedMenu); - lcd_goto_menu(lcd_main_menu); + //lcd_goto_menu(lcd_main_menu); lcd_return_to_status(); } else { From 65a2700b97319250d84ffeb20201162b317e8bfc Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 23 Mar 2017 11:56:48 +0100 Subject: [PATCH 25/49] return to previously active menu after long press --- Firmware/ultralcd.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index acbd643bb..5d062c33e 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -272,6 +272,7 @@ uint8_t currentMenuViewOffset; /* scroll offset in the current menu uint32_t blocking_enc; uint8_t lastEncoderBits; uint32_t encoderPosition; +uint32_t savedEncoderPosition; #if (SDCARDDETECT > 0) bool lcd_oldcardstatus; #endif @@ -4633,14 +4634,18 @@ void lcd_buttons_update() if (READ(BTN_ENC) == 0) { //button is pressed if (button_pressed == false && long_press_active == false) { + if (currentMenu != lcd_move_z) { + savedMenu = currentMenu; + savedEncoderPosition = encoderPosition; + } long_press_timer = millis(); button_pressed = true; } else { - if (millis() - long_press_timer > 1000) { //long press activated + if (millis() - long_press_timer > LONG_PRESS_TIME) { //long press activated + long_press_active = true; move_menu_scale = 1.0; - savedMenu = currentMenu; lcd_goto_menu(lcd_move_z); } } @@ -4649,18 +4654,16 @@ void lcd_buttons_update() if (button_pressed) { //button was released if (long_press_active == false) { //button released before long press gets activated if (currentMenu == lcd_move_z) { - //return to previously active menu - //lcd_goto_menu(savedMenu); - //lcd_goto_menu(lcd_main_menu); - lcd_return_to_status(); + //return to previously active menu and previous encoder position + lcd_goto_menu(savedMenu, savedEncoderPosition); } - else { + else { newbutton |= EN_C; } } //button_pressed is set back to false via lcd_quick_feedback function } - else { + else { long_press_active = false; } } From 7daf6b2efd9726fbbefca02bb0c9ce4f48144e9c Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 23 Mar 2017 14:38:18 +0100 Subject: [PATCH 26/49] dont use blocking encoder for button press, lcd_update(false) added to setup function --- Firmware/Configuration.h | 2 +- Firmware/Marlin_main.cpp | 8 +++----- Firmware/ultralcd.cpp | 8 +++----- Firmware/ultralcd.h | 1 - 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 5fd68384c..d1d0b8ab9 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -5,7 +5,7 @@ #include "Configuration_prusa.h" // Firmware version -#define FW_version "3.0.10-7" +#define FW_version "3.0.10-8" #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index abc47c2bd..dc00e4b72 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1028,7 +1028,7 @@ void setup() 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 @@ -1041,7 +1041,7 @@ void setup() // 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)) { @@ -1166,16 +1166,14 @@ void setup() eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0); // Show the message. lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW); - lcd_update_enable(true); } else if (calibration_status() == CALIBRATION_STATUS_LIVE_ADJUST) { // Show the message. lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET); - lcd_update_enable(true); } else if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION) { // Show the message. lcd_show_fullscreen_message_and_wait_P(MSG_FOLLOW_CALIBRATION_FLOW); - lcd_update_enable(true); } + lcd_update_enable(true); // Store the currently running firmware into an eeprom, // so the next time the firmware gets updated, it will know from which version it has been updated. diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5d062c33e..aa22fe265 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -269,7 +269,6 @@ volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad volatile uint8_t slow_buttons;//Contains the bits of the currently pressed buttons. #endif uint8_t currentMenuViewOffset; /* scroll offset in the current menu */ -uint32_t blocking_enc; uint8_t lastEncoderBits; uint32_t encoderPosition; uint32_t savedEncoderPosition; @@ -4276,8 +4275,6 @@ static void lcd_selftest_screen_step(int _row, int _col, int _state, const char static void lcd_quick_feedback() { lcdDrawUpdate = 2; - blocking_enc = millis() + 500; - button_pressed = false; lcd_implementation_quick_feedback(); } @@ -4329,6 +4326,7 @@ static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, #endif//ULTIPANEL /** LCD API **/ + void lcd_init() { lcd_implementation_init(); @@ -4657,7 +4655,7 @@ void lcd_buttons_update() //return to previously active menu and previous encoder position lcd_goto_menu(savedMenu, savedEncoderPosition); } - else { + else { newbutton |= EN_C; } } @@ -4670,7 +4668,7 @@ void lcd_buttons_update() } else { //we are in modal mode if (READ(BTN_ENC) == 0) - newbutton |= EN_C; + newbutton |= EN_C; } #endif diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 8a796687e..76136ff8f 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -230,7 +230,6 @@ void lcd_farm_sdcard_menu_w(); void lcd_wait_for_cool_down(); void adjust_bed_reset(); void lcd_extr_cal_reset(); -//static void _lcd_move(const char *name, int axis, int min, int max, bool called_from_move_menu = true); union MenuData; From 64f4181451f89da0a8c0aacebd1524d88acca840 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 28 Mar 2017 17:29:10 +0200 Subject: [PATCH 27/49] initial version of long pause --- Firmware/Marlin.h | 6 +- Firmware/Marlin_main.cpp | 571 +++++++++++++++++++++++++++++++++++---- Firmware/ultralcd.cpp | 36 ++- Firmware/ultralcd.h | 2 + 4 files changed, 556 insertions(+), 59 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index ed981cad6..2617434c2 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -322,10 +322,14 @@ extern void delay_keep_alive(int ms); extern void check_babystep(); +extern void long_pause(); + #ifdef DIS void d_setup(); float d_ReadData(); void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_points_num, float shift_x, float shift_y); -#endif \ No newline at end of file +#endif + +void wait_for_heater(long codenum); \ No newline at end of file diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index dc00e4b72..90df120e1 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -263,6 +263,9 @@ unsigned int usb_printing_counter; int lcd_change_fil_state = 0; int feedmultiplyBckp = 100; +float HotendTempBckp = 0; +int fanSpeedBckp = 0; + unsigned char lang_selected = 0; int8_t FarmMode = 0; @@ -3929,55 +3932,8 @@ Sigma_Exit: cancel_heatup = false; - #ifdef TEMP_RESIDENCY_TIME - long residencyStart; - residencyStart = -1; - /* continue to loop until we have reached the target temp - _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */ - while((!cancel_heatup)&&((residencyStart == -1) || - (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL)))) ) { - #else - while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) { - #endif //TEMP_RESIDENCY_TIME - if( (millis() - codenum) > 1000UL ) - { //Print Temp Reading and remaining time every 1 second while heating up/cooling down - if (!farm_mode) { - SERIAL_PROTOCOLPGM("T:"); - SERIAL_PROTOCOL_F(degHotend(tmp_extruder), 1); - SERIAL_PROTOCOLPGM(" E:"); - SERIAL_PROTOCOL((int)tmp_extruder); + wait_for_heater(codenum); //loops until target temperature is reached - #ifdef TEMP_RESIDENCY_TIME - SERIAL_PROTOCOLPGM(" W:"); - if (residencyStart > -1) - { - codenum = ((TEMP_RESIDENCY_TIME * 1000UL) - (millis() - residencyStart)) / 1000UL; - SERIAL_PROTOCOLLN(codenum); - } - else - { - SERIAL_PROTOCOLLN("?"); - } - } - #else - SERIAL_PROTOCOLLN(""); - #endif - codenum = millis(); - } - manage_heater(); - manage_inactivity(); - lcd_update(); - #ifdef TEMP_RESIDENCY_TIME - /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time - or when current temp falls outside the hysteresis after target temp was reached */ - if ((residencyStart == -1 && target_direction && (degHotend(tmp_extruder) >= (degTargetHotend(tmp_extruder)-TEMP_WINDOW))) || - (residencyStart == -1 && !target_direction && (degHotend(tmp_extruder) <= (degTargetHotend(tmp_extruder)+TEMP_WINDOW))) || - (residencyStart > -1 && labs(degHotend(tmp_extruder) - degTargetHotend(tmp_extruder)) > TEMP_HYSTERESIS) ) - { - residencyStart = millis(); - } - #endif //TEMP_RESIDENCY_TIME - } LCD_MESSAGERPGM(MSG_HEATING_COMPLETE); heating_status = 2; if (farm_mode) { prusa_statistics(2); }; @@ -4853,11 +4809,184 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp break; } #endif // CUSTOM_M_CODE_SET_Z_PROBE_OFFSET +/* case 602: //resume long pause print + { + //set hotend temp back + setTargetHotend(HotendTempBckp, active_extruder); + //set fan speed back + fanSpeed = fanSpeedBckp; + + //go back to print + + //Move XY back + plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder); + + //wait for hotend to reach target temp -> see M109 + //while (abs(degHotend(active_extruder) - target_temperature(active_extruder)) > 3) delay_keep_alive; + wait_for_heater(millis()); + + //Move Z back + plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], 15, active_extruder); + + //Unretract + target[E_AXIS] = target[E_AXIS] - PAUSE_RETRACT; + plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder); + + //Set E position to original (should be original in this case) + plan_set_e_position(lastpos[E_AXIS]); + + //Recover feed rate + feedmultiply = feedmultiplyBckp; + char cmd[9]; + sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp); + enquecommand(cmd); + + card.startFileprint(); + + }break;*/ + + case 601: //long pause print + { + //M601 E-2 X50 Y190 Z20 + // if (IS_SD_PRINTING) { + // We don't know where we are! HOME! + // Push the commands to the front of the message queue in the reverse order! + // There shall be always enough space reserved for these commands. + // repeatcommand_front(); // repeat G80 with all its parameters + // enquecommand_front_P((PSTR("G25"))); + // break; + //} + + + float target[4]; + float lastpos[4]; + //statistics - need to save print time??? + //keep motor currents and bed temperature and pause print + //stop_buffering = true; + //while (blocks_queued()) delay_keep_alive(50); + //tuurn off print ventilator + card.pauseSDPrint(); + while (blocks_queued()) delay_keep_alive(50); //wait for empty buffer + st_synchronize(); + + feedmultiplyBckp = feedmultiply; + HotendTempBckp = degTargetHotend(active_extruder); + fanSpeedBckp = fanSpeed; + + target[X_AXIS] = current_position[X_AXIS]; + target[Y_AXIS] = current_position[Y_AXIS]; + target[Z_AXIS] = current_position[Z_AXIS]; + target[E_AXIS] = current_position[E_AXIS]; + lastpos[X_AXIS] = current_position[X_AXIS]; + lastpos[Y_AXIS] = current_position[Y_AXIS]; + lastpos[Z_AXIS] = current_position[Z_AXIS]; + lastpos[E_AXIS] = current_position[E_AXIS]; + + if (code_seen('E')) + { + target[E_AXIS] += code_value(); + } + else + { + #ifdef PAUSE_RETRACT + target[E_AXIS] += PAUSE_RETRACT; + #endif + } + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder); + + //Lift Z + if (code_seen('Z')) + { + target[Z_AXIS] += code_value(); + } + else + { + #ifdef Z_PAUSE_LIFT + target[Z_AXIS] += Z_PAUSE_LIFT; + if (target[Z_AXIS] > Z_MAX_POS) target[Z_AXIS] = Z_MAX_POS; + #endif + } + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 15, active_extruder); + + //set nozzle target temperature to 0 + setTargetHotend(0, 0); + setTargetHotend(0, 1); + setTargetHotend(0, 2); + + //Move XY to side + if (code_seen('X')) + { + target[X_AXIS] += code_value(); + } + else + { + #ifdef X_PAUSE_POS + target[X_AXIS] = X_PAUSE_POS; + #endif + } + if (code_seen('Y')) + { + target[Y_AXIS] = code_value(); + } + else + { + #ifdef Y_PAUSE_POS + target[Y_AXIS] = Y_PAUSE_POS; + #endif + } + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder); + + // Turn off the print fan + //SET_OUTPUT(FAN_PIN); + //WRITE(FAN_PIN, 0); + fanSpeed = 0; + + st_synchronize(); + + /*while (!lcd_clicked()) { + delay_keep_alive(100); + } + + //set hotend temp back + setTargetHotend(HotendTempBckp, active_extruder); + + //go back to print + + //Move XY back + plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder); + + //wait for hotend to reach target temp -> see M109 + //while (abs(degHotend(active_extruder) - target_temperature(active_extruder)) > 3) delay_keep_alive; + wait_for_heater(millis()); + + //Move Z back + plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder); + + target[E_AXIS] = target[E_AXIS] - FILAMENTCHANGE_FIRSTRETRACT; + + //Unretract + plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder); + + //Set E position to original (shoulb be original in this case) + plan_set_e_position(lastpos[E_AXIS]); + + //Recover feed rate + feedmultiply = feedmultiplyBckp; + char cmd[9]; + sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp); + enquecommand(cmd); + + //card.startFileprint();*/ + + } + break; #ifdef FILAMENTCHANGEENABLE case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] { st_synchronize(); + float target[4]; + float lastpos[4]; if (farm_mode) @@ -4869,8 +4998,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp feedmultiplyBckp=feedmultiply; int8_t TooLowZ = 0; - float target[4]; - float lastpos[4]; + target[X_AXIS]=current_position[X_AXIS]; target[Y_AXIS]=current_position[Y_AXIS]; target[Z_AXIS]=current_position[Z_AXIS]; @@ -5078,7 +5206,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp } break; #endif //FILAMENTCHANGEENABLE - + case 907: // M907 Set digital trimpot motor current using axis codes. { #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1 @@ -5844,6 +5972,59 @@ void delay_keep_alive(int ms) } } +void wait_for_heater(long codenum) { + +#ifdef TEMP_RESIDENCY_TIME + long residencyStart; + residencyStart = -1; + /* continue to loop until we have reached the target temp + _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */ + while ((!cancel_heatup) && ((residencyStart == -1) || + (residencyStart >= 0 && (((unsigned int)(millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL))))) { +#else + while (target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder) && (CooldownNoWait == false))) { +#endif //TEMP_RESIDENCY_TIME + if ((millis() - codenum) > 1000UL) + { //Print Temp Reading and remaining time every 1 second while heating up/cooling down + if (!farm_mode) { + SERIAL_PROTOCOLPGM("T:"); + SERIAL_PROTOCOL_F(degHotend(tmp_extruder), 1); + SERIAL_PROTOCOLPGM(" E:"); + SERIAL_PROTOCOL((int)tmp_extruder); + +#ifdef TEMP_RESIDENCY_TIME + SERIAL_PROTOCOLPGM(" W:"); + if (residencyStart > -1) + { + codenum = ((TEMP_RESIDENCY_TIME * 1000UL) - (millis() - residencyStart)) / 1000UL; + SERIAL_PROTOCOLLN(codenum); + } + else + { + SERIAL_PROTOCOLLN("?"); + } + } +#else + SERIAL_PROTOCOLLN(""); +#endif + codenum = millis(); + } + manage_heater(); + manage_inactivity(); + lcd_update(); +#ifdef TEMP_RESIDENCY_TIME + /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time + or when current temp falls outside the hysteresis after target temp was reached */ + if ((residencyStart == -1 && target_direction && (degHotend(tmp_extruder) >= (degTargetHotend(tmp_extruder) - TEMP_WINDOW))) || + (residencyStart == -1 && !target_direction && (degHotend(tmp_extruder) <= (degTargetHotend(tmp_extruder) + TEMP_WINDOW))) || + (residencyStart > -1 && labs(degHotend(tmp_extruder) - degTargetHotend(tmp_extruder)) > TEMP_HYSTERESIS)) + { + residencyStart = millis(); + } +#endif //TEMP_RESIDENCY_TIME + } +} + void check_babystep() { int babystep_z; EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystep_z); @@ -6092,4 +6273,290 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ } -#endif \ No newline at end of file +#endif + + +void long_pause() //long pause print +{ + //M601 E-2 X50 Y190 Z20 + // if (IS_SD_PRINTING) { + // We don't know where we are! HOME! + // Push the commands to the front of the message queue in the reverse order! + // There shall be always enough space reserved for these commands. + // repeatcommand_front(); // repeat G80 with all its parameters + // enquecommand_front_P((PSTR("G25"))); + // break; + //} + + + float target[4]; + float lastpos[4]; + //statistics - need to save print time??? + //keep motor currents and bed temperature and pause print + //stop_buffering = true; + //while (blocks_queued()) delay_keep_alive(50); + //tuurn off print ventilator + + st_synchronize(); + + feedmultiplyBckp = feedmultiply; + HotendTempBckp = degTargetHotend(active_extruder); + fanSpeedBckp = fanSpeed; + + target[X_AXIS] = current_position[X_AXIS]; + target[Y_AXIS] = current_position[Y_AXIS]; + target[Z_AXIS] = current_position[Z_AXIS]; + target[E_AXIS] = current_position[E_AXIS]; + lastpos[X_AXIS] = current_position[X_AXIS]; + lastpos[Y_AXIS] = current_position[Y_AXIS]; + lastpos[Z_AXIS] = current_position[Z_AXIS]; + lastpos[E_AXIS] = current_position[E_AXIS]; + + if (code_seen('E')) + { + target[E_AXIS] += code_value(); + } + else + { +#ifdef PAUSE_RETRACT + target[E_AXIS] += PAUSE_RETRACT; +#endif + } + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder); + + //Lift Z + if (code_seen('Z')) + { + target[Z_AXIS] += code_value(); + } + else + { +#ifdef Z_PAUSE_LIFT + target[Z_AXIS] += Z_PAUSE_LIFT; + if (target[Z_AXIS] > Z_MAX_POS) target[Z_AXIS] = Z_MAX_POS; +#endif + } + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 15, active_extruder); + + //set nozzle target temperature to 0 + setTargetHotend(0, 0); + setTargetHotend(0, 1); + setTargetHotend(0, 2); + + //Move XY to side + if (code_seen('X')) + { + target[X_AXIS] += code_value(); + } + else + { +#ifdef X_PAUSE_POS + target[X_AXIS] = X_PAUSE_POS; +#endif + } + if (code_seen('Y')) + { + target[Y_AXIS] = code_value(); + } + else + { +#ifdef Y_PAUSE_POS + target[Y_AXIS] = Y_PAUSE_POS; +#endif + } + plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder); + + // Turn off the print fan + //SET_OUTPUT(FAN_PIN); + //WRITE(FAN_PIN, 0); + fanSpeed = 0; + + st_synchronize(); + + /*while (!lcd_clicked()) { + delay_keep_alive(100); + } + + //set hotend temp back + setTargetHotend(HotendTempBckp, active_extruder); + + //go back to print + + //Move XY back + plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder); + + //wait for hotend to reach target temp -> see M109 + //while (abs(degHotend(active_extruder) - target_temperature(active_extruder)) > 3) delay_keep_alive; + wait_for_heater(millis()); + + //Move Z back + plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder); + + target[E_AXIS] = target[E_AXIS] - FILAMENTCHANGE_FIRSTRETRACT; + + //Unretract + plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder); + + //Set E position to original (shoulb be original in this case) + plan_set_e_position(lastpos[E_AXIS]); + + //Recover feed rate + feedmultiply = feedmultiplyBckp; + char cmd[9]; + sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp); + enquecommand(cmd); + + //card.startFileprint();*/ + +} + + + +/*void bootloader_display() { + char i; + unsigned char lcd_rows = 4; + unsigned char lcd_cols = 20; + unsigned char display_func = 0; + unsigned char current_row = 0; + unsigned char rs_pin = 82; + unsigned char enable_pin = 18; + unsigned char d4 = 19; + unsigned char d5 = 70; + unsigned char d6 = 85; + unsigned char d7 = 71; + + //initialize display + + for (i = 0; i < 100; i++) delay(500); //we need at least 40ms delay after power up + display_func |= 0x08; //2 lines + // Now we pull both RS and R/W low to begin commands + + + // Now we pull both RS and R/W low to begin commands + + digitalWrite(rs_pin, LOW); + digitalWrite(_enable_pin, LOW); + if (_rw_pin != 255) { + digitalWrite(_rw_pin, LOW); + } + + //put the LCD into 4 bit or 8 bit mode + if (!(_displayfunction & LCD_8BITMODE)) { + // this is according to the hitachi HD44780 datasheet + // figure 24, pg 46 + + // we start in 8bit mode, try to set 4 bit mode + write4bits(0x03); + delayMicroseconds(4500); // wait min 4.1ms + + // second try + write4bits(0x03); + delayMicroseconds(4500); // wait min 4.1ms + + // third go! + write4bits(0x03); + delayMicroseconds(150); + + // finally, set to 4-bit interface + write4bits(0x02); + } + else { + // this is according to the hitachi HD44780 datasheet + // page 45 figure 23 + + // Send function set command sequence + command(LCD_FUNCTIONSET | _displayfunction); + delayMicroseconds(4500); // wait more than 4.1ms + + // second try + command(LCD_FUNCTIONSET | _displayfunction); + delayMicroseconds(150); + + // third go + command(LCD_FUNCTIONSET | _displayfunction); + } + + // finally, set # lines, font size, etc. + command(LCD_FUNCTIONSET | _displayfunction); + delayMicroseconds(60); + // turn the display on with no cursor or blinking default + _displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF; + display(); + delayMicroseconds(60); + // clear it off + clear(); + delayMicroseconds(3000); + // Initialize to default text direction (for romance languages) + _displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; + // set the entry mode + command(LCD_ENTRYMODESET | _displaymode); + delayMicroseconds(60); + + } + + + + + void lcd_init() + { + lcd_implementation_init(); + +#ifdef NEWPANEL + SET_INPUT(BTN_EN1); + SET_INPUT(BTN_EN2); + WRITE(BTN_EN1, HIGH); + WRITE(BTN_EN2, HIGH); +#if BTN_ENC > 0 + SET_INPUT(BTN_ENC); + WRITE(BTN_ENC, HIGH); +#endif +#ifdef REPRAPWORLD_KEYPAD + pinMode(SHIFT_CLK, OUTPUT); + pinMode(SHIFT_LD, OUTPUT); + pinMode(SHIFT_OUT, INPUT); + WRITE(SHIFT_OUT, HIGH); + WRITE(SHIFT_LD, HIGH); +#endif +#else // Not NEWPANEL +#ifdef SR_LCD_2W_NL // Non latching 2 wire shift register + pinMode(SR_DATA_PIN, OUTPUT); + pinMode(SR_CLK_PIN, OUTPUT); +#elif defined(SHIFT_CLK) + pinMode(SHIFT_CLK, OUTPUT); + pinMode(SHIFT_LD, OUTPUT); + pinMode(SHIFT_EN, OUTPUT); + pinMode(SHIFT_OUT, INPUT); + WRITE(SHIFT_OUT, HIGH); + WRITE(SHIFT_LD, HIGH); + WRITE(SHIFT_EN, LOW); +#else +#ifdef ULTIPANEL +#error ULTIPANEL requires an encoder +#endif +#endif // SR_LCD_2W_NL +#endif//!NEWPANEL + +#if defined (SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0) + pinMode(SDCARDDETECT, INPUT); + WRITE(SDCARDDETECT, HIGH); + lcd_oldcardstatus = IS_SD_INSERTED; +#endif//(SDCARDDETECT > 0) +#ifdef LCD_HAS_SLOW_BUTTONS + slow_buttons = 0; +#endif + lcd_buttons_update(); +#ifdef ULTIPANEL + encoderDiff = 0; +#endif + } + + + + //clear the display + + //write message + + + + LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7 +}*/ diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index aa22fe265..ae1c81a2b 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -509,7 +509,27 @@ static void lcd_status_screen() #ifdef ULTIPANEL void lcd_commands() -{ +{ + if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) + { + if(lcd_commands_step == 0) { + lcd_commands_step = 2; + } + if (lcd_commands_step == 2 & !blocks_queued()) { + //lcd_return_to_status(); + lcd_setstatuspgm(PSTR("print paused")); + + lcd_commands_step = 1; + } + if (lcd_commands_step == 1 && !blocks_queued()) { + long_pause(); + lcd_commands_type = 0; + lcd_commands_step = 0; + } + + } + + if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) /// stop print { @@ -711,16 +731,20 @@ static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen, 0, false); } + static void lcd_sdcard_pause() { - card.pauseSDPrint(); - isPrintPaused = true; - lcdDrawUpdate = 3; + card.pauseSDPrint(); + isPrintPaused = true; + lcd_return_to_status(); + lcdDrawUpdate = 3; + lcd_commands_type = LCD_COMMAND_LONG_PAUSE; + } static void lcd_sdcard_resume() { - card.startFileprint(); + /*enquecommand_P(PSTR("M602")); isPrintPaused = false; - lcdDrawUpdate = 3; + lcdDrawUpdate = 3;*/ } float move_menu_scale; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 76136ff8f..3afd63298 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -91,6 +91,8 @@ void lcd_mylang(); #define LCD_COMMAND_LOAD_FILAMENT 1 #define LCD_COMMAND_STOP_PRINT 2 #define LCD_COMMAND_FARM_MODE_CONFIRM 4 + #define LCD_COMMAND_LONG_PAUSE 5 + #define LCD_COMMAND_LONG_PAUSE_RESUME 6 extern unsigned long lcd_timeoutToStatus; extern int lcd_commands_type; From 6ffc02263390a1836c74a1a5c8dedf9fd799e3be Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 30 Mar 2017 16:48:10 +0200 Subject: [PATCH 28/49] stop print statistics needs to finish, lcd_licked function improved to work with long press button, selftest bug fixed; stop print, pause print and live adjust are hidden in mesh bed leveling and auto home --- Firmware/Marlin.h | 9 +- Firmware/Marlin_main.cpp | 481 ++---------------- Firmware/language_all.cpp | 15 + Firmware/language_all.h | 6 + Firmware/language_en.h | 5 +- Firmware/ultralcd.cpp | 118 +++-- Firmware/ultralcd.h | 1 + .../ultralcd_implementation_hitachi_HD44780.h | 2 +- 8 files changed, 159 insertions(+), 478 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2617434c2..bbf50d41f 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -310,9 +310,14 @@ extern void digipot_i2c_init(); #endif +//Long pause +extern int saved_feedmultiply; +extern float HotendTempBckp; +extern int fanSpeedBckp; +extern float pause_lastpos[4]; +extern unsigned long pause_time; - - +extern bool mesh_bed_leveling_flag; extern void calculate_volumetric_multipliers(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 90df120e1..f6bc30c39 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -262,9 +262,14 @@ unsigned long kicktime = millis()+100000; unsigned int usb_printing_counter; int lcd_change_fil_state = 0; + int feedmultiplyBckp = 100; float HotendTempBckp = 0; int fanSpeedBckp = 0; +float pause_lastpos[4]; +unsigned long pause_time = 0; + +bool mesh_bed_leveling_flag = false; unsigned char lang_selected = 0; int8_t FarmMode = 0; @@ -1316,7 +1321,7 @@ void loop() } //check heater every n milliseconds manage_heater(); - manage_inactivity(); + isPrintPaused ? manage_inactivity(true) : manage_inactivity(false); checkHitEndstops(); lcd_update(); } @@ -2824,7 +2829,9 @@ void process_commands() case 80: case_G80: { - // Firstly check if we know where we are + mesh_bed_leveling_flag = true; + + // Firstly check if we know where we are if ( !( axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS] ) ){ // We don't know where we are! HOME! // Push the commands to the front of the message queue in the reverse order! @@ -2902,7 +2909,7 @@ void process_commands() world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], XY_AXIS_FEEDRATE, active_extruder); st_synchronize(); - + // Go down until endstop is hit const float Z_CALIBRATION_THRESHOLD = 1.f; if (! find_bed_induction_sensor_point_z((has_z && mesh_point > 0) ? z0 - Z_CALIBRATION_THRESHOLD : -10.f)) { @@ -2993,7 +3000,8 @@ void process_commands() custom_message = custom_message_old; custom_message_type = custom_message_type_old; custom_message_state = custom_message_state_old; - lcd_update(1); + mesh_bed_leveling_flag = false; + lcd_update(2); } break; @@ -4809,177 +4817,6 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp break; } #endif // CUSTOM_M_CODE_SET_Z_PROBE_OFFSET -/* case 602: //resume long pause print - { - //set hotend temp back - setTargetHotend(HotendTempBckp, active_extruder); - //set fan speed back - fanSpeed = fanSpeedBckp; - - //go back to print - - //Move XY back - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder); - - //wait for hotend to reach target temp -> see M109 - //while (abs(degHotend(active_extruder) - target_temperature(active_extruder)) > 3) delay_keep_alive; - wait_for_heater(millis()); - - //Move Z back - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], 15, active_extruder); - - //Unretract - target[E_AXIS] = target[E_AXIS] - PAUSE_RETRACT; - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder); - - //Set E position to original (should be original in this case) - plan_set_e_position(lastpos[E_AXIS]); - - //Recover feed rate - feedmultiply = feedmultiplyBckp; - char cmd[9]; - sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp); - enquecommand(cmd); - - card.startFileprint(); - - }break;*/ - - case 601: //long pause print - { - //M601 E-2 X50 Y190 Z20 - // if (IS_SD_PRINTING) { - // We don't know where we are! HOME! - // Push the commands to the front of the message queue in the reverse order! - // There shall be always enough space reserved for these commands. - // repeatcommand_front(); // repeat G80 with all its parameters - // enquecommand_front_P((PSTR("G25"))); - // break; - //} - - - float target[4]; - float lastpos[4]; - //statistics - need to save print time??? - //keep motor currents and bed temperature and pause print - //stop_buffering = true; - //while (blocks_queued()) delay_keep_alive(50); - //tuurn off print ventilator - card.pauseSDPrint(); - while (blocks_queued()) delay_keep_alive(50); //wait for empty buffer - st_synchronize(); - - feedmultiplyBckp = feedmultiply; - HotendTempBckp = degTargetHotend(active_extruder); - fanSpeedBckp = fanSpeed; - - target[X_AXIS] = current_position[X_AXIS]; - target[Y_AXIS] = current_position[Y_AXIS]; - target[Z_AXIS] = current_position[Z_AXIS]; - target[E_AXIS] = current_position[E_AXIS]; - lastpos[X_AXIS] = current_position[X_AXIS]; - lastpos[Y_AXIS] = current_position[Y_AXIS]; - lastpos[Z_AXIS] = current_position[Z_AXIS]; - lastpos[E_AXIS] = current_position[E_AXIS]; - - if (code_seen('E')) - { - target[E_AXIS] += code_value(); - } - else - { - #ifdef PAUSE_RETRACT - target[E_AXIS] += PAUSE_RETRACT; - #endif - } - plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder); - - //Lift Z - if (code_seen('Z')) - { - target[Z_AXIS] += code_value(); - } - else - { - #ifdef Z_PAUSE_LIFT - target[Z_AXIS] += Z_PAUSE_LIFT; - if (target[Z_AXIS] > Z_MAX_POS) target[Z_AXIS] = Z_MAX_POS; - #endif - } - plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 15, active_extruder); - - //set nozzle target temperature to 0 - setTargetHotend(0, 0); - setTargetHotend(0, 1); - setTargetHotend(0, 2); - - //Move XY to side - if (code_seen('X')) - { - target[X_AXIS] += code_value(); - } - else - { - #ifdef X_PAUSE_POS - target[X_AXIS] = X_PAUSE_POS; - #endif - } - if (code_seen('Y')) - { - target[Y_AXIS] = code_value(); - } - else - { - #ifdef Y_PAUSE_POS - target[Y_AXIS] = Y_PAUSE_POS; - #endif - } - plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder); - - // Turn off the print fan - //SET_OUTPUT(FAN_PIN); - //WRITE(FAN_PIN, 0); - fanSpeed = 0; - - st_synchronize(); - - /*while (!lcd_clicked()) { - delay_keep_alive(100); - } - - //set hotend temp back - setTargetHotend(HotendTempBckp, active_extruder); - - //go back to print - - //Move XY back - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder); - - //wait for hotend to reach target temp -> see M109 - //while (abs(degHotend(active_extruder) - target_temperature(active_extruder)) > 3) delay_keep_alive; - wait_for_heater(millis()); - - //Move Z back - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder); - - target[E_AXIS] = target[E_AXIS] - FILAMENTCHANGE_FIRSTRETRACT; - - //Unretract - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder); - - //Set E position to original (shoulb be original in this case) - plan_set_e_position(lastpos[E_AXIS]); - - //Recover feed rate - feedmultiply = feedmultiplyBckp; - char cmd[9]; - sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp); - enquecommand(cmd); - - //card.startFileprint();*/ - - } - break; #ifdef FILAMENTCHANGEENABLE case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] @@ -5206,7 +5043,16 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp } break; #endif //FILAMENTCHANGEENABLE - + case 601: { + if(lcd_commands_type == 0) lcd_commands_type = LCD_COMMAND_LONG_PAUSE; + } + break; + + case 602: { + if(lcd_commands_type == 0) lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME; + } + break; + case 907: // M907 Set digital trimpot motor current using axis codes. { #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1 @@ -6278,65 +6124,29 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ void long_pause() //long pause print { - //M601 E-2 X50 Y190 Z20 - // if (IS_SD_PRINTING) { - // We don't know where we are! HOME! - // Push the commands to the front of the message queue in the reverse order! - // There shall be always enough space reserved for these commands. - // repeatcommand_front(); // repeat G80 with all its parameters - // enquecommand_front_P((PSTR("G25"))); - // break; - //} - - - float target[4]; - float lastpos[4]; - //statistics - need to save print time??? - //keep motor currents and bed temperature and pause print - //stop_buffering = true; - //while (blocks_queued()) delay_keep_alive(50); - //tuurn off print ventilator - st_synchronize(); - - feedmultiplyBckp = feedmultiply; + + //save currently set parameters to global variables + saved_feedmultiply = feedmultiply; HotendTempBckp = degTargetHotend(active_extruder); fanSpeedBckp = fanSpeed; + pause_time += (millis() - starttime); + - target[X_AXIS] = current_position[X_AXIS]; - target[Y_AXIS] = current_position[Y_AXIS]; - target[Z_AXIS] = current_position[Z_AXIS]; - target[E_AXIS] = current_position[E_AXIS]; - lastpos[X_AXIS] = current_position[X_AXIS]; - lastpos[Y_AXIS] = current_position[Y_AXIS]; - lastpos[Z_AXIS] = current_position[Z_AXIS]; - lastpos[E_AXIS] = current_position[E_AXIS]; + //save position + pause_lastpos[X_AXIS] = current_position[X_AXIS]; + pause_lastpos[Y_AXIS] = current_position[Y_AXIS]; + pause_lastpos[Z_AXIS] = current_position[Z_AXIS]; + pause_lastpos[E_AXIS] = current_position[E_AXIS]; - if (code_seen('E')) - { - target[E_AXIS] += code_value(); - } - else - { -#ifdef PAUSE_RETRACT - target[E_AXIS] += PAUSE_RETRACT; -#endif - } - plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder); + //retract + current_position[E_AXIS] -= PAUSE_RETRACT; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder); - //Lift Z - if (code_seen('Z')) - { - target[Z_AXIS] += code_value(); - } - else - { -#ifdef Z_PAUSE_LIFT - target[Z_AXIS] += Z_PAUSE_LIFT; - if (target[Z_AXIS] > Z_MAX_POS) target[Z_AXIS] = Z_MAX_POS; -#endif - } - plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 15, active_extruder); + //lift z + current_position[Z_AXIS] += Z_PAUSE_LIFT; + if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder); //set nozzle target temperature to 0 setTargetHotend(0, 0); @@ -6344,219 +6154,12 @@ void long_pause() //long pause print setTargetHotend(0, 2); //Move XY to side - if (code_seen('X')) - { - target[X_AXIS] += code_value(); - } - else - { -#ifdef X_PAUSE_POS - target[X_AXIS] = X_PAUSE_POS; -#endif - } - if (code_seen('Y')) - { - target[Y_AXIS] = code_value(); - } - else - { -#ifdef Y_PAUSE_POS - target[Y_AXIS] = Y_PAUSE_POS; -#endif - } - plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder); + current_position[X_AXIS] = X_PAUSE_POS; + current_position[Y_AXIS] = Y_PAUSE_POS; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder); // Turn off the print fan - //SET_OUTPUT(FAN_PIN); - //WRITE(FAN_PIN, 0); fanSpeed = 0; st_synchronize(); - - /*while (!lcd_clicked()) { - delay_keep_alive(100); - } - - //set hotend temp back - setTargetHotend(HotendTempBckp, active_extruder); - - //go back to print - - //Move XY back - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder); - - //wait for hotend to reach target temp -> see M109 - //while (abs(degHotend(active_extruder) - target_temperature(active_extruder)) > 3) delay_keep_alive; - wait_for_heater(millis()); - - //Move Z back - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder); - - target[E_AXIS] = target[E_AXIS] - FILAMENTCHANGE_FIRSTRETRACT; - - //Unretract - plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder); - - //Set E position to original (shoulb be original in this case) - plan_set_e_position(lastpos[E_AXIS]); - - //Recover feed rate - feedmultiply = feedmultiplyBckp; - char cmd[9]; - sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp); - enquecommand(cmd); - - //card.startFileprint();*/ - } - - - -/*void bootloader_display() { - char i; - unsigned char lcd_rows = 4; - unsigned char lcd_cols = 20; - unsigned char display_func = 0; - unsigned char current_row = 0; - unsigned char rs_pin = 82; - unsigned char enable_pin = 18; - unsigned char d4 = 19; - unsigned char d5 = 70; - unsigned char d6 = 85; - unsigned char d7 = 71; - - //initialize display - - for (i = 0; i < 100; i++) delay(500); //we need at least 40ms delay after power up - display_func |= 0x08; //2 lines - // Now we pull both RS and R/W low to begin commands - - - // Now we pull both RS and R/W low to begin commands - - digitalWrite(rs_pin, LOW); - digitalWrite(_enable_pin, LOW); - if (_rw_pin != 255) { - digitalWrite(_rw_pin, LOW); - } - - //put the LCD into 4 bit or 8 bit mode - if (!(_displayfunction & LCD_8BITMODE)) { - // this is according to the hitachi HD44780 datasheet - // figure 24, pg 46 - - // we start in 8bit mode, try to set 4 bit mode - write4bits(0x03); - delayMicroseconds(4500); // wait min 4.1ms - - // second try - write4bits(0x03); - delayMicroseconds(4500); // wait min 4.1ms - - // third go! - write4bits(0x03); - delayMicroseconds(150); - - // finally, set to 4-bit interface - write4bits(0x02); - } - else { - // this is according to the hitachi HD44780 datasheet - // page 45 figure 23 - - // Send function set command sequence - command(LCD_FUNCTIONSET | _displayfunction); - delayMicroseconds(4500); // wait more than 4.1ms - - // second try - command(LCD_FUNCTIONSET | _displayfunction); - delayMicroseconds(150); - - // third go - command(LCD_FUNCTIONSET | _displayfunction); - } - - // finally, set # lines, font size, etc. - command(LCD_FUNCTIONSET | _displayfunction); - delayMicroseconds(60); - // turn the display on with no cursor or blinking default - _displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF; - display(); - delayMicroseconds(60); - // clear it off - clear(); - delayMicroseconds(3000); - // Initialize to default text direction (for romance languages) - _displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; - // set the entry mode - command(LCD_ENTRYMODESET | _displaymode); - delayMicroseconds(60); - - } - - - - - void lcd_init() - { - lcd_implementation_init(); - -#ifdef NEWPANEL - SET_INPUT(BTN_EN1); - SET_INPUT(BTN_EN2); - WRITE(BTN_EN1, HIGH); - WRITE(BTN_EN2, HIGH); -#if BTN_ENC > 0 - SET_INPUT(BTN_ENC); - WRITE(BTN_ENC, HIGH); -#endif -#ifdef REPRAPWORLD_KEYPAD - pinMode(SHIFT_CLK, OUTPUT); - pinMode(SHIFT_LD, OUTPUT); - pinMode(SHIFT_OUT, INPUT); - WRITE(SHIFT_OUT, HIGH); - WRITE(SHIFT_LD, HIGH); -#endif -#else // Not NEWPANEL -#ifdef SR_LCD_2W_NL // Non latching 2 wire shift register - pinMode(SR_DATA_PIN, OUTPUT); - pinMode(SR_CLK_PIN, OUTPUT); -#elif defined(SHIFT_CLK) - pinMode(SHIFT_CLK, OUTPUT); - pinMode(SHIFT_LD, OUTPUT); - pinMode(SHIFT_EN, OUTPUT); - pinMode(SHIFT_OUT, INPUT); - WRITE(SHIFT_OUT, HIGH); - WRITE(SHIFT_LD, HIGH); - WRITE(SHIFT_EN, LOW); -#else -#ifdef ULTIPANEL -#error ULTIPANEL requires an encoder -#endif -#endif // SR_LCD_2W_NL -#endif//!NEWPANEL - -#if defined (SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0) - pinMode(SDCARDDETECT, INPUT); - WRITE(SDCARDDETECT, HIGH); - lcd_oldcardstatus = IS_SD_INSERTED; -#endif//(SDCARDDETECT > 0) -#ifdef LCD_HAS_SLOW_BUTTONS - slow_buttons = 0; -#endif - lcd_buttons_update(); -#ifdef ULTIPANEL - encoderDiff = 0; -#endif - } - - - - //clear the display - - //write message - - - - LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7 -}*/ diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 3cdad48f0..950fde70f 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -996,6 +996,11 @@ const char * const MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE[LANG_NUM] PROGM MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_DE }; +const char MSG_FINISHING_MOVEMENTS_EN[] PROGMEM = "Finishing movements"; +const char * const MSG_FINISHING_MOVEMENTS_LANG_TABLE[1] PROGMEM = { + MSG_FINISHING_MOVEMENTS_EN +}; + const char MSG_FLOW_EN[] PROGMEM = "Flow"; const char MSG_FLOW_CZ[] PROGMEM = "Prutok"; const char MSG_FLOW_IT[] PROGMEM = "Flusso"; @@ -1826,6 +1831,11 @@ const char * const MSG_PRINT_ABORTED_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_PRINT_ABORTED_DE }; +const char MSG_PRINT_PAUSED_EN[] PROGMEM = "Print paused"; +const char * const MSG_PRINT_PAUSED_LANG_TABLE[1] PROGMEM = { + MSG_PRINT_PAUSED_EN +}; + const char MSG_PRUSA3D_EN[] PROGMEM = "prusa3d.com"; const char MSG_PRUSA3D_CZ[] PROGMEM = "prusa3d.cz"; const char MSG_PRUSA3D_PL[] PROGMEM = "prusa3d.cz"; @@ -1932,6 +1942,11 @@ const char * const MSG_RESUMING_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_RESUMING_DE }; +const char MSG_RESUMING_PRINT_EN[] PROGMEM = "Resuming print"; +const char * const MSG_RESUMING_PRINT_LANG_TABLE[1] PROGMEM = { + MSG_RESUMING_PRINT_EN +}; + const char MSG_SD_CANT_ENTER_SUBDIR_EN[] PROGMEM = "Cannot enter subdir: "; const char * const MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE[1] PROGMEM = { MSG_SD_CANT_ENTER_SUBDIR_EN diff --git a/Firmware/language_all.h b/Firmware/language_all.h index 47dde007e..dfadc2569 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -205,6 +205,8 @@ extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE[LANG_NUM] #define MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE) extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE[LANG_NUM]; #define MSG_FIND_BED_OFFSET_AND_SKEW_LINE2 LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE) +extern const char* const MSG_FINISHING_MOVEMENTS_LANG_TABLE[1]; +#define MSG_FINISHING_MOVEMENTS LANG_TABLE_SELECT_EXPLICIT(MSG_FINISHING_MOVEMENTS_LANG_TABLE, 0) extern const char* const MSG_FLOW_LANG_TABLE[LANG_NUM]; #define MSG_FLOW LANG_TABLE_SELECT(MSG_FLOW_LANG_TABLE) extern const char* const MSG_FLOW0_LANG_TABLE[1]; @@ -361,6 +363,8 @@ extern const char* const MSG_PRINTER_DISCONNECTED_LANG_TABLE[1]; #define MSG_PRINTER_DISCONNECTED LANG_TABLE_SELECT_EXPLICIT(MSG_PRINTER_DISCONNECTED_LANG_TABLE, 0) extern const char* const MSG_PRINT_ABORTED_LANG_TABLE[LANG_NUM]; #define MSG_PRINT_ABORTED LANG_TABLE_SELECT(MSG_PRINT_ABORTED_LANG_TABLE) +extern const char* const MSG_PRINT_PAUSED_LANG_TABLE[1]; +#define MSG_PRINT_PAUSED LANG_TABLE_SELECT_EXPLICIT(MSG_PRINT_PAUSED_LANG_TABLE, 0) extern const char* const MSG_PRUSA3D_LANG_TABLE[LANG_NUM]; #define MSG_PRUSA3D LANG_TABLE_SELECT(MSG_PRUSA3D_LANG_TABLE) extern const char* const MSG_PRUSA3D_FORUM_LANG_TABLE[LANG_NUM]; @@ -383,6 +387,8 @@ extern const char* const MSG_RESUME_PRINT_LANG_TABLE[LANG_NUM]; #define MSG_RESUME_PRINT LANG_TABLE_SELECT(MSG_RESUME_PRINT_LANG_TABLE) extern const char* const MSG_RESUMING_LANG_TABLE[LANG_NUM]; #define MSG_RESUMING LANG_TABLE_SELECT(MSG_RESUMING_LANG_TABLE) +extern const char* const MSG_RESUMING_PRINT_LANG_TABLE[1]; +#define MSG_RESUMING_PRINT LANG_TABLE_SELECT_EXPLICIT(MSG_RESUMING_PRINT_LANG_TABLE, 0) extern const char* const MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE[1]; #define MSG_SD_CANT_ENTER_SUBDIR LANG_TABLE_SELECT_EXPLICIT(MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE, 0) extern const char* const MSG_SD_CANT_OPEN_SUBDIR_LANG_TABLE[1]; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index f5e881b72..ab1450ea8 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -265,4 +265,7 @@ #define MSG_MENU_CALIBRATION "Calibration" #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]" #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]" -#define MSG_PRINTER_DISCONNECTED "Printer disconnected" \ No newline at end of file +#define MSG_PRINTER_DISCONNECTED "Printer disconnected" +#define MSG_FINISHING_MOVEMENTS "Finishing movements" +#define MSG_PRINT_PAUSED "Print paused" +#define MSG_RESUMING_PRINT "Resuming print" \ No newline at end of file diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ae1c81a2b..d8b746e7d 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -510,18 +510,19 @@ static void lcd_status_screen() void lcd_commands() { + char cmd1[25]; if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) { if(lcd_commands_step == 0) { - lcd_commands_step = 2; - } - if (lcd_commands_step == 2 & !blocks_queued()) { - //lcd_return_to_status(); - lcd_setstatuspgm(PSTR("print paused")); - + card.pauseSDPrint(); + lcd_setstatuspgm(MSG_FINISHING_MOVEMENTS); + + lcdDrawUpdate = 3; lcd_commands_step = 1; } if (lcd_commands_step == 1 && !blocks_queued()) { + lcd_setstatuspgm(MSG_PRINT_PAUSED); + isPrintPaused = true; long_pause(); lcd_commands_type = 0; lcd_commands_step = 0; @@ -529,11 +530,67 @@ void lcd_commands() } + if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE_RESUME) { + char cmd1[30]; + if (lcd_commands_step == 0) { + + lcdDrawUpdate = 3; + lcd_commands_step = 4; + } + if (lcd_commands_step == 1 && !blocks_queued()) { //recover feedmultiply, current + + sprintf_P(cmd1, PSTR("M220 S%d"), saved_feedmultiply); + enquecommand(cmd1); + isPrintPaused = false; + card.startFileprint(); + starttime = pause_time; + lcd_commands_step = 0; + lcd_commands_type = 0; + } + if (lcd_commands_step == 2 && !blocks_queued()) { //turn on fan, move Z and unretract + + sprintf_P(cmd1, PSTR("M106 S%d"), fanSpeedBckp); + enquecommand(cmd1); + strcpy(cmd1, "G1 Z"); + strcat(cmd1, ftostr32(pause_lastpos[Z_AXIS])); + enquecommand(cmd1); + enquecommand_P(PSTR("M83")); // set extruder to relative mode. + enquecommand_P(PSTR("G1 E" STRINGIFY(PAUSE_RETRACT))); //unretract + enquecommand_P(PSTR("G90")); //absolute positioning + lcd_commands_step = 1; + } + if (lcd_commands_step == 3 && !blocks_queued()) { //wait for nozzle to reach target temp + + strcpy(cmd1, "M109 S"); + strcat(cmd1, ftostr3(HotendTempBckp)); + enquecommand(cmd1); + lcd_commands_step = 2; + } + if (lcd_commands_step == 4 && !blocks_queued()) { //set temperature back and move xy + + strcpy(cmd1, "M104 S"); + strcat(cmd1, ftostr3(HotendTempBckp)); + enquecommand(cmd1); + + strcpy(cmd1, "G1 X"); + strcat(cmd1, ftostr32(pause_lastpos[X_AXIS])); + strcat(cmd1, " Y"); + strcat(cmd1, ftostr32(pause_lastpos[Y_AXIS])); + enquecommand(cmd1); + + lcd_setstatuspgm(MSG_RESUMING_PRINT); + lcd_commands_step = 3; + } + } if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) /// stop print { - if (lcd_commands_step == 0) { lcd_commands_step = 6; custom_message = true; } + if (lcd_commands_step == 0) + { + lcd_commands_step = 6; + custom_message = true; + } if (lcd_commands_step == 1 && !blocks_queued()) { @@ -733,18 +790,14 @@ static void lcd_return_to_status() { static void lcd_sdcard_pause() { - card.pauseSDPrint(); - isPrintPaused = true; lcd_return_to_status(); - lcdDrawUpdate = 3; lcd_commands_type = LCD_COMMAND_LONG_PAUSE; } static void lcd_sdcard_resume() { - /*enquecommand_P(PSTR("M602")); - isPrintPaused = false; - lcdDrawUpdate = 3;*/ + lcd_return_to_status(); + lcd_commands_type = LCD_COMMAND_LONG_PAUSE_RESUME; } float move_menu_scale; @@ -3237,9 +3290,7 @@ static void lcd_main_menu() }*/ - - - if ( ( IS_SD_PRINTING || is_usb_printing ) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag) + if ( ( IS_SD_PRINTING || is_usb_printing ) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) { MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);//8 } @@ -3258,15 +3309,17 @@ static void lcd_main_menu() { if (card.isFileOpen()) { - if (card.sdprinting) - { - MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause); + if (mesh_bed_leveling_flag == false && homing_flag == false) { + if (card.sdprinting) + { + MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause); + } + else + { + MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume); + } + MENU_ITEM(submenu, MSG_STOP_PRINT, lcd_sdcard_stop); } - else - { - MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume); - } - MENU_ITEM(submenu, MSG_STOP_PRINT, lcd_sdcard_stop); } else { @@ -3983,7 +4036,7 @@ static bool lcd_selfcheck_check_heater(bool _isbed) do { _counter++; - (_counter < _cycles) ? _docycle = true : _docycle = false; + _docycle = (_counter < _cycles) ? true : false; manage_heater(); manage_inactivity(true); @@ -3998,9 +4051,9 @@ static bool lcd_selfcheck_check_heater(bool _isbed) int _checked_result = (_isbed) ? degBed() - _checked_snapshot : degHotend(0) - _checked_snapshot; int _opposite_result = (_isbed) ? degHotend(0) - _opposite_snapshot : degBed() - _opposite_snapshot; - if (_opposite_result < (_isbed) ? 10 : 3) + if (_opposite_result < ((_isbed) ? 10 : 3)) { - if (_checked_result >= (_isbed) ? 3 : 10) + if (_checked_result >= ((_isbed) ? 3 : 10)) { _stepresult = true; } @@ -4145,15 +4198,10 @@ static bool lcd_selftest_fan_dialog(int _fan) lcd.setCursor(0, 3); lcd.print(">"); lcd.setCursor(1, 3); lcd_printPGM(MSG_SELFTEST_FAN_NO); - - - - int8_t enc_dif = 0; bool _response = false; do { - switch (_fan) { case 1: @@ -4167,8 +4215,6 @@ static bool lcd_selftest_fan_dialog(int _fan) analogWrite(FAN_PIN, 255); break; } - - if (abs((enc_dif - encoderDiff)) > 2) { if (enc_dif > encoderDiff) { _result = true; @@ -4785,7 +4831,9 @@ void lcd_buzz(long duration, uint16_t freq) bool lcd_clicked() { - return LCD_CLICKED; + bool clicked = LCD_CLICKED; + button_pressed = false; + return clicked; } #endif//ULTIPANEL diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 3afd63298..0334a38b6 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -103,6 +103,7 @@ void lcd_mylang(); extern int farm_status; extern bool cancel_heatup; + extern bool isPrintPaused; #ifdef FILAMENT_LCD_DISPLAY extern unsigned long message_millis; diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index 21f77c739..25a17cdc3 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -792,7 +792,7 @@ static void lcd_implementation_status_screen() lcd.print(LCD_STR_CLOCK[0]); if(starttime != 0) { - uint16_t time = millis()/60000 - starttime/60000; + uint16_t time = isPrintPaused ? pause_time/60000 : millis()/60000 - starttime/60000; //is print is paused, pause also print time lcd.print(itostr2(time/60)); lcd.print(':'); lcd.print(itostr2(time%60)); From 870f85ce61cb29eee3d51590946a2701dec7665a Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 31 Mar 2017 17:12:16 +0200 Subject: [PATCH 29/49] PID tuning from menu --- Firmware/language_all.cpp | 25 +++++++ Firmware/language_all.h | 10 +++ Firmware/language_en.h | 7 +- Firmware/temperature.cpp | 66 +++++++++++-------- Firmware/temperature.h | 4 +- Firmware/ultralcd.cpp | 62 +++++++++++++++++ Firmware/ultralcd.h | 1 + .../ultralcd_implementation_hitachi_HD44780.h | 11 ++++ 8 files changed, 158 insertions(+), 28 deletions(-) diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 950fde70f..87c7bf513 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -692,6 +692,11 @@ const char * const MSG_DWELL_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_DWELL_DE }; +const char MSG_EEPROM_SAVING_EN[] PROGMEM = "Saving"; +const char * const MSG_EEPROM_SAVING_LANG_TABLE[1] PROGMEM = { + MSG_EEPROM_SAVING_EN +}; + const char MSG_ENDSTOPS_HIT_EN[] PROGMEM = "endstops hit: "; const char * const MSG_ENDSTOPS_HIT_LANG_TABLE[1] PROGMEM = { MSG_ENDSTOPS_HIT_EN @@ -1736,6 +1741,21 @@ const char * const MSG_PICK_Z_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_PICK_Z_DE }; +const char MSG_PID_EXTRUDER_EN[] PROGMEM = "PID calibration"; +const char * const MSG_PID_EXTRUDER_LANG_TABLE[1] PROGMEM = { + MSG_PID_EXTRUDER_EN +}; + +const char MSG_PID_FINISHED_EN[] PROGMEM = "PID cal. finished"; +const char * const MSG_PID_FINISHED_LANG_TABLE[1] PROGMEM = { + MSG_PID_FINISHED_EN +}; + +const char MSG_PID_RUNNING_EN[] PROGMEM = "PID cal. "; +const char * const MSG_PID_RUNNING_LANG_TABLE[1] PROGMEM = { + MSG_PID_RUNNING_EN +}; + const char MSG_PLANNER_BUFFER_BYTES_EN[] PROGMEM = " PlannerBufferBytes: "; const char * const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1] PROGMEM = { MSG_PLANNER_BUFFER_BYTES_EN @@ -2446,6 +2466,11 @@ const char * const MSG_SET_ORIGIN_LANG_TABLE[1] PROGMEM = { MSG_SET_ORIGIN_EN }; +const char MSG_SET_TEMPERATURE_EN[] PROGMEM = "Set temperature"; +const char * const MSG_SET_TEMPERATURE_LANG_TABLE[1] PROGMEM = { + MSG_SET_TEMPERATURE_EN +}; + const char MSG_SHOW_END_STOPS_EN[] PROGMEM = "Show end stops"; const char MSG_SHOW_END_STOPS_CZ[] PROGMEM = "Stav konc. spin."; const char MSG_SHOW_END_STOPS_IT[] PROGMEM = "Stato finecorsa"; diff --git a/Firmware/language_all.h b/Firmware/language_all.h index dfadc2569..aa1ee4256 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -139,6 +139,8 @@ extern const char* const MSG_DISABLE_STEPPERS_LANG_TABLE[LANG_NUM]; #define MSG_DISABLE_STEPPERS LANG_TABLE_SELECT(MSG_DISABLE_STEPPERS_LANG_TABLE) extern const char* const MSG_DWELL_LANG_TABLE[LANG_NUM]; #define MSG_DWELL LANG_TABLE_SELECT(MSG_DWELL_LANG_TABLE) +extern const char* const MSG_EEPROM_SAVING_LANG_TABLE[1]; +#define MSG_EEPROM_SAVING LANG_TABLE_SELECT_EXPLICIT(MSG_EEPROM_SAVING_LANG_TABLE, 0) extern const char* const MSG_ENDSTOPS_HIT_LANG_TABLE[1]; #define MSG_ENDSTOPS_HIT LANG_TABLE_SELECT_EXPLICIT(MSG_ENDSTOPS_HIT_LANG_TABLE, 0) extern const char* const MSG_ENDSTOP_HIT_LANG_TABLE[1]; @@ -345,6 +347,12 @@ extern const char* const MSG_PAUSE_PRINT_LANG_TABLE[LANG_NUM]; #define MSG_PAUSE_PRINT LANG_TABLE_SELECT(MSG_PAUSE_PRINT_LANG_TABLE) extern const char* const MSG_PICK_Z_LANG_TABLE[LANG_NUM]; #define MSG_PICK_Z LANG_TABLE_SELECT(MSG_PICK_Z_LANG_TABLE) +extern const char* const MSG_PID_EXTRUDER_LANG_TABLE[1]; +#define MSG_PID_EXTRUDER LANG_TABLE_SELECT_EXPLICIT(MSG_PID_EXTRUDER_LANG_TABLE, 0) +extern const char* const MSG_PID_FINISHED_LANG_TABLE[1]; +#define MSG_PID_FINISHED LANG_TABLE_SELECT_EXPLICIT(MSG_PID_FINISHED_LANG_TABLE, 0) +extern const char* const MSG_PID_RUNNING_LANG_TABLE[1]; +#define MSG_PID_RUNNING LANG_TABLE_SELECT_EXPLICIT(MSG_PID_RUNNING_LANG_TABLE, 0) extern const char* const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1]; #define MSG_PLANNER_BUFFER_BYTES LANG_TABLE_SELECT_EXPLICIT(MSG_PLANNER_BUFFER_BYTES_LANG_TABLE, 0) extern const char* const MSG_PLEASE_WAIT_LANG_TABLE[LANG_NUM]; @@ -483,6 +491,8 @@ extern const char* const MSG_SET_HOME_OFFSETS_LANG_TABLE[1]; #define MSG_SET_HOME_OFFSETS LANG_TABLE_SELECT_EXPLICIT(MSG_SET_HOME_OFFSETS_LANG_TABLE, 0) extern const char* const MSG_SET_ORIGIN_LANG_TABLE[1]; #define MSG_SET_ORIGIN LANG_TABLE_SELECT_EXPLICIT(MSG_SET_ORIGIN_LANG_TABLE, 0) +extern const char* const MSG_SET_TEMPERATURE_LANG_TABLE[1]; +#define MSG_SET_TEMPERATURE LANG_TABLE_SELECT_EXPLICIT(MSG_SET_TEMPERATURE_LANG_TABLE, 0) extern const char* const MSG_SHOW_END_STOPS_LANG_TABLE[LANG_NUM]; #define MSG_SHOW_END_STOPS LANG_TABLE_SELECT(MSG_SHOW_END_STOPS_LANG_TABLE) extern const char* const MSG_SILENT_MODE_OFF_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index ab1450ea8..e4f2b9794 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -268,4 +268,9 @@ #define MSG_PRINTER_DISCONNECTED "Printer disconnected" #define MSG_FINISHING_MOVEMENTS "Finishing movements" #define MSG_PRINT_PAUSED "Print paused" -#define MSG_RESUMING_PRINT "Resuming print" \ No newline at end of file +#define MSG_RESUMING_PRINT "Resuming print" +#define MSG_PID_EXTRUDER "PID calibration" +#define MSG_SET_TEMPERATURE "Set temperature" +#define MSG_PID_FINISHED "PID cal. finished" +#define MSG_PID_RUNNING "PID cal. " +#define MSG_EEPROM_SAVING "Saving" \ No newline at end of file diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index d2f6e3f88..77ef6e989 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -51,7 +51,12 @@ float current_temperature_bed = 0.0; int redundant_temperature_raw = 0; float redundant_temperature = 0.0; #endif + + #ifdef PIDTEMP + float _Kp, _Ki, _Kd; + int pid_cycle, pid_number_of_cycles; + bool pid_tuning_finished = false; float Kp=DEFAULT_Kp; float Ki=(DEFAULT_Ki*PID_dT); float Kd=(DEFAULT_Kd/PID_dT); @@ -181,10 +186,12 @@ unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0); //============================= functions ============================ //=========================================================================== -void PID_autotune(float temp, int extruder, int ncycles) -{ + void PID_autotune(float temp, int extruder, int ncycles) + { + pid_number_of_cycles = ncycles; + pid_tuning_finished = false; float input = 0.0; - int cycles=0; + pid_cycle=0; bool heating = true; unsigned long temp_millis = millis(); @@ -195,7 +202,6 @@ void PID_autotune(float temp, int extruder, int ncycles) long bias, d; float Ku, Tu; - float Kp, Ki, Kd; float max = 0, min = 10000; #if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \ @@ -210,6 +216,8 @@ void PID_autotune(float temp, int extruder, int ncycles) #endif ){ SERIAL_ECHOLN("PID Autotune failed. Bad extruder number."); + pid_tuning_finished = true; + pid_cycle = 0; return; } @@ -267,7 +275,7 @@ void PID_autotune(float temp, int extruder, int ncycles) heating=true; t2=millis(); t_low=t2 - t1; - if(cycles > 0) { + if(pid_cycle > 0) { bias += (d*(t_high - t_low))/(t_low + t_high); bias = constrain(bias, 20 ,(extruder<0?(MAX_BED_POWER):(PID_MAX))-20); if(bias > (extruder<0?(MAX_BED_POWER):(PID_MAX))/2) d = (extruder<0?(MAX_BED_POWER):(PID_MAX)) - 1 - bias; @@ -277,33 +285,33 @@ void PID_autotune(float temp, int extruder, int ncycles) SERIAL_PROTOCOLPGM(" d: "); SERIAL_PROTOCOL(d); SERIAL_PROTOCOLPGM(" min: "); SERIAL_PROTOCOL(min); SERIAL_PROTOCOLPGM(" max: "); SERIAL_PROTOCOLLN(max); - if(cycles > 2) { + if(pid_cycle > 2) { Ku = (4.0*d)/(3.14159*(max-min)/2.0); Tu = ((float)(t_low + t_high)/1000.0); SERIAL_PROTOCOLPGM(" Ku: "); SERIAL_PROTOCOL(Ku); SERIAL_PROTOCOLPGM(" Tu: "); SERIAL_PROTOCOLLN(Tu); - Kp = 0.6*Ku; - Ki = 2*Kp/Tu; - Kd = Kp*Tu/8; + _Kp = 0.6*Ku; + _Ki = 2*_Kp/Tu; + _Kd = _Kp*Tu/8; SERIAL_PROTOCOLLNPGM(" Classic PID "); - SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp); - SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki); - SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd); + SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(_Kp); + SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(_Ki); + SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(_Kd); /* - Kp = 0.33*Ku; - Ki = Kp/Tu; - Kd = Kp*Tu/3; + _Kp = 0.33*Ku; + _Ki = _Kp/Tu; + _Kd = _Kp*Tu/3; SERIAL_PROTOCOLLNPGM(" Some overshoot "); - SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp); - SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki); - SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd); - Kp = 0.2*Ku; - Ki = 2*Kp/Tu; - Kd = Kp*Tu/3; + SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(_Kp); + SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(_Ki); + SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(_Kd); + _Kp = 0.2*Ku; + _Ki = 2*_Kp/Tu; + _Kd = _Kp*Tu/3; SERIAL_PROTOCOLLNPGM(" No overshoot "); - SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(Kp); - SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(Ki); - SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(Kd); + SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(_Kp); + SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(_Ki); + SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(_Kd); */ } } @@ -311,13 +319,15 @@ void PID_autotune(float temp, int extruder, int ncycles) soft_pwm_bed = (bias + d) >> 1; else soft_pwm[extruder] = (bias + d) >> 1; - cycles++; + pid_cycle++; min=temp; } } } if(input > (temp + 20)) { SERIAL_PROTOCOLLNPGM("PID Autotune failed! Temperature too high"); + pid_tuning_finished = true; + pid_cycle = 0; return; } if(millis() - temp_millis > 2000) { @@ -338,10 +348,14 @@ void PID_autotune(float temp, int extruder, int ncycles) } if(((millis() - t1) + (millis() - t2)) > (10L*60L*1000L*2L)) { SERIAL_PROTOCOLLNPGM("PID Autotune failed! timeout"); + pid_tuning_finished = true; + pid_cycle = 0; return; } - if(cycles > ncycles) { + if(pid_cycle > ncycles) { SERIAL_PROTOCOLLNPGM("PID Autotune finished! Put the last Kp, Ki and Kd constants from above into Configuration.h"); + pid_tuning_finished = true; + pid_cycle = 0; return; } lcd_update(); diff --git a/Firmware/temperature.h b/Firmware/temperature.h index 4a2e8bf96..547e35b80 100644 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -58,7 +58,9 @@ extern float current_temperature_bed; #endif #ifdef PIDTEMP - extern float Kp,Ki,Kd,Kc; + extern int pid_cycle, pid_number_of_cycles; + extern float Kp,Ki,Kd,Kc,_Kp,_Ki,_Kd; + extern bool pid_tuning_finished; float scalePID_i(float i); float scalePID_d(float d); float unscalePID_i(float i); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d8b746e7d..7b0e68421 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -106,6 +106,7 @@ int farm_status = 0; unsigned long allert_timer = millis(); bool printer_connected = true; +float pid_temp = DEFAULT_PID_TEMP; bool long_press_active = false; long long_press_timer = millis(); @@ -774,6 +775,47 @@ void lcd_commands() } } + if (lcd_commands_type == LCD_COMMAND_PID_EXTRUDER) { + char cmd1[30]; + unsigned long display_time; //just timer for showing pid finished message on lcd; + if (lcd_commands_step == 0) { + custom_message_type = 3; + custom_message_state = 1; + custom_message = true; + lcdDrawUpdate = 3; + lcd_commands_step = 3; + } + if (lcd_commands_step == 3 && !blocks_queued()) { //PID calibration + strcpy(cmd1, "M303 E0 S"); + strcat(cmd1, ftostr3(pid_temp)); + enquecommand(cmd1); + lcd_setstatuspgm(MSG_PID_RUNNING); + lcd_commands_step = 2; + } + if (lcd_commands_step == 2 && pid_tuning_finished) { //saving to eeprom + pid_tuning_finished = false; + custom_message_state = 0; + lcd_setstatuspgm(MSG_PID_FINISHED); + strcpy(cmd1, "M301 P"); + strcat(cmd1, ftostr32(_Kp)); + strcat(cmd1, " I"); + strcat(cmd1, ftostr32(_Ki)); + strcat(cmd1, " D"); + strcat(cmd1, ftostr32(_Kd)); + enquecommand(cmd1); + enquecommand_P(PSTR("M500")); + display_time = millis(); + lcd_commands_step = 1; + } + if ((lcd_commands_step == 1) && ((millis()- display_time)>2000)) { //calibration finished message + lcd_setstatuspgm(WELCOME_MSG); + custom_message_type = 0; + custom_message = false; + pid_temp = DEFAULT_PID_TEMP; + lcd_commands_step = 0; + lcd_commands_type = 0; + } + } } @@ -1510,6 +1552,25 @@ static void lcd_adjust_bed() END_MENU(); } +void pid_extruder() { + + lcd_implementation_clear(); + lcd.setCursor(1, 0); + lcd_printPGM(MSG_SET_TEMPERATURE); + pid_temp += int(encoderPosition); + if (pid_temp > HEATER_0_MAXTEMP) pid_temp = HEATER_0_MAXTEMP; + if (pid_temp < HEATER_0_MINTEMP) pid_temp = HEATER_0_MINTEMP; + encoderPosition = 0; + lcd.setCursor(1, 2); + lcd.print(ftostr3(pid_temp)); + if (lcd_clicked()) { + lcd_commands_type = LCD_COMMAND_PID_EXTRUDER; + lcd_return_to_status(); + lcd_update(2); + } + +} + void lcd_adjust_z() { int enc_dif = 0; int cursor_pos = 1; @@ -2539,6 +2600,7 @@ MENU_ITEM(function, MSG_CALIBRATE_BED, lcd_mesh_calibration); #endif MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28 W")); MENU_ITEM(submenu, MSG_BED_CORRECTION_MENU, lcd_adjust_bed); + MENU_ITEM(submenu, MSG_PID_EXTRUDER, pid_extruder); MENU_ITEM(submenu, MSG_SHOW_END_STOPS, menu_show_end_stops); MENU_ITEM(gcode, MSG_CALIBRATE_BED_RESET, PSTR("M44")); #ifndef SNMM diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 0334a38b6..4bfd692ab 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -93,6 +93,7 @@ void lcd_mylang(); #define LCD_COMMAND_FARM_MODE_CONFIRM 4 #define LCD_COMMAND_LONG_PAUSE 5 #define LCD_COMMAND_LONG_PAUSE_RESUME 6 + #define LCD_COMMAND_PID_EXTRUDER 7 extern unsigned long lcd_timeoutToStatus; extern int lcd_commands_type; diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index 25a17cdc3..c59cf4471 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -948,6 +948,17 @@ static void lcd_implementation_status_screen() { lcd.print(lcd_status_message); } + // PID tuning in progress + if (custom_message_type == 3) { + lcd.print(lcd_status_message); + if (pid_cycle <= pid_number_of_cycles && custom_message_state > 0) { + lcd.setCursor(10, 3); + lcd.print(itostr3(pid_cycle)); + + lcd.print('/'); + lcd.print(itostr3left(pid_number_of_cycles)); + } + } } else { From 6d9ab7109f0d3b62f96956d9733ad5b962b7372f Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 31 Mar 2017 17:20:05 +0200 Subject: [PATCH 30/49] fixed pid calibration finish status --- Firmware/ultralcd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7b0e68421..152890b88 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -106,6 +106,7 @@ int farm_status = 0; unsigned long allert_timer = millis(); bool printer_connected = true; +unsigned long display_time; //just timer for showing pid finished message on lcd; float pid_temp = DEFAULT_PID_TEMP; bool long_press_active = false; @@ -777,7 +778,7 @@ void lcd_commands() } if (lcd_commands_type == LCD_COMMAND_PID_EXTRUDER) { char cmd1[30]; - unsigned long display_time; //just timer for showing pid finished message on lcd; + if (lcd_commands_step == 0) { custom_message_type = 3; custom_message_state = 1; From 53938e2280e8778d48b7e55a148ab469624afc93 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 3 Apr 2017 11:03:10 +0200 Subject: [PATCH 31/49] added defines for long pause print, button long press and pid tuning --- .../variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 16 +++++++++++++++- .../variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 19 ++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 3464b94ad..9b48ddc20 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -54,6 +54,11 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define X_CANCEL_POS 50 #define Y_CANCEL_POS 190 +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) @@ -123,6 +128,9 @@ EXTRUDER SETTINGS #endif +//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function + + /*------------------------------------ CHANGE FILAMENT SETTINGS *------------------------------------*/ @@ -205,7 +213,7 @@ BED SETTINGS #define MESH_MEAS_NUM_Y_POINTS 3 #define MESH_HOME_Z_CALIB 0.2 -#define MESH_HOME_Z_SEARCH 5 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. #define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right #define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind @@ -366,4 +374,10 @@ THERMISTORS SETTINGS #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes #define PING_ALLERT_PERIOD 60 //time in s +#define LONG_PRESS_TIME 1000 //time in ms for button long press + +#define PAUSE_RETRACT 2 + +#define DEFAULT_PID_TEMP 210; + #endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 703e41005..9f6223e41 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -54,6 +54,11 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define X_CANCEL_POS 50 #define Y_CANCEL_POS 190 +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E #define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) @@ -110,6 +115,9 @@ EXTRUDER SETTINGS #define EXTRUDER_AUTO_FAN_TEMPERATURE 50 #define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + + // Prusa Single extruder multiple material suport //#define SNMM @@ -123,6 +131,9 @@ EXTRUDER SETTINGS #endif +//#define DIS //for measuring bed heigth and PINDa detection heigth relative to auto home point, experimental function + + /*------------------------------------ CHANGE FILAMENT SETTINGS *------------------------------------*/ @@ -205,7 +216,7 @@ BED SETTINGS #define MESH_MEAS_NUM_Y_POINTS 3 #define MESH_HOME_Z_CALIB 0.2 -#define MESH_HOME_Z_SEARCH 5 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. #define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right #define Y_PROBE_OFFSET_FROM_EXTRUDER 9 // Z probe to nozzle Y offset: -front +behind @@ -366,4 +377,10 @@ THERMISTORS SETTINGS #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes #define PING_ALLERT_PERIOD 60 //time in s +#define LONG_PRESS_TIME 1000 //time in ms for button long press + +#define PAUSE_RETRACT 2 + +#define DEFAULT_PID_TEMP 210; + #endif //__CONFIGURATION_PRUSA_H From 7086764d356070e7365ddf5c91dce26dccf4fda2 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 3 Apr 2017 15:28:03 +0200 Subject: [PATCH 32/49] different preheat error messages for bed and hotend --- Firmware/Configuration.h | 2 +- Firmware/temperature.cpp | 14 +++++++------- Firmware/temperature.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 25511f1f3..3c31d88eb 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -5,7 +5,7 @@ #include "Configuration_prusa.h" // Firmware version -#define FW_version "3.0.10-8" +#define FW_version "3.0.10-9" #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10 diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 77ef6e989..d8b0b61a8 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1134,7 +1134,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren if (__preheat_errors > 5) { if (farm_mode) { prusa_statistics(0); } - temp_runaway_stop(true); + temp_runaway_stop(true, _isbed); if (farm_mode) { prusa_statistics(91); } } __preheat_start = _current_temperature; @@ -1171,7 +1171,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren if (temp_runaway_error_counter[_heater_id] * 2 > __timeout) { if (farm_mode) { prusa_statistics(0); } - temp_runaway_stop(false); + temp_runaway_stop(false, _isbed); if (farm_mode) { prusa_statistics(90); } } } @@ -1181,7 +1181,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren } } -void temp_runaway_stop(bool isPreheat) +void temp_runaway_stop(bool isPreheat, bool isBed) { cancel_heatup = true; quickStop(); @@ -1207,9 +1207,9 @@ void temp_runaway_stop(bool isPreheat) if (isPreheat) { Stop(); - LCD_ALERTMESSAGEPGM(" PREHEAT ERROR"); + isBed ? LCD_ALERTMESSAGEPGM("BED PREHEAT ERROR") : LCD_ALERTMESSAGEPGM("PREHEAT ERROR"); SERIAL_ERROR_START; - SERIAL_ERRORLNPGM(": THERMAL RUNAWAY ( PREHEAT )"); + isBed ? SERIAL_ERRORLNPGM(" THERMAL RUNAWAY ( PREHEAT HEATBED)") : SERIAL_ERRORLNPGM(" THERMAL RUNAWAY ( PREHEAT HOTEND)"); SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN); SET_OUTPUT(FAN_PIN); WRITE(EXTRUDER_0_AUTO_FAN_PIN, 1); @@ -1219,9 +1219,9 @@ void temp_runaway_stop(bool isPreheat) } else { - LCD_ALERTMESSAGEPGM("THERMAL RUNAWAY"); + isBed ? LCD_ALERTMESSAGEPGM("BED THERMAL RUNAWAY") : LCD_ALERTMESSAGEPGM("THERMAL RUNAWAY"); SERIAL_ERROR_START; - SERIAL_ERRORLNPGM(": THERMAL RUNAWAY"); + isBed ? SERIAL_ERRORLNPGM(" HEATBED THERMAL RUNAWAY") : SERIAL_ERRORLNPGM(" HOTEND THERMAL RUNAWAY"); } } #endif diff --git a/Firmware/temperature.h b/Firmware/temperature.h index 547e35b80..9e2a03cd7 100644 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -182,7 +182,7 @@ static float temp_runaway_timer[4]; static int temp_runaway_error_counter[4]; void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed); -void temp_runaway_stop(bool isPreheat); +void temp_runaway_stop(bool isPreheat, bool isBed); #endif int getHeaterPower(int heater); From d9fc29273eb1e279baa1767ded4bafadb6a339bd Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Tue, 4 Apr 2017 13:41:20 +0200 Subject: [PATCH 33/49] statistics for stop print changed --- Firmware/ultralcd.cpp | 2 +- Firmware/ultralcd_implementation_hitachi_HD44780.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 152890b88..746051272 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -545,7 +545,7 @@ void lcd_commands() enquecommand(cmd1); isPrintPaused = false; card.startFileprint(); - starttime = pause_time; + //starttime = pause_time; lcd_commands_step = 0; lcd_commands_type = 0; } diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index c59cf4471..2cee3d9ce 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -792,7 +792,7 @@ static void lcd_implementation_status_screen() lcd.print(LCD_STR_CLOCK[0]); if(starttime != 0) { - uint16_t time = isPrintPaused ? pause_time/60000 : millis()/60000 - starttime/60000; //is print is paused, pause also print time + uint16_t time = (isPrintPaused || (!heating_status))? pause_time/60000 : (millis() + pause_time - start_time)/60000; //is print is paused, pause also print time lcd.print(itostr2(time/60)); lcd.print(':'); lcd.print(itostr2(time%60)); From 56f597508308bd7a59513e4d3116c282d10edd23 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 5 Apr 2017 18:35:26 +0200 Subject: [PATCH 34/49] XYZ calibration first round: if least square error is bigger than threshold value, run another iteration --- Firmware/language_all.cpp | 5 + Firmware/language_all.h | 2 + Firmware/language_en.h | 1 + Firmware/mesh_bed_calibration.cpp | 358 +++++++++++------- .../ultralcd_implementation_hitachi_HD44780.h | 2 +- 5 files changed, 234 insertions(+), 134 deletions(-) diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 87c7bf513..0ea7e456f 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -971,6 +971,11 @@ const char * const MSG_FIL_TUNING_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_FIL_TUNING_DE }; +const char MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_EN[] PROGMEM = "Iteration "; +const char * const MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_LANG_TABLE[1] PROGMEM = { + MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_EN +}; + const char MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_EN[] PROGMEM = "Searching bed calibration point"; const char MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_CZ[] PROGMEM = "Hledam kalibracni bod podlozky"; const char MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_IT[] PROGMEM = "Ricerca del letto punto di calibraz."; diff --git a/Firmware/language_all.h b/Firmware/language_all.h index aa1ee4256..7425b6db2 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -203,6 +203,8 @@ extern const char* const MSG_FIL_LOADED_CHECK_LANG_TABLE[LANG_NUM]; #define MSG_FIL_LOADED_CHECK LANG_TABLE_SELECT(MSG_FIL_LOADED_CHECK_LANG_TABLE) extern const char* const MSG_FIL_TUNING_LANG_TABLE[LANG_NUM]; #define MSG_FIL_TUNING LANG_TABLE_SELECT(MSG_FIL_TUNING_LANG_TABLE) +extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_LANG_TABLE[1]; +#define MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION LANG_TABLE_SELECT_EXPLICIT(MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION_LANG_TABLE, 0) extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE[LANG_NUM]; #define MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE) extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index e4f2b9794..8212e4f2f 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -208,6 +208,7 @@ #define(length=14) MSG_IMPROVE_BED_OFFSET_AND_SKEW_LINE2 " of 9" #define(length=60) MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1 "Measuring reference height of calibration point" #define(length=14) MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2 " of 9" +#define(length=20) MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION "Iteration " #define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND "XYZ calibration failed. Bed calibration point was not found." #define(length=20,lines=8) MSG_BED_SKEW_OFFSET_DETECTION_FITTING_FAILED "XYZ calibration failed. Please consult the manual." diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 38eb41c69..eaf4ab8db 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -383,6 +383,10 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( MYSERIAL.print(pgm_read_float(true_pts + i * 2 + 1), 5); SERIAL_ECHOPGM("), error: "); MYSERIAL.print(err); + SERIAL_ECHOPGM(", error X: "); + MYSERIAL.print(errX); + SERIAL_ECHOPGM(", error Y: "); + MYSERIAL.print(errY); SERIAL_ECHOLNPGM(""); } } @@ -1586,11 +1590,51 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level float *vec_y = vec_x + 2; float *cntr = vec_y + 2; memset(pts, 0, sizeof(float) * 7 * 7); + uint8_t iteration = 0; + BedSkewOffsetDetectionResultType result; // SERIAL_ECHOLNPGM("find_bed_offset_and_skew verbosity level: "); // SERIAL_ECHO(int(verbosity_level)); // SERIAL_ECHOPGM(""); + while (iteration < 3) { + + SERIAL_ECHOPGM("Iteration: "); + MYSERIAL.println(int(iteration + 1)); + + if (iteration > 0) { + // Cache the current correction matrix. + world2machine_initialize(); + vec_x[0] = world2machine_rotation_and_skew[0][0]; + vec_x[1] = world2machine_rotation_and_skew[1][0]; + vec_y[0] = world2machine_rotation_and_skew[0][1]; + vec_y[1] = world2machine_rotation_and_skew[1][1]; + cntr[0] = world2machine_shift[0]; + cntr[1] = world2machine_shift[1]; + if (verbosity_level >= 20) { + SERIAL_ECHOPGM("vec_x[0]:"); + MYSERIAL.print(vec_x[0], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("vec_x[1]:"); + MYSERIAL.print(vec_x[1], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("vec_y[0]:"); + MYSERIAL.print(vec_y[0], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("vec_y[1]:"); + MYSERIAL.print(vec_y[1], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("cntr[0]:"); + MYSERIAL.print(cntr[0], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("cntr[1]:"); + MYSERIAL.print(cntr[1], 5); + SERIAL_ECHOLNPGM(""); + } + // and reset the correction matrix, so the planner will not do anything. + world2machine_reset(); + } + #ifdef MESH_BED_CALIBRATION_SHOW_LCD uint8_t next_line; lcd_display_message_fullscreen_P(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1, next_line); @@ -1600,144 +1644,192 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level // Collect the rear 2x3 points. current_position[Z_AXIS] = MESH_HOME_Z_SEARCH; - for (int k = 0; k < 4; ++ k) { - // Don't let the manage_inactivity() function remove power from the motors. - refresh_cmd_timeout(); + for (int k = 0; k < 4; ++k) { + // Don't let the manage_inactivity() function remove power from the motors. + refresh_cmd_timeout(); #ifdef MESH_BED_CALIBRATION_SHOW_LCD - lcd_implementation_print_at(0, next_line, k+1); - lcd_printPGM(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2); -#endif /* MESH_BED_CALIBRATION_SHOW_LCD */ - float *pt = pts + k * 2; - // Go up to z_initial. - go_to_current(homing_feedrate[Z_AXIS] / 60.f); - if (verbosity_level >= 20) { - // Go to Y0, wait, then go to Y-4. - current_position[Y_AXIS] = 0.f; - go_to_current(homing_feedrate[X_AXIS] / 60.f); - SERIAL_ECHOLNPGM("At Y0"); - delay_keep_alive(5000); - current_position[Y_AXIS] = Y_MIN_POS; - go_to_current(homing_feedrate[X_AXIS] / 60.f); - SERIAL_ECHOLNPGM("At Y-4"); - delay_keep_alive(5000); - } - // Go to the measurement point position. - current_position[X_AXIS] = pgm_read_float(bed_ref_points_4+k*2); - current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4+k*2+1); - go_to_current(homing_feedrate[X_AXIS] / 60.f); - if (verbosity_level >= 10) - delay_keep_alive(3000); - if (! find_bed_induction_sensor_point_xy()) - return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; -#if 1 - if (k == 0) { - // Improve the position of the 1st row sensor points by a zig-zag movement. - find_bed_induction_sensor_point_z(); - int8_t i = 4; - for (;;) { - if (improve_bed_induction_sensor_point3(verbosity_level)) - break; - if (-- i == 0) - return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; - // Try to move the Z axis down a bit to increase a chance of the sensor to trigger. - current_position[Z_AXIS] -= 0.025f; - enable_endstops(false); - enable_z_endstop(false); - go_to_current(homing_feedrate[Z_AXIS]); - } - if (i == 0) - // not found - return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; - } -#endif - if (verbosity_level >= 10) - delay_keep_alive(3000); - // Save the detected point position and then clamp the Y coordinate, which may have been estimated - // to lie outside the machine working space. - pt[0] = current_position[X_AXIS]; - pt[1] = current_position[Y_AXIS]; - if (current_position[Y_AXIS] < Y_MIN_POS) - current_position[Y_AXIS] = Y_MIN_POS; - // Start searching for the other points at 3mm above the last point. - current_position[Z_AXIS] += 3.f; - cntr[0] += pt[0]; - cntr[1] += pt[1]; - if (verbosity_level >= 10 && k == 0) { - // Show the zero. Test, whether the Y motor skipped steps. - current_position[Y_AXIS] = MANUAL_Y_HOME_POS; - go_to_current(homing_feedrate[X_AXIS] / 60.f); - delay_keep_alive(3000); - } - } + lcd_implementation_print_at(0, next_line, k + 1); + lcd_printPGM(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2); - if (verbosity_level >= 20) { - // Test the positions. Are the positions reproducible? Now the calibration is active in the planner. - delay_keep_alive(3000); - for (int8_t mesh_point = 0; mesh_point < 4; ++ mesh_point) { - // Don't let the manage_inactivity() function remove power from the motors. - refresh_cmd_timeout(); - // Go to the measurement point. - // Use the coorrected coordinate, which is a result of find_bed_offset_and_skew(). - current_position[X_AXIS] = pts[mesh_point*2]; - current_position[Y_AXIS] = pts[mesh_point*2+1]; - go_to_current(homing_feedrate[X_AXIS]/60); - delay_keep_alive(3000); - } - } - - BedSkewOffsetDetectionResultType result = calculate_machine_skew_and_offset_LS(pts, 4, bed_ref_points_4, vec_x, vec_y, cntr, verbosity_level); - if (result >= 0) { - world2machine_update(vec_x, vec_y, cntr); - #if 1 - // Fearlessly store the calibration values into the eeprom. - eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_CENTER+0), cntr [0]); - eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_CENTER+4), cntr [1]); - eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +0), vec_x[0]); - eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_X +4), vec_x[1]); - eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +0), vec_y[0]); - eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y +4), vec_y[1]); - #endif - if (verbosity_level >= 10) { - // Length of the vec_x - float l = sqrt(vec_x[0] * vec_x[0] + vec_x[1] * vec_x[1]); - SERIAL_ECHOLNPGM("X vector length:"); - MYSERIAL.println(l); - - // Length of the vec_y - l = sqrt(vec_y[0] * vec_y[0] + vec_y[1] * vec_y[1]); - SERIAL_ECHOLNPGM("Y vector length:"); - MYSERIAL.println(l); - // Zero point correction - l = sqrt(cntr[0] * cntr[0] + cntr[1] * cntr[1]); - SERIAL_ECHOLNPGM("Zero point correction:"); - MYSERIAL.println(l); - - // vec_x and vec_y shall be nearly perpendicular. - l = vec_x[0] * vec_y[0] + vec_x[1] * vec_y[1]; - SERIAL_ECHOLNPGM("Perpendicularity"); - MYSERIAL.println(fabs(l)); - SERIAL_ECHOLNPGM("Saving bed calibration vectors to EEPROM"); + if (iteration > 0) { + lcd_print_at_PGM(0, next_line + 1, MSG_FIND_BED_OFFSET_AND_SKEW_ITERATION); + lcd_implementation_print(int(iteration + 1)); } - // Correct the current_position to match the transformed coordinate system after world2machine_rotation_and_skew and world2machine_shift were set. - world2machine_update_current(); +#endif /* MESH_BED_CALIBRATION_SHOW_LCD */ + float *pt = pts + k * 2; + // Go up to z_initial. - if (verbosity_level >= 20) { - // Test the positions. Are the positions reproducible? Now the calibration is active in the planner. - delay_keep_alive(3000); - for (int8_t mesh_point = 0; mesh_point < 9; ++ mesh_point) { - // Don't let the manage_inactivity() function remove power from the motors. - refresh_cmd_timeout(); - // Go to the measurement point. - // Use the coorrected coordinate, which is a result of find_bed_offset_and_skew(). - current_position[X_AXIS] = pgm_read_float(bed_ref_points+mesh_point*2); - current_position[Y_AXIS] = pgm_read_float(bed_ref_points+mesh_point*2+1); - go_to_current(homing_feedrate[X_AXIS]/60); - delay_keep_alive(3000); - } - } - } + go_to_current(homing_feedrate[Z_AXIS] / 60.f); + if (verbosity_level >= 20) { + // Go to Y0, wait, then go to Y-4. + current_position[Y_AXIS] = 0.f; + go_to_current(homing_feedrate[X_AXIS] / 60.f); + SERIAL_ECHOLNPGM("At Y0"); + delay_keep_alive(5000); + current_position[Y_AXIS] = Y_MIN_POS; + go_to_current(homing_feedrate[X_AXIS] / 60.f); + SERIAL_ECHOLNPGM("At Y-4"); + delay_keep_alive(5000); + } + // Go to the measurement point position. + if (iteration == 0) { + current_position[X_AXIS] = pgm_read_float(bed_ref_points_4 + k * 2); + current_position[Y_AXIS] = pgm_read_float(bed_ref_points_4 + k * 2 + 1); + } + else { + // if first iteration failed, count corrected point coordinates as initial + // Use the coorrected coordinate, which is a result of find_bed_offset_and_skew(). + + current_position[X_AXIS] = vec_x[0] * pgm_read_float(bed_ref_points_4 + k * 2) + vec_y[0] * pgm_read_float(bed_ref_points_4 + k * 2 + 1) + cntr[0]; + current_position[Y_AXIS] = vec_x[1] * pgm_read_float(bed_ref_points_4 + k * 2) + vec_y[1] * pgm_read_float(bed_ref_points_4 + k * 2 + 1) + cntr[1]; - return result; + // The calibration points are very close to the min Y. + if (current_position[Y_AXIS] < Y_MIN_POS_FOR_BED_CALIBRATION) + current_position[Y_AXIS] = Y_MIN_POS_FOR_BED_CALIBRATION; + + } + if (verbosity_level >= 20) { + SERIAL_ECHOPGM("corrected current_position[X_AXIS]:"); + MYSERIAL.print(current_position[X_AXIS], 5); + SERIAL_ECHOLNPGM(""); + SERIAL_ECHOPGM("corrected current_position[Y_AXIS]:"); + MYSERIAL.print(current_position[Y_AXIS], 5); + SERIAL_ECHOLNPGM(""); + } + + + go_to_current(homing_feedrate[X_AXIS] / 60.f); + if (verbosity_level >= 10) + delay_keep_alive(3000); + if (!find_bed_induction_sensor_point_xy()) + return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; +#if 1 + + if (k == 0) { + // Improve the position of the 1st row sensor points by a zig-zag movement. + find_bed_induction_sensor_point_z(); + int8_t i = 4; + for (;;) { + if (improve_bed_induction_sensor_point3(verbosity_level)) + break; + if (--i == 0) + return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; + // Try to move the Z axis down a bit to increase a chance of the sensor to trigger. + current_position[Z_AXIS] -= 0.025f; + enable_endstops(false); + enable_z_endstop(false); + go_to_current(homing_feedrate[Z_AXIS]); + } + if (i == 0) + // not found + return BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND; + } +#endif + if (verbosity_level >= 10) + delay_keep_alive(3000); + // Save the detected point position and then clamp the Y coordinate, which may have been estimated + // to lie outside the machine working space. + if (verbosity_level >= 20) { + SERIAL_ECHOLNPGM("Measured:"); + MYSERIAL.println(current_position[X_AXIS]); + MYSERIAL.println(current_position[Y_AXIS]); + } + //pt[0] = (pt[0] * iteration) / (iteration + 1); + //pt[0] += (current_position[X_AXIS]/(iteration + 1)); //count average + //pt[1] = (pt[1] * iteration) / (iteration + 1); + //pt[1] += (current_position[Y_AXIS] / (iteration + 1)); + + + pt[0] += current_position[X_AXIS]; + if(iteration > 0) pt[0] = pt[0] / 2; + + pt[1] += current_position[Y_AXIS]; + if (iteration > 0) pt[1] = pt[1] / 2; + + if (current_position[Y_AXIS] < Y_MIN_POS) + current_position[Y_AXIS] = Y_MIN_POS; + // Start searching for the other points at 3mm above the last point. + current_position[Z_AXIS] += 3.f; + //cntr[0] += pt[0]; + //cntr[1] += pt[1]; + if (verbosity_level >= 10 && k == 0) { + // Show the zero. Test, whether the Y motor skipped steps. + current_position[Y_AXIS] = MANUAL_Y_HOME_POS; + go_to_current(homing_feedrate[X_AXIS] / 60.f); + delay_keep_alive(3000); + } + } + + if (verbosity_level >= 20) { + // Test the positions. Are the positions reproducible? Now the calibration is active in the planner. + delay_keep_alive(3000); + for (int8_t mesh_point = 0; mesh_point < 4; ++mesh_point) { + // Don't let the manage_inactivity() function remove power from the motors. + refresh_cmd_timeout(); + // Go to the measurement point. + // Use the coorrected coordinate, which is a result of find_bed_offset_and_skew(). + current_position[X_AXIS] = pts[mesh_point * 2]; + current_position[Y_AXIS] = pts[mesh_point * 2 + 1]; + go_to_current(homing_feedrate[X_AXIS] / 60); + delay_keep_alive(3000); + } + } + + result = calculate_machine_skew_and_offset_LS(pts, 4, bed_ref_points_4, vec_x, vec_y, cntr, verbosity_level); + if (result >= 0) { + world2machine_update(vec_x, vec_y, cntr); +#if 1 + // Fearlessly store the calibration values into the eeprom. + eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 0), cntr[0]); + eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 4), cntr[1]); + eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_X + 0), vec_x[0]); + eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_X + 4), vec_x[1]); + eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y + 0), vec_y[0]); + eeprom_update_float((float*)(EEPROM_BED_CALIBRATION_VEC_Y + 4), vec_y[1]); +#endif + if (verbosity_level >= 10) { + // Length of the vec_x + float l = sqrt(vec_x[0] * vec_x[0] + vec_x[1] * vec_x[1]); + SERIAL_ECHOLNPGM("X vector length:"); + MYSERIAL.println(l); + + // Length of the vec_y + l = sqrt(vec_y[0] * vec_y[0] + vec_y[1] * vec_y[1]); + SERIAL_ECHOLNPGM("Y vector length:"); + MYSERIAL.println(l); + // Zero point correction + l = sqrt(cntr[0] * cntr[0] + cntr[1] * cntr[1]); + SERIAL_ECHOLNPGM("Zero point correction:"); + MYSERIAL.println(l); + + // vec_x and vec_y shall be nearly perpendicular. + l = vec_x[0] * vec_y[0] + vec_x[1] * vec_y[1]; + SERIAL_ECHOLNPGM("Perpendicularity"); + MYSERIAL.println(fabs(l)); + SERIAL_ECHOLNPGM("Saving bed calibration vectors to EEPROM"); + } + // Correct the current_position to match the transformed coordinate system after world2machine_rotation_and_skew and world2machine_shift were set. + world2machine_update_current(); + + if (verbosity_level >= 20) { + // Test the positions. Are the positions reproducible? Now the calibration is active in the planner. + delay_keep_alive(3000); + for (int8_t mesh_point = 0; mesh_point < 9; ++mesh_point) { + // Don't let the manage_inactivity() function remove power from the motors. + refresh_cmd_timeout(); + // Go to the measurement point. + // Use the coorrected coordinate, which is a result of find_bed_offset_and_skew(). + current_position[X_AXIS] = pgm_read_float(bed_ref_points + mesh_point * 2); + current_position[Y_AXIS] = pgm_read_float(bed_ref_points + mesh_point * 2 + 1); + go_to_current(homing_feedrate[X_AXIS] / 60); + delay_keep_alive(3000); + } + } + return result; + } + iteration++; + } + return result; } BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8_t verbosity_level, uint8_t &too_far_mask) diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index 2cee3d9ce..fd8397c60 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -792,7 +792,7 @@ static void lcd_implementation_status_screen() lcd.print(LCD_STR_CLOCK[0]); if(starttime != 0) { - uint16_t time = (isPrintPaused || (!heating_status))? pause_time/60000 : (millis() + pause_time - start_time)/60000; //is print is paused, pause also print time + uint16_t time = (isPrintPaused || (!heating_status))? pause_time/60000 : (millis() + pause_time /*- start_time*/)/60000; //is print is paused, pause also print time lcd.print(itostr2(time/60)); lcd.print(':'); lcd.print(itostr2(time%60)); From abadaa5885979c8627edaf283ac5d33b0e756168 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 6 Apr 2017 13:14:30 +0200 Subject: [PATCH 35/49] added retraction to preheat, no waiting when running mesh bed leveling from calibration menu --- Firmware/Marlin_main.cpp | 14 ++++++++++---- Firmware/language_all.cpp | 5 +++++ Firmware/language_all.h | 2 ++ Firmware/language_en.h | 1 + Firmware/language_it.h | 3 ++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 8a944aa77..d10450c7f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2894,9 +2894,9 @@ void process_commands() repeatcommand_front(); // repeat G80 with all its parameters enquecommand_front_P((PSTR("G28 W0"))); break; - } + } - if (run == false) { + if (run == false && card.sdprinting == true) { temp_compensation_start(); run = true; repeatcommand_front(); // repeat G80 with all its parameters @@ -3108,6 +3108,11 @@ void process_commands() SERIAL_ECHOLNPGM("Mesh bed leveling activated"); go_home_with_z_lift(); SERIAL_ECHOLNPGM("Go home finished"); + //unretract (after PINDA preheat retraction) + if (card.sdprinting == true && degHotend(active_extruder) > EXTRUDE_MINTEMP) { + current_position[E_AXIS] += DEFAULT_RETRACTION; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder); + } // Restore custom message state custom_message = custom_message_old; custom_message_type = custom_message_type_old; @@ -6208,6 +6213,9 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ #endif void temp_compensation_start() { + if (degHotend(active_extruder)>EXTRUDE_MINTEMP) current_position[E_AXIS] -= DEFAULT_RETRACTION; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder); + current_position[X_AXIS] = PINDA_PREHEAT_X; current_position[Y_AXIS] = PINDA_PREHEAT_Y; current_position[Z_AXIS] = 0; @@ -6217,8 +6225,6 @@ void temp_compensation_start() { while (fabs(degBed() - target_temperature_bed) > 3) delay_keep_alive(1000); for(int i = 0; i < PINDA_HEAT_T; i++) delay_keep_alive(1000); - - } void temp_compensation_apply() { diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 8adb002c0..eddaa8ef2 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -1741,6 +1741,11 @@ const char * const MSG_PINDA_NOT_CALIBRATED_LANG_TABLE[1] PROGMEM = { MSG_PINDA_NOT_CALIBRATED_EN }; +const char MSG_PINDA_PREHEAT_EN[] PROGMEM = "Preheating"; +const char * const MSG_PINDA_PREHEAT_LANG_TABLE[1] PROGMEM = { + MSG_PINDA_PREHEAT_EN +}; + const char MSG_PLANNER_BUFFER_BYTES_EN[] PROGMEM = " PlannerBufferBytes: "; const char * const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1] PROGMEM = { MSG_PLANNER_BUFFER_BYTES_EN diff --git a/Firmware/language_all.h b/Firmware/language_all.h index 1386a7602..a49d098e1 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -347,6 +347,8 @@ extern const char* const MSG_PICK_Z_LANG_TABLE[LANG_NUM]; #define MSG_PICK_Z LANG_TABLE_SELECT(MSG_PICK_Z_LANG_TABLE) extern const char* const MSG_PINDA_NOT_CALIBRATED_LANG_TABLE[1]; #define MSG_PINDA_NOT_CALIBRATED LANG_TABLE_SELECT_EXPLICIT(MSG_PINDA_NOT_CALIBRATED_LANG_TABLE, 0) +extern const char* const MSG_PINDA_PREHEAT_LANG_TABLE[1]; +#define MSG_PINDA_PREHEAT LANG_TABLE_SELECT_EXPLICIT(MSG_PINDA_PREHEAT_LANG_TABLE, 0) extern const char* const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1]; #define MSG_PLANNER_BUFFER_BYTES LANG_TABLE_SELECT_EXPLICIT(MSG_PLANNER_BUFFER_BYTES_LANG_TABLE, 0) extern const char* const MSG_PLEASE_WAIT_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index be262e261..3793f8b70 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -268,3 +268,4 @@ #define MSG_CALIBRATE_PINDA "Calibrate PINDA" #define MSG_PINDA_NOT_CALIBRATED "PINDA probe has not been calibrated" +#define MSG_PINDA_PREHEAT "Preheating" \ No newline at end of file diff --git a/Firmware/language_it.h b/Firmware/language_it.h index dc9e2a3a2..fcb40120d 100644 --- a/Firmware/language_it.h +++ b/Firmware/language_it.h @@ -248,4 +248,5 @@ #define MSG_WAITING_TEMP "In attesa del raffreddamento della testina e del piatto" #define MSG_FILAMENT_CLEAN "Il colore e' nitido?" #define MSG_UNLOADING_FILAMENT "Rilasc. filamento" -#define MSG_PAPER "Porre un foglio sotto l'ugello durante la calibrazione dei primi 4 punti. In caso l'ugello muova il foglio spegnere prontamente la stampante." \ No newline at end of file +#define MSG_PAPER "Porre un foglio sotto l'ugello durante la calibrazione dei primi 4 punti. In caso l'ugello muova il foglio spegnere prontamente la stampante." + From 08a59f7fef61faea8bf3a00ea1bdda10ad69eead Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 6 Apr 2017 18:57:11 +0200 Subject: [PATCH 36/49] status messages for temp calibration added, initial versoin of temp calibration on/off from menu --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 52 +++++++++++++------ Firmware/language_all.cpp | 29 ++++++++++- Firmware/language_all.h | 10 ++++ Firmware/language_en.h | 11 ++-- Firmware/ultralcd.cpp | 24 ++++++++- Firmware/ultralcd.h | 4 +- .../ultralcd_implementation_hitachi_HD44780.h | 16 ++++++ 8 files changed, 122 insertions(+), 25 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index c9a20ac8d..82e40a9ee 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -284,6 +284,7 @@ extern unsigned long starttime; extern unsigned long stoptime; extern bool is_usb_printing; extern bool homing_flag; +extern bool temp_cal_active; extern bool loading_flag; extern unsigned int usb_printing_counter; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d10450c7f..4abe0ba17 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -250,6 +250,8 @@ int extruder_multiply[EXTRUDERS] = {100 bool is_usb_printing = false; bool homing_flag = false; +bool temp_cal_active = false; + unsigned long kicktime = millis()+100000; unsigned int usb_printing_counter; @@ -2750,18 +2752,6 @@ void process_commands() } break; - /** - * G80: Mesh-based Z probe, probes a grid and produces a - * mesh to compensate for variable bed height - * - * The S0 report the points as below - * - * +----> X-axis - * | - * | - * v Y-axis - * - */ case 76: //PINDA probe temperature calibration { @@ -2777,7 +2767,11 @@ void process_commands() repeatcommand_front(); // repeat G76 with all its parameters enquecommand_front_P((PSTR("G28 W0"))); break; - } + } + custom_message = true; + custom_message_type = 4; + custom_message_state = 1; + custom_message = MSG_TEMP_CALIBRATION; current_position[X_AXIS] = PINDA_PREHEAT_X; current_position[Y_AXIS] = PINDA_PREHEAT_Y; current_position[Z_AXIS] = 0; @@ -2807,7 +2801,7 @@ void process_commands() SERIAL_ECHOLNPGM(""); for (int i = 0; i<5; i++) { - + custom_message_state = i + 2; t_c = 60 + i * 10; setTargetBed(t_c); @@ -2838,7 +2832,14 @@ void process_commands() } + custom_message_type = 0; + custom_message = false; + calibration_status_store(CALIBRATION_STATUS_CALIBRATED); + lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CALIBRATION_DONE); + lcd_update_enable(true); + lcd_update(2); + setTargetBed(0); //set bed target temperature back to 0 } @@ -2874,6 +2875,18 @@ void process_commands() #endif + /** + * G80: Mesh-based Z probe, probes a grid and produces a + * mesh to compensate for variable bed height + * + * The S0 report the points as below + * + * +----> X-axis + * | + * | + * v Y-axis + * + */ case 80: case_G80: @@ -2896,7 +2909,7 @@ void process_commands() break; } - if (run == false && card.sdprinting == true) { + if (run == false && card.sdprinting == true && temp_cal_active == true) { temp_compensation_start(); run = true; repeatcommand_front(); // repeat G80 with all its parameters @@ -3043,7 +3056,7 @@ void process_commands() } clean_up_after_endstop_move(); SERIAL_ECHOLNPGM("clean up finished "); - temp_compensation_apply(); //apply PINDA temperature compensation + if(temp_cal_active == true) temp_compensation_apply(); //apply PINDA temperature compensation babystep_apply(); // Apply Z height correction aka baby stepping before mesh bed leveing gets activated. SERIAL_ECHOLNPGM("babystep applied"); bool eeprom_bed_correction_valid = eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1; @@ -3109,7 +3122,7 @@ void process_commands() go_home_with_z_lift(); SERIAL_ECHOLNPGM("Go home finished"); //unretract (after PINDA preheat retraction) - if (card.sdprinting == true && degHotend(active_extruder) > EXTRUDE_MINTEMP) { + if (card.sdprinting == true && degHotend(active_extruder) > EXTRUDE_MINTEMP && temp_cal_active == true) { current_position[E_AXIS] += DEFAULT_RETRACTION; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder); } @@ -6213,6 +6226,8 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ #endif void temp_compensation_start() { + custom_message = true; + custom_message_type = 5; if (degHotend(active_extruder)>EXTRUDE_MINTEMP) current_position[E_AXIS] -= DEFAULT_RETRACTION; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder); @@ -6225,6 +6240,9 @@ void temp_compensation_start() { while (fabs(degBed() - target_temperature_bed) > 3) delay_keep_alive(1000); for(int i = 0; i < PINDA_HEAT_T; i++) delay_keep_alive(1000); + + custom_message_type = 0; + custom_message = false; } void temp_compensation_apply() { diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index eddaa8ef2..a9a79a78d 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -494,11 +494,16 @@ const char * const MSG_CALIBRATE_E_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_CALIBRATE_E_DE }; -const char MSG_CALIBRATE_PINDA_EN[] PROGMEM = "Calibrate PINDA"; +const char MSG_CALIBRATE_PINDA_EN[] PROGMEM = "Temp. calibration"; const char * const MSG_CALIBRATE_PINDA_LANG_TABLE[1] PROGMEM = { MSG_CALIBRATE_PINDA_EN }; +const char MSG_CALIBRATION_PINDA_MENU_EN[] PROGMEM = "Temp. calibration"; +const char * const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[1] PROGMEM = { + MSG_CALIBRATION_PINDA_MENU_EN +}; + const char MSG_CARD_MENU_EN[] PROGMEM = "Print from SD"; const char MSG_CARD_MENU_CZ[] PROGMEM = "Tisk z SD"; const char MSG_CARD_MENU_IT[] PROGMEM = "Stampa da SD"; @@ -1736,7 +1741,7 @@ const char * const MSG_PICK_Z_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_PICK_Z_DE }; -const char MSG_PINDA_NOT_CALIBRATED_EN[] PROGMEM = "PINDA probe has not been calibrated"; +const char MSG_PINDA_NOT_CALIBRATED_EN[] PROGMEM = "Temperature calibration has not been run yet"; const char * const MSG_PINDA_NOT_CALIBRATED_LANG_TABLE[1] PROGMEM = { MSG_PINDA_NOT_CALIBRATED_EN }; @@ -2693,6 +2698,26 @@ const char * const MSG_TEMPERATURE_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_TEMPERATURE_DE }; +const char MSG_TEMP_CALIBRATION_EN[] PROGMEM = "Temp. calibration "; +const char * const MSG_TEMP_CALIBRATION_LANG_TABLE[1] PROGMEM = { + MSG_TEMP_CALIBRATION_EN +}; + +const char MSG_TEMP_CALIBRATION_DONE_EN[] PROGMEM = "Temperature calibration is finished. Click to continue."; +const char * const MSG_TEMP_CALIBRATION_DONE_LANG_TABLE[1] PROGMEM = { + MSG_TEMP_CALIBRATION_DONE_EN +}; + +const char MSG_TEMP_CALIBRATION_OFF_EN[] PROGMEM = "Temp. cal. [OFF]"; +const char * const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[1] PROGMEM = { + MSG_TEMP_CALIBRATION_OFF_EN +}; + +const char MSG_TEMP_CALIBRATION_ON_EN[] PROGMEM = "Temp. cal. [ON]"; +const char * const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[1] PROGMEM = { + MSG_TEMP_CALIBRATION_ON_EN +}; + const char MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_EN[] PROGMEM = "SD card [normal]"; const char MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_PL[] PROGMEM = "karta SD [normal]"; const char * const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE[LANG_NUM] PROGMEM = { diff --git a/Firmware/language_all.h b/Firmware/language_all.h index a49d098e1..49211d762 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -109,6 +109,8 @@ extern const char* const MSG_CALIBRATE_E_LANG_TABLE[LANG_NUM]; #define MSG_CALIBRATE_E LANG_TABLE_SELECT(MSG_CALIBRATE_E_LANG_TABLE) extern const char* const MSG_CALIBRATE_PINDA_LANG_TABLE[1]; #define MSG_CALIBRATE_PINDA LANG_TABLE_SELECT_EXPLICIT(MSG_CALIBRATE_PINDA_LANG_TABLE, 0) +extern const char* const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[1]; +#define MSG_CALIBRATION_PINDA_MENU LANG_TABLE_SELECT_EXPLICIT(MSG_CALIBRATION_PINDA_MENU_LANG_TABLE, 0) extern const char* const MSG_CARD_MENU_LANG_TABLE[LANG_NUM]; #define MSG_CARD_MENU LANG_TABLE_SELECT(MSG_CARD_MENU_LANG_TABLE) extern const char* const MSG_CHANGE_EXTR_LANG_TABLE[LANG_NUM]; @@ -521,6 +523,14 @@ extern const char* const MSG_TAKE_EFFECT_LANG_TABLE[LANG_NUM]; #define MSG_TAKE_EFFECT LANG_TABLE_SELECT(MSG_TAKE_EFFECT_LANG_TABLE) extern const char* const MSG_TEMPERATURE_LANG_TABLE[LANG_NUM]; #define MSG_TEMPERATURE LANG_TABLE_SELECT(MSG_TEMPERATURE_LANG_TABLE) +extern const char* const MSG_TEMP_CALIBRATION_LANG_TABLE[1]; +#define MSG_TEMP_CALIBRATION LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_LANG_TABLE, 0) +extern const char* const MSG_TEMP_CALIBRATION_DONE_LANG_TABLE[1]; +#define MSG_TEMP_CALIBRATION_DONE LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_DONE_LANG_TABLE, 0) +extern const char* const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[1]; +#define MSG_TEMP_CALIBRATION_OFF LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_OFF_LANG_TABLE, 0) +extern const char* const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[1]; +#define MSG_TEMP_CALIBRATION_ON LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_ON_LANG_TABLE, 0) extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE[LANG_NUM]; #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF LANG_TABLE_SELECT(MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE) extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 3793f8b70..920ea7860 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -266,6 +266,11 @@ #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]" #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]" -#define MSG_CALIBRATE_PINDA "Calibrate PINDA" -#define MSG_PINDA_NOT_CALIBRATED "PINDA probe has not been calibrated" -#define MSG_PINDA_PREHEAT "Preheating" \ No newline at end of file +#define MSG_CALIBRATE_PINDA "Temp. calibration" +#define MSG_CALIBRATION_PINDA_MENU "Temp. calibration" +#define MSG_PINDA_NOT_CALIBRATED "Temperature calibration has not been run yet" +#define MSG_PINDA_PREHEAT "Preheating" +#define MSG_TEMP_CALIBRATION "Temp. calibration " +#define MSG_TEMP_CALIBRATION_DONE "Temperature calibration is finished. Click to continue." +#define MSG_TEMP_CALIBRATION_ON "Temp. cal. [ON]" +#define MSG_TEMP_CALIBRATION_OFF "Temp. cal. [OFF]" \ No newline at end of file diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 16f4813fe..593e82c2a 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2228,8 +2228,28 @@ void lcd_mesh_calibration_z() lcd_return_to_status(); } -void lcd_pinda_calibration() +void lcd_pinda_calibration_menu() { + START_MENU(); + MENU_ITEM(back, MSG_MENU_CALIBRATION, lcd_calibration_menu); + MENU_ITEM(submenu, MSG_CALIBRATE_PINDA, lcd_calibrate_pinda); + //MENU_ITEM(back, MSG_SETTINGS, lcd_settings_menu); + if (temp_cal_active == false) { + MENU_ITEM(function, MSG_TEMP_CALIBRATION_OFF, lcd_temp_calibration_set); + } + else { + MENU_ITEM(function, MSG_TEMP_CALIBRATION_ON, lcd_temp_calibration_set); + } + END_MENU(); +} + +void lcd_temp_calibration_set() { + temp_cal_active = !temp_cal_active; + digipot_init(); + lcd_goto_menu(lcd_pinda_calibration_menu, 2); +} + +void lcd_calibrate_pinda() { enquecommand_P(PSTR("G76")); lcd_return_to_status(); } @@ -2396,7 +2416,7 @@ static void lcd_calibration_menu() MENU_ITEM(function, MSG_CALIBRATE_BED, lcd_mesh_calibration); // "Calibrate Z" with storing the reference values to EEPROM. MENU_ITEM(submenu, MSG_HOMEYZ, lcd_mesh_calibration_z); - MENU_ITEM(submenu, MSG_CALIBRATE_PINDA, lcd_pinda_calibration); + MENU_ITEM(submenu, MSG_CALIBRATION_PINDA_MENU, lcd_pinda_calibration_menu); #ifndef SNMM //MENU_ITEM(function, MSG_CALIBRATE_E, lcd_calibrate_extruder); #endif diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 658767cd8..1e234946b 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -232,5 +232,7 @@ union MenuData; char reset_menu(); -void lcd_pinda_calibration(); +void lcd_pinda_calibration_menu(); +void lcd_calibrate_pinda(); +void lcd_temp_calibration_set(); #endif //ULTRALCD_H \ No newline at end of file diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index 66bfc9e9e..e34f08cb5 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -944,6 +944,22 @@ static void lcd_implementation_status_screen() { lcd.print(lcd_status_message); } + // PINDA temp calibration in progress + if (custom_message_type == 4) { + char progress[4]; + lcd.setCursor(0, 3); + lcd_printPGM(MSG_TEMP_CALIBRATION); + lcd.setCursor(17, 3); + sprintf(progress, "%d/6", custom_message_state); + lcd.print(progress); + } + // temp compensation preheat + if (custom_message_type == 5) { + lcd.setCursor(0, 3); + lcd_printPGM(MSG_PINDA_PREHEAT); + } + + } else { From ccdf5e9c41cff79cb7106e24880df12aa0f67398 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 6 Apr 2017 19:44:03 +0200 Subject: [PATCH 37/49] Message that temp calibration has not been run yet is displayed only if temp. calibration is activated --- Firmware/Marlin_main.cpp | 8 ++++---- Firmware/mesh_bed_calibration.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 4abe0ba17..bbca8105e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1164,7 +1164,7 @@ void setup() // Show the message. lcd_show_fullscreen_message_and_wait_P(MSG_BABYSTEP_Z_NOT_SET); lcd_update_enable(true); - } else if (calibration_status() == CALIBRATION_STATUS_PINDA) { + } else if (calibration_status() == CALIBRATION_STATUS_PINDA && temp_cal_active == true) { lcd_show_fullscreen_message_and_wait_P(MSG_PINDA_NOT_CALIBRATED); lcd_update_enable(true); } else if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION) { @@ -3228,7 +3228,7 @@ void process_commands() * This G-code will be performed at the end of a calibration script. */ case 87: - calibration_status_store(CALIBRATION_STATUS_PINDA); + calibration_status_store(CALIBRATION_STATUS_PINDA); break; /** @@ -6268,8 +6268,8 @@ void temp_compensation_apply() { st_synchronize(); plan_set_z_position(current_position[Z_AXIS]); } - else { - //message that we have no temp compensation data + else { + //message that we have no temp compensation data ? } } diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 4113fd499..021922865 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -2155,7 +2155,7 @@ void babystep_apply() { // Apply Z height correction aka baby stepping before mesh bed leveling gets activated. if(calibration_status() <= CALIBRATION_STATUS_PINDA) - { + { check_babystep(); //checking if babystep is in allowed range, otherwise setting babystep to 0 // End of G80: Apply the baby stepping value. From fab71ff7cf6066fdd7e5bf1efa54ca2957e7df15 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 6 Apr 2017 19:56:01 +0200 Subject: [PATCH 38/49] information that temp calibration active is active is stored to eeprom --- Firmware/Configuration.h | 1 + Firmware/Marlin_main.cpp | 3 ++- Firmware/ultralcd.cpp | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 7d99543dc..f7e216984 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -45,6 +45,7 @@ #define EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY (EEPROM_BED_CORRECTION_REAR-1) #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) // 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_main.cpp b/Firmware/Marlin_main.cpp index bbca8105e..ff76a8e5e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1141,6 +1141,7 @@ void setup() // EEPROM_LANG to number lower than 0x0ff. // 1) Set a high power mode. eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0); + eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); } // In the future, somewhere here would one compare the current firmware version against the firmware version stored in the EEPROM. @@ -1150,7 +1151,7 @@ void setup() if (lang_selected >= LANG_NUM){ lcd_mylang(); } - + temp_cal_active = eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE); check_babystep(); //checking if Z babystep is in allowed range if (calibration_status() == CALIBRATION_STATUS_ASSEMBLED || diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 593e82c2a..5f794d67e 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2245,6 +2245,7 @@ void lcd_pinda_calibration_menu() void lcd_temp_calibration_set() { temp_cal_active = !temp_cal_active; + eeprom_update_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE, temp_cal_active); digipot_init(); lcd_goto_menu(lcd_pinda_calibration_menu, 2); } From 2060d319f51c4b7eca830a4861e70c09ec4bdb5f Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 7 Apr 2017 12:12:16 +0200 Subject: [PATCH 39/49] faster load filament, extrusion before unload filament --- Firmware/Marlin_main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index f33bd33b4..96e60577a 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -5138,10 +5138,10 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp custom_message_type = 2; lcd_setstatuspgm(MSG_LOADING_FILAMENT); - current_position[E_AXIS] += 65; + current_position[E_AXIS] += 70; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence - current_position[E_AXIS] += 40; + current_position[E_AXIS] += 25; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence st_synchronize(); @@ -5151,7 +5151,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp while (!clean) { lcd_update_enable(true); lcd_update(2); - current_position[E_AXIS] += 40; + current_position[E_AXIS] += 25; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence st_synchronize(); clean = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILAMENT_CLEAN, false, true); @@ -5171,7 +5171,8 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp custom_message = true; custom_message_type = 2; lcd_setstatuspgm(MSG_UNLOADING_FILAMENT); - + current_position[E_AXIS] += 3; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); current_position[E_AXIS] -= 80; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 7000 / 60, active_extruder); st_synchronize(); From 7b962d666f839ab36abc1ad64694568b99690407 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 7 Apr 2017 14:56:52 +0200 Subject: [PATCH 40/49] pause print statistics --- Firmware/Marlin_main.cpp | 5 +++-- Firmware/ultralcd.cpp | 4 ++-- Firmware/ultralcd_implementation_hitachi_HD44780.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 96e60577a..bb9984233 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1523,7 +1523,8 @@ void get_command() SERIAL_PROTOCOLLNRPGM(MSG_FILE_PRINTED); stoptime=millis(); char time[30]; - unsigned long t=(stoptime-starttime)/1000; + unsigned long t=(stoptime-starttime-pause_time)/1000; + pause_time = 0; int hours, minutes; minutes=(t/60)%60; hours=t/60/60; @@ -3962,7 +3963,7 @@ Sigma_Exit: heating_status = 2; if (farm_mode) { prusa_statistics(2); }; - starttime=millis(); + //starttime=millis(); previous_millis_cmd = millis(); } break; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 746051272..82c87e521 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -545,7 +545,6 @@ void lcd_commands() enquecommand(cmd1); isPrintPaused = false; card.startFileprint(); - //starttime = pause_time; lcd_commands_step = 0; lcd_commands_type = 0; } @@ -3591,7 +3590,8 @@ void lcd_sdcard_stop() card.closefile(); stoptime = millis(); - unsigned long t = (stoptime - starttime) / 1000; //time in s + unsigned long t = (stoptime - starttime - pause_time) / 1000; //time in s + pause_time = 0; save_statistics(total_filament_used, t); lcd_return_to_status(); diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index fd8397c60..619b8185d 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -792,7 +792,7 @@ static void lcd_implementation_status_screen() lcd.print(LCD_STR_CLOCK[0]); if(starttime != 0) { - uint16_t time = (isPrintPaused || (!heating_status))? pause_time/60000 : (millis() + pause_time /*- start_time*/)/60000; //is print is paused, pause also print time + uint16_t time = millis() / 60000 - starttime / 60000; lcd.print(itostr2(time/60)); lcd.print(':'); lcd.print(itostr2(time%60)); From ba36fbbfa371b91334f17f35c84711e62a42ba5b Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 10 Apr 2017 11:53:20 +0200 Subject: [PATCH 41/49] endif removed --- Firmware/Marlin_main.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 5fcc2fda1..52c4fe9e6 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6411,9 +6411,6 @@ float temp_comp_interpolation(float inp_temperature) { } -#endif - - void long_pause() //long pause print { st_synchronize(); From e061209fc257f3a8e6cafc222fbc7d99dee51a56 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 10 Apr 2017 20:48:44 +0200 Subject: [PATCH 42/49] mesh bed leveling flag --- Firmware/Marlin_main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 52c4fe9e6..c99ed9090 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -54,7 +54,7 @@ #include "pins_arduino.h" #include "math.h" #include "util.h" -//#include "spline.h" + #ifdef BLINKM #include "BlinkM.h" @@ -2924,6 +2924,7 @@ void process_commands() case 80: case_G80: { + mesh_bed_leveling_flag = true; int8_t verbosity_level = 0; static bool run = false; @@ -3163,7 +3164,9 @@ void process_commands() custom_message = custom_message_old; custom_message_type = custom_message_type_old; custom_message_state = custom_message_state_old; - lcd_update(1); + mesh_bed_leveling_flag = false; + lcd_update(2); + } break; From 767d34fff8b1db20de6847199b5a54746c9552d5 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 12 Apr 2017 11:25:10 +0200 Subject: [PATCH 43/49] added blanking time for button debouncing, lcd_clicked() improved, fan selftest code slightly modified --- Firmware/ultralcd.cpp | 51 ++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index fe7a8bb0b..87d84cc19 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -111,6 +111,7 @@ float pid_temp = DEFAULT_PID_TEMP; bool long_press_active = false; long long_press_timer = millis(); +long button_blanking_time = millis(); bool button_pressed = false; bool menuExiting = false; @@ -4290,7 +4291,6 @@ static bool lcd_selftest_fan_dialog(int _fan) lcd.setCursor(1, 3); lcd_printPGM(MSG_SELFTEST_FAN_NO); int8_t enc_dif = 0; - bool _response = false; do { switch (_fan) @@ -4330,13 +4330,7 @@ static bool lcd_selftest_fan_dialog(int _fan) manage_heater(); delay(100); - if (lcd_clicked()) - { - _response = true; - } - - - } while (!_response); + } while (!lcd_clicked()); SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN); WRITE(EXTRUDER_0_AUTO_FAN_PIN, 0); @@ -4436,7 +4430,7 @@ static void lcd_selftest_screen_step(int _row, int _col, int _state, const char static void lcd_quick_feedback() { lcdDrawUpdate = 2; - button_pressed = false; + button_pressed = false; lcd_implementation_quick_feedback(); } @@ -4791,36 +4785,42 @@ void lcd_buttons_update() #if BTN_ENC > 0 if (lcd_update_enabled == true) { //if we are in non-modal mode, long press can be used and short press triggers with button release if (READ(BTN_ENC) == 0) { //button is pressed - - if (button_pressed == false && long_press_active == false) { - if (currentMenu != lcd_move_z) { - savedMenu = currentMenu; - savedEncoderPosition = encoderPosition; + if (millis() > button_blanking_time) { + button_blanking_time = millis() + BUTTON_BLANKING_TIME; + if (button_pressed == false && long_press_active == false) { + if (currentMenu != lcd_move_z) { + savedMenu = currentMenu; + savedEncoderPosition = encoderPosition; + } + long_press_timer = millis(); + button_pressed = true; } - long_press_timer = millis(); - button_pressed = true; - } - else { - if (millis() - long_press_timer > LONG_PRESS_TIME) { //long press activated - - long_press_active = true; - move_menu_scale = 1.0; - lcd_goto_menu(lcd_move_z); + else { + if (millis() - long_press_timer > LONG_PRESS_TIME) { //long press activated + + long_press_active = true; + move_menu_scale = 1.0; + lcd_goto_menu(lcd_move_z); + } } } } else { //button not pressed if (button_pressed) { //button was released + button_blanking_time = millis() + BUTTON_BLANKING_TIME; + if (long_press_active == false) { //button released before long press gets activated if (currentMenu == lcd_move_z) { //return to previously active menu and previous encoder position - lcd_goto_menu(savedMenu, savedEncoderPosition); + lcd_goto_menu(savedMenu, savedEncoderPosition); } else { newbutton |= EN_C; } } + else if (currentMenu == lcd_move_z) lcd_quick_feedback(); //button_pressed is set back to false via lcd_quick_feedback function + } else { long_press_active = false; @@ -4830,6 +4830,7 @@ void lcd_buttons_update() else { //we are in modal mode if (READ(BTN_ENC) == 0) newbutton |= EN_C; + } #endif @@ -4923,7 +4924,7 @@ void lcd_buzz(long duration, uint16_t freq) bool lcd_clicked() { bool clicked = LCD_CLICKED; - button_pressed = false; + if(clicked) button_pressed = false; return clicked; } #endif//ULTIPANEL From 803d19aa86b12fa1ccfbcf5346b32605d579206c Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 13 Apr 2017 14:57:59 +0200 Subject: [PATCH 44/49] preheat error for bed --- Firmware/temperature.cpp | 43 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index d8b0b61a8..754262192 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1070,11 +1070,10 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren float __hysteresis = 0; int __timeout = 0; bool temp_runaway_check_active = false; - static float __preheat_start = 0; - static int __preheat_counter = 0; - static int __preheat_errors = 0; - - _heater_id = (_isbed) ? _heater_id++ : _heater_id; + static float __preheat_start[2] = { 0,0}; //currently just bed and one extruder + static int __preheat_counter[2] = { 0,0}; + static int __preheat_errors[2] = { 0,0}; + #ifdef TEMP_RUNAWAY_BED_TIMEOUT if (_isbed) @@ -1107,8 +1106,8 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren { temp_runaway_status[_heater_id] = TempRunaway_PREHEAT; temp_runaway_target[_heater_id] = _target_temperature; - __preheat_start = _current_temperature; - __preheat_counter = 0; + __preheat_start[_heater_id] = _current_temperature; + __preheat_counter[_heater_id] = 0; } else { @@ -1119,26 +1118,36 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren if (temp_runaway_status[_heater_id] == TempRunaway_PREHEAT) { - if (_current_temperature < 150) + if (_current_temperature < ((_isbed) ? (0.8 * _target_temperature) : 150)) //check only in area where temperature is changing fastly for heater, check to 0.8 x target temperature for bed { - __preheat_counter++; - if (__preheat_counter > 8) + __preheat_counter[_heater_id]++; + if (__preheat_counter[_heater_id] > ((_isbed) ? 16 : 8)) // periodicaly check if current temperature changes { - if (_current_temperature - __preheat_start < 2) { - __preheat_errors++; + /*SERIAL_ECHOPGM("Heater:"); + MYSERIAL.print(_heater_id); + SERIAL_ECHOPGM(" T:"); + MYSERIAL.print(_current_temperature); + SERIAL_ECHOPGM(" Tstart:"); + MYSERIAL.print(__preheat_start[_heater_id]);*/ + + if (_current_temperature - __preheat_start[_heater_id] < 2) { + __preheat_errors[_heater_id]++; + /*SERIAL_ECHOPGM(" Preheat errors:"); + MYSERIAL.println(__preheat_errors[_heater_id]);*/ } else { - __preheat_errors = 0; + //SERIAL_ECHOLNPGM(""); + __preheat_errors[_heater_id] = 0; } - if (__preheat_errors > 5) + if (__preheat_errors[_heater_id] > ((_isbed) ? 2 : 5)) { if (farm_mode) { prusa_statistics(0); } temp_runaway_stop(true, _isbed); if (farm_mode) { prusa_statistics(91); } } - __preheat_start = _current_temperature; - __preheat_counter = 0; + __preheat_start[_heater_id] = _current_temperature; + __preheat_counter[_heater_id] = 0; } } } @@ -1156,7 +1165,7 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren if (temp_runaway_check_active) - { + { // we are in range if (_target_temperature - __hysteresis < _current_temperature && _current_temperature < _target_temperature + __hysteresis) { From 70b6e13de4b147a73d52f557d262d7960b942639 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 13 Apr 2017 15:25:56 +0200 Subject: [PATCH 45/49] farm mode activation and farm number initialization handled when upgrading firmware versions and when flashing to new eeprom --- Firmware/Marlin_main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c99ed9090..753f1a406 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1130,7 +1130,8 @@ void setup() #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_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero, deactivate farm mode + 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); From 4de9b1c9f6d7a043b476fcd2f6d7a63aa12d966a Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 13 Apr 2017 16:15:34 +0200 Subject: [PATCH 46/49] temp calibration on/off initialization when updating firmware --- Firmware/Marlin_main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 753f1a406..36264597f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1151,10 +1151,10 @@ void setup() // 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); - eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); + eeprom_write_byte((uint8_t*)EEPROM_SILENT, 0); } + // 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 // is being written into the EEPROM, so the update procedure will be triggered only once. @@ -1163,6 +1163,10 @@ void setup() lcd_mylang(); } temp_cal_active = eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE); + if (temp_cal_active == 0xFF) { + eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); + temp_cal_active = 0; + } check_babystep(); //checking if Z babystep is in allowed range if (calibration_status() == CALIBRATION_STATUS_ASSEMBLED || From 329e1ac9bbc35f64980bb16968085e0507f2a213 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 13 Apr 2017 16:51:30 +0200 Subject: [PATCH 47/49] waiting for PINDA to cool down --- Firmware/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 36264597f..d0bb86035 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2816,7 +2816,7 @@ void process_commands() plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 3000 / 60, active_extruder); st_synchronize(); - while (degBed() < PINDA_MIN_T) delay_keep_alive(1000); + while (abs(degBed() - PINDA_MIN_T) > 1 ) delay_keep_alive(1000); //enquecommand_P(PSTR("M190 S50")); for (int i = 0; i < PINDA_HEAT_T; i++) delay_keep_alive(1000); From c03a18f8c3b99752f7bbd7e17548223e24a23b84 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 19 Apr 2017 16:15:11 +0200 Subject: [PATCH 48/49] czech messages added, temperature calibration is off in fresh eeprom, pinda preheat phase is not used unless calibration was run, pause print works with gcode absolute and relative extruder mode, move z higher after selftest --- Firmware/Marlin_main.cpp | 13 +- Firmware/language_all.cpp | 131 +++++++++++++++--- Firmware/language_all.h | 62 ++++----- Firmware/language_cz.h | 19 ++- Firmware/language_en.h | 32 ++--- Firmware/ultralcd.cpp | 7 +- .../ultralcd_implementation_hitachi_HD44780.h | 2 +- 7 files changed, 185 insertions(+), 81 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d0bb86035..296fc9d81 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1162,11 +1162,12 @@ void setup() if (lang_selected >= LANG_NUM){ lcd_mylang(); } - temp_cal_active = eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE); - if (temp_cal_active == 0xFF) { + + if (eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE) == 255) { eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); - temp_cal_active = 0; - } + temp_cal_active = false; + } else temp_cal_active = eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE); + check_babystep(); //checking if Z babystep is in allowed range if (calibration_status() == CALIBRATION_STATUS_ASSEMBLED || @@ -2948,7 +2949,7 @@ void process_commands() break; } - if (run == false && card.sdprinting == true && temp_cal_active == true) { + if (run == false && card.sdprinting == true && temp_cal_active == true && calibration_status() < CALIBRATION_STATUS_PINDA) { temp_compensation_start(); run = true; repeatcommand_front(); // repeat G80 with all its parameters @@ -3095,7 +3096,7 @@ void process_commands() } clean_up_after_endstop_move(); SERIAL_ECHOLNPGM("clean up finished "); - if(temp_cal_active == true) temp_compensation_apply(); //apply PINDA temperature compensation + if(temp_cal_active == true && calibration_status() < CALIBRATION_STATUS_PINDA) temp_compensation_apply(); //apply PINDA temperature compensation babystep_apply(); // Apply Z height correction aka baby stepping before mesh bed leveing gets activated. SERIAL_ECHOLNPGM("babystep applied"); bool eeprom_bed_correction_valid = eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1; diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index fc774781a..a55b30e85 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -494,13 +494,25 @@ const char * const MSG_CALIBRATE_E_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_CALIBRATE_E_DE }; -const char MSG_CALIBRATE_PINDA_EN[] PROGMEM = "Temp. calibration"; -const char * const MSG_CALIBRATE_PINDA_LANG_TABLE[1] PROGMEM = { +const char MSG_CALIBRATE_PINDA_EN[] PROGMEM = "Calibrate"; +const char MSG_CALIBRATE_PINDA_CZ[] PROGMEM = "Zkalibrovat"; +const char * const MSG_CALIBRATE_PINDA_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_CALIBRATE_PINDA_EN, + MSG_CALIBRATE_PINDA_CZ, + MSG_CALIBRATE_PINDA_EN, + MSG_CALIBRATE_PINDA_EN, + MSG_CALIBRATE_PINDA_EN, MSG_CALIBRATE_PINDA_EN }; const char MSG_CALIBRATION_PINDA_MENU_EN[] PROGMEM = "Temp. calibration"; -const char * const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[1] PROGMEM = { +const char MSG_CALIBRATION_PINDA_MENU_CZ[] PROGMEM = "Teplotni kalibrace"; +const char * const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_CALIBRATION_PINDA_MENU_EN, + MSG_CALIBRATION_PINDA_MENU_CZ, + MSG_CALIBRATION_PINDA_MENU_EN, + MSG_CALIBRATION_PINDA_MENU_EN, + MSG_CALIBRATION_PINDA_MENU_EN, MSG_CALIBRATION_PINDA_MENU_EN }; @@ -702,11 +714,6 @@ const char * const MSG_DWELL_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_DWELL_DE }; -const char MSG_EEPROM_SAVING_EN[] PROGMEM = "Saving"; -const char * const MSG_EEPROM_SAVING_LANG_TABLE[1] PROGMEM = { - MSG_EEPROM_SAVING_EN -}; - const char MSG_ENDSTOPS_HIT_EN[] PROGMEM = "endstops hit: "; const char * const MSG_ENDSTOPS_HIT_LANG_TABLE[1] PROGMEM = { MSG_ENDSTOPS_HIT_EN @@ -1017,7 +1024,13 @@ const char * const MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE[LANG_NUM] PROGM }; const char MSG_FINISHING_MOVEMENTS_EN[] PROGMEM = "Finishing movements"; -const char * const MSG_FINISHING_MOVEMENTS_LANG_TABLE[1] PROGMEM = { +const char MSG_FINISHING_MOVEMENTS_CZ[] PROGMEM = "Dokoncovani pohybu"; +const char * const MSG_FINISHING_MOVEMENTS_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_FINISHING_MOVEMENTS_EN, + MSG_FINISHING_MOVEMENTS_CZ, + MSG_FINISHING_MOVEMENTS_EN, + MSG_FINISHING_MOVEMENTS_EN, + MSG_FINISHING_MOVEMENTS_EN, MSG_FINISHING_MOVEMENTS_EN }; @@ -1757,27 +1770,57 @@ const char * const MSG_PICK_Z_LANG_TABLE[LANG_NUM] PROGMEM = { }; const char MSG_PID_EXTRUDER_EN[] PROGMEM = "PID calibration"; -const char * const MSG_PID_EXTRUDER_LANG_TABLE[1] PROGMEM = { +const char MSG_PID_EXTRUDER_CZ[] PROGMEM = "PID kalibrace"; +const char * const MSG_PID_EXTRUDER_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_PID_EXTRUDER_EN, + MSG_PID_EXTRUDER_CZ, + MSG_PID_EXTRUDER_EN, + MSG_PID_EXTRUDER_EN, + MSG_PID_EXTRUDER_EN, MSG_PID_EXTRUDER_EN }; const char MSG_PID_FINISHED_EN[] PROGMEM = "PID cal. finished"; -const char * const MSG_PID_FINISHED_LANG_TABLE[1] PROGMEM = { +const char MSG_PID_FINISHED_CZ[] PROGMEM = "PID kal. ukoncena"; +const char * const MSG_PID_FINISHED_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_PID_FINISHED_EN, + MSG_PID_FINISHED_CZ, + MSG_PID_FINISHED_EN, + MSG_PID_FINISHED_EN, + MSG_PID_FINISHED_EN, MSG_PID_FINISHED_EN }; const char MSG_PID_RUNNING_EN[] PROGMEM = "PID cal. "; -const char * const MSG_PID_RUNNING_LANG_TABLE[1] PROGMEM = { +const char MSG_PID_RUNNING_CZ[] PROGMEM = "PID kal. "; +const char * const MSG_PID_RUNNING_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_PID_RUNNING_EN, + MSG_PID_RUNNING_CZ, + MSG_PID_RUNNING_EN, + MSG_PID_RUNNING_EN, + MSG_PID_RUNNING_EN, MSG_PID_RUNNING_EN }; const char MSG_PINDA_NOT_CALIBRATED_EN[] PROGMEM = "Temperature calibration has not been run yet"; -const char * const MSG_PINDA_NOT_CALIBRATED_LANG_TABLE[1] PROGMEM = { +const char MSG_PINDA_NOT_CALIBRATED_CZ[] PROGMEM = "Tiskarna nebyla teplotne zkalibrovana"; +const char * const MSG_PINDA_NOT_CALIBRATED_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_PINDA_NOT_CALIBRATED_EN, + MSG_PINDA_NOT_CALIBRATED_CZ, + MSG_PINDA_NOT_CALIBRATED_EN, + MSG_PINDA_NOT_CALIBRATED_EN, + MSG_PINDA_NOT_CALIBRATED_EN, MSG_PINDA_NOT_CALIBRATED_EN }; const char MSG_PINDA_PREHEAT_EN[] PROGMEM = "Preheating"; -const char * const MSG_PINDA_PREHEAT_LANG_TABLE[1] PROGMEM = { +const char MSG_PINDA_PREHEAT_CZ[] PROGMEM = "Predehrivani"; +const char * const MSG_PINDA_PREHEAT_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_PINDA_PREHEAT_EN, + MSG_PINDA_PREHEAT_CZ, + MSG_PINDA_PREHEAT_EN, + MSG_PINDA_PREHEAT_EN, + MSG_PINDA_PREHEAT_EN, MSG_PINDA_PREHEAT_EN }; @@ -1877,7 +1920,13 @@ const char * const MSG_PRINT_ABORTED_LANG_TABLE[LANG_NUM] PROGMEM = { }; const char MSG_PRINT_PAUSED_EN[] PROGMEM = "Print paused"; -const char * const MSG_PRINT_PAUSED_LANG_TABLE[1] PROGMEM = { +const char MSG_PRINT_PAUSED_CZ[] PROGMEM = "Tisk pozastaven"; +const char * const MSG_PRINT_PAUSED_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_PRINT_PAUSED_EN, + MSG_PRINT_PAUSED_CZ, + MSG_PRINT_PAUSED_EN, + MSG_PRINT_PAUSED_EN, + MSG_PRINT_PAUSED_EN, MSG_PRINT_PAUSED_EN }; @@ -1988,7 +2037,13 @@ const char * const MSG_RESUMING_LANG_TABLE[LANG_NUM] PROGMEM = { }; const char MSG_RESUMING_PRINT_EN[] PROGMEM = "Resuming print"; -const char * const MSG_RESUMING_PRINT_LANG_TABLE[1] PROGMEM = { +const char MSG_RESUMING_PRINT_CZ[] PROGMEM = "Obnovovani tisku"; +const char * const MSG_RESUMING_PRINT_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_RESUMING_PRINT_EN, + MSG_RESUMING_PRINT_CZ, + MSG_RESUMING_PRINT_EN, + MSG_RESUMING_PRINT_EN, + MSG_RESUMING_PRINT_EN, MSG_RESUMING_PRINT_EN }; @@ -2491,8 +2546,14 @@ const char * const MSG_SET_ORIGIN_LANG_TABLE[1] PROGMEM = { MSG_SET_ORIGIN_EN }; -const char MSG_SET_TEMPERATURE_EN[] PROGMEM = "Set temperature"; -const char * const MSG_SET_TEMPERATURE_LANG_TABLE[1] PROGMEM = { +const char MSG_SET_TEMPERATURE_EN[] PROGMEM = "Set temperature:"; +const char MSG_SET_TEMPERATURE_CZ[] PROGMEM = "Nastavte teplotu:"; +const char * const MSG_SET_TEMPERATURE_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_SET_TEMPERATURE_EN, + MSG_SET_TEMPERATURE_CZ, + MSG_SET_TEMPERATURE_EN, + MSG_SET_TEMPERATURE_EN, + MSG_SET_TEMPERATURE_EN, MSG_SET_TEMPERATURE_EN }; @@ -2748,23 +2809,47 @@ const char * const MSG_TEMPERATURE_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_TEMPERATURE_DE }; -const char MSG_TEMP_CALIBRATION_EN[] PROGMEM = "Temp. calibration "; -const char * const MSG_TEMP_CALIBRATION_LANG_TABLE[1] PROGMEM = { +const char MSG_TEMP_CALIBRATION_EN[] PROGMEM = "Temp. cal. "; +const char MSG_TEMP_CALIBRATION_CZ[] PROGMEM = "Tepl. kal. "; +const char * const MSG_TEMP_CALIBRATION_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_TEMP_CALIBRATION_EN, + MSG_TEMP_CALIBRATION_CZ, + MSG_TEMP_CALIBRATION_EN, + MSG_TEMP_CALIBRATION_EN, + MSG_TEMP_CALIBRATION_EN, MSG_TEMP_CALIBRATION_EN }; const char MSG_TEMP_CALIBRATION_DONE_EN[] PROGMEM = "Temperature calibration is finished. Click to continue."; -const char * const MSG_TEMP_CALIBRATION_DONE_LANG_TABLE[1] PROGMEM = { +const char MSG_TEMP_CALIBRATION_DONE_CZ[] PROGMEM = "Teplotni kalibrace dokoncena. Pokracujte stiskem tlacitka."; +const char * const MSG_TEMP_CALIBRATION_DONE_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_TEMP_CALIBRATION_DONE_EN, + MSG_TEMP_CALIBRATION_DONE_CZ, + MSG_TEMP_CALIBRATION_DONE_EN, + MSG_TEMP_CALIBRATION_DONE_EN, + MSG_TEMP_CALIBRATION_DONE_EN, MSG_TEMP_CALIBRATION_DONE_EN }; const char MSG_TEMP_CALIBRATION_OFF_EN[] PROGMEM = "Temp. cal. [OFF]"; -const char * const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[1] PROGMEM = { +const char MSG_TEMP_CALIBRATION_OFF_CZ[] PROGMEM = "Tepl. kal. [OFF]"; +const char * const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_TEMP_CALIBRATION_OFF_EN, + MSG_TEMP_CALIBRATION_OFF_CZ, + MSG_TEMP_CALIBRATION_OFF_EN, + MSG_TEMP_CALIBRATION_OFF_EN, + MSG_TEMP_CALIBRATION_OFF_EN, MSG_TEMP_CALIBRATION_OFF_EN }; const char MSG_TEMP_CALIBRATION_ON_EN[] PROGMEM = "Temp. cal. [ON]"; -const char * const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[1] PROGMEM = { +const char MSG_TEMP_CALIBRATION_ON_CZ[] PROGMEM = "Tepl. kal. [ON]"; +const char * const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_TEMP_CALIBRATION_ON_EN, + MSG_TEMP_CALIBRATION_ON_CZ, + MSG_TEMP_CALIBRATION_ON_EN, + MSG_TEMP_CALIBRATION_ON_EN, + MSG_TEMP_CALIBRATION_ON_EN, MSG_TEMP_CALIBRATION_ON_EN }; diff --git a/Firmware/language_all.h b/Firmware/language_all.h index d9f13c44a..1844f09c1 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -107,10 +107,10 @@ extern const char* const MSG_CALIBRATE_BED_RESET_LANG_TABLE[LANG_NUM]; #define MSG_CALIBRATE_BED_RESET LANG_TABLE_SELECT(MSG_CALIBRATE_BED_RESET_LANG_TABLE) extern const char* const MSG_CALIBRATE_E_LANG_TABLE[LANG_NUM]; #define MSG_CALIBRATE_E LANG_TABLE_SELECT(MSG_CALIBRATE_E_LANG_TABLE) -extern const char* const MSG_CALIBRATE_PINDA_LANG_TABLE[1]; -#define MSG_CALIBRATE_PINDA LANG_TABLE_SELECT_EXPLICIT(MSG_CALIBRATE_PINDA_LANG_TABLE, 0) -extern const char* const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[1]; -#define MSG_CALIBRATION_PINDA_MENU LANG_TABLE_SELECT_EXPLICIT(MSG_CALIBRATION_PINDA_MENU_LANG_TABLE, 0) +extern const char* const MSG_CALIBRATE_PINDA_LANG_TABLE[LANG_NUM]; +#define MSG_CALIBRATE_PINDA LANG_TABLE_SELECT(MSG_CALIBRATE_PINDA_LANG_TABLE) +extern const char* const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[LANG_NUM]; +#define MSG_CALIBRATION_PINDA_MENU LANG_TABLE_SELECT(MSG_CALIBRATION_PINDA_MENU_LANG_TABLE) extern const char* const MSG_CARD_MENU_LANG_TABLE[LANG_NUM]; #define MSG_CARD_MENU LANG_TABLE_SELECT(MSG_CARD_MENU_LANG_TABLE) extern const char* const MSG_CHANGE_EXTR_LANG_TABLE[LANG_NUM]; @@ -143,8 +143,6 @@ extern const char* const MSG_DISABLE_STEPPERS_LANG_TABLE[LANG_NUM]; #define MSG_DISABLE_STEPPERS LANG_TABLE_SELECT(MSG_DISABLE_STEPPERS_LANG_TABLE) extern const char* const MSG_DWELL_LANG_TABLE[LANG_NUM]; #define MSG_DWELL LANG_TABLE_SELECT(MSG_DWELL_LANG_TABLE) -extern const char* const MSG_EEPROM_SAVING_LANG_TABLE[1]; -#define MSG_EEPROM_SAVING LANG_TABLE_SELECT_EXPLICIT(MSG_EEPROM_SAVING_LANG_TABLE, 0) extern const char* const MSG_ENDSTOPS_HIT_LANG_TABLE[1]; #define MSG_ENDSTOPS_HIT LANG_TABLE_SELECT_EXPLICIT(MSG_ENDSTOPS_HIT_LANG_TABLE, 0) extern const char* const MSG_ENDSTOP_HIT_LANG_TABLE[1]; @@ -213,8 +211,8 @@ extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE[LANG_NUM] #define MSG_FIND_BED_OFFSET_AND_SKEW_LINE1 LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1_LANG_TABLE) extern const char* const MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE[LANG_NUM]; #define MSG_FIND_BED_OFFSET_AND_SKEW_LINE2 LANG_TABLE_SELECT(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2_LANG_TABLE) -extern const char* const MSG_FINISHING_MOVEMENTS_LANG_TABLE[1]; -#define MSG_FINISHING_MOVEMENTS LANG_TABLE_SELECT_EXPLICIT(MSG_FINISHING_MOVEMENTS_LANG_TABLE, 0) +extern const char* const MSG_FINISHING_MOVEMENTS_LANG_TABLE[LANG_NUM]; +#define MSG_FINISHING_MOVEMENTS LANG_TABLE_SELECT(MSG_FINISHING_MOVEMENTS_LANG_TABLE) extern const char* const MSG_FLOW_LANG_TABLE[LANG_NUM]; #define MSG_FLOW LANG_TABLE_SELECT(MSG_FLOW_LANG_TABLE) extern const char* const MSG_FLOW0_LANG_TABLE[1]; @@ -353,16 +351,16 @@ extern const char* const MSG_PAUSE_PRINT_LANG_TABLE[LANG_NUM]; #define MSG_PAUSE_PRINT LANG_TABLE_SELECT(MSG_PAUSE_PRINT_LANG_TABLE) extern const char* const MSG_PICK_Z_LANG_TABLE[LANG_NUM]; #define MSG_PICK_Z LANG_TABLE_SELECT(MSG_PICK_Z_LANG_TABLE) -extern const char* const MSG_PID_EXTRUDER_LANG_TABLE[1]; -#define MSG_PID_EXTRUDER LANG_TABLE_SELECT_EXPLICIT(MSG_PID_EXTRUDER_LANG_TABLE, 0) -extern const char* const MSG_PID_FINISHED_LANG_TABLE[1]; -#define MSG_PID_FINISHED LANG_TABLE_SELECT_EXPLICIT(MSG_PID_FINISHED_LANG_TABLE, 0) -extern const char* const MSG_PID_RUNNING_LANG_TABLE[1]; -#define MSG_PID_RUNNING LANG_TABLE_SELECT_EXPLICIT(MSG_PID_RUNNING_LANG_TABLE, 0) -extern const char* const MSG_PINDA_NOT_CALIBRATED_LANG_TABLE[1]; -#define MSG_PINDA_NOT_CALIBRATED LANG_TABLE_SELECT_EXPLICIT(MSG_PINDA_NOT_CALIBRATED_LANG_TABLE, 0) -extern const char* const MSG_PINDA_PREHEAT_LANG_TABLE[1]; -#define MSG_PINDA_PREHEAT LANG_TABLE_SELECT_EXPLICIT(MSG_PINDA_PREHEAT_LANG_TABLE, 0) +extern const char* const MSG_PID_EXTRUDER_LANG_TABLE[LANG_NUM]; +#define MSG_PID_EXTRUDER LANG_TABLE_SELECT(MSG_PID_EXTRUDER_LANG_TABLE) +extern const char* const MSG_PID_FINISHED_LANG_TABLE[LANG_NUM]; +#define MSG_PID_FINISHED LANG_TABLE_SELECT(MSG_PID_FINISHED_LANG_TABLE) +extern const char* const MSG_PID_RUNNING_LANG_TABLE[LANG_NUM]; +#define MSG_PID_RUNNING LANG_TABLE_SELECT(MSG_PID_RUNNING_LANG_TABLE) +extern const char* const MSG_PINDA_NOT_CALIBRATED_LANG_TABLE[LANG_NUM]; +#define MSG_PINDA_NOT_CALIBRATED LANG_TABLE_SELECT(MSG_PINDA_NOT_CALIBRATED_LANG_TABLE) +extern const char* const MSG_PINDA_PREHEAT_LANG_TABLE[LANG_NUM]; +#define MSG_PINDA_PREHEAT LANG_TABLE_SELECT(MSG_PINDA_PREHEAT_LANG_TABLE) extern const char* const MSG_PLANNER_BUFFER_BYTES_LANG_TABLE[1]; #define MSG_PLANNER_BUFFER_BYTES LANG_TABLE_SELECT_EXPLICIT(MSG_PLANNER_BUFFER_BYTES_LANG_TABLE, 0) extern const char* const MSG_PLEASE_WAIT_LANG_TABLE[LANG_NUM]; @@ -381,8 +379,8 @@ extern const char* const MSG_PRINTER_DISCONNECTED_LANG_TABLE[1]; #define MSG_PRINTER_DISCONNECTED LANG_TABLE_SELECT_EXPLICIT(MSG_PRINTER_DISCONNECTED_LANG_TABLE, 0) extern const char* const MSG_PRINT_ABORTED_LANG_TABLE[LANG_NUM]; #define MSG_PRINT_ABORTED LANG_TABLE_SELECT(MSG_PRINT_ABORTED_LANG_TABLE) -extern const char* const MSG_PRINT_PAUSED_LANG_TABLE[1]; -#define MSG_PRINT_PAUSED LANG_TABLE_SELECT_EXPLICIT(MSG_PRINT_PAUSED_LANG_TABLE, 0) +extern const char* const MSG_PRINT_PAUSED_LANG_TABLE[LANG_NUM]; +#define MSG_PRINT_PAUSED LANG_TABLE_SELECT(MSG_PRINT_PAUSED_LANG_TABLE) extern const char* const MSG_PRUSA3D_LANG_TABLE[LANG_NUM]; #define MSG_PRUSA3D LANG_TABLE_SELECT(MSG_PRUSA3D_LANG_TABLE) extern const char* const MSG_PRUSA3D_FORUM_LANG_TABLE[LANG_NUM]; @@ -405,8 +403,8 @@ extern const char* const MSG_RESUME_PRINT_LANG_TABLE[LANG_NUM]; #define MSG_RESUME_PRINT LANG_TABLE_SELECT(MSG_RESUME_PRINT_LANG_TABLE) extern const char* const MSG_RESUMING_LANG_TABLE[LANG_NUM]; #define MSG_RESUMING LANG_TABLE_SELECT(MSG_RESUMING_LANG_TABLE) -extern const char* const MSG_RESUMING_PRINT_LANG_TABLE[1]; -#define MSG_RESUMING_PRINT LANG_TABLE_SELECT_EXPLICIT(MSG_RESUMING_PRINT_LANG_TABLE, 0) +extern const char* const MSG_RESUMING_PRINT_LANG_TABLE[LANG_NUM]; +#define MSG_RESUMING_PRINT LANG_TABLE_SELECT(MSG_RESUMING_PRINT_LANG_TABLE) extern const char* const MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE[1]; #define MSG_SD_CANT_ENTER_SUBDIR LANG_TABLE_SELECT_EXPLICIT(MSG_SD_CANT_ENTER_SUBDIR_LANG_TABLE, 0) extern const char* const MSG_SD_CANT_OPEN_SUBDIR_LANG_TABLE[1]; @@ -501,8 +499,8 @@ extern const char* const MSG_SET_HOME_OFFSETS_LANG_TABLE[1]; #define MSG_SET_HOME_OFFSETS LANG_TABLE_SELECT_EXPLICIT(MSG_SET_HOME_OFFSETS_LANG_TABLE, 0) extern const char* const MSG_SET_ORIGIN_LANG_TABLE[1]; #define MSG_SET_ORIGIN LANG_TABLE_SELECT_EXPLICIT(MSG_SET_ORIGIN_LANG_TABLE, 0) -extern const char* const MSG_SET_TEMPERATURE_LANG_TABLE[1]; -#define MSG_SET_TEMPERATURE LANG_TABLE_SELECT_EXPLICIT(MSG_SET_TEMPERATURE_LANG_TABLE, 0) +extern const char* const MSG_SET_TEMPERATURE_LANG_TABLE[LANG_NUM]; +#define MSG_SET_TEMPERATURE LANG_TABLE_SELECT(MSG_SET_TEMPERATURE_LANG_TABLE) extern const char* const MSG_SHOW_END_STOPS_LANG_TABLE[LANG_NUM]; #define MSG_SHOW_END_STOPS LANG_TABLE_SELECT(MSG_SHOW_END_STOPS_LANG_TABLE) extern const char* const MSG_SILENT_MODE_OFF_LANG_TABLE[LANG_NUM]; @@ -543,14 +541,14 @@ extern const char* const MSG_TAKE_EFFECT_LANG_TABLE[LANG_NUM]; #define MSG_TAKE_EFFECT LANG_TABLE_SELECT(MSG_TAKE_EFFECT_LANG_TABLE) extern const char* const MSG_TEMPERATURE_LANG_TABLE[LANG_NUM]; #define MSG_TEMPERATURE LANG_TABLE_SELECT(MSG_TEMPERATURE_LANG_TABLE) -extern const char* const MSG_TEMP_CALIBRATION_LANG_TABLE[1]; -#define MSG_TEMP_CALIBRATION LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_LANG_TABLE, 0) -extern const char* const MSG_TEMP_CALIBRATION_DONE_LANG_TABLE[1]; -#define MSG_TEMP_CALIBRATION_DONE LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_DONE_LANG_TABLE, 0) -extern const char* const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[1]; -#define MSG_TEMP_CALIBRATION_OFF LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_OFF_LANG_TABLE, 0) -extern const char* const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[1]; -#define MSG_TEMP_CALIBRATION_ON LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_ON_LANG_TABLE, 0) +extern const char* const MSG_TEMP_CALIBRATION_LANG_TABLE[LANG_NUM]; +#define MSG_TEMP_CALIBRATION LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_LANG_TABLE) +extern const char* const MSG_TEMP_CALIBRATION_DONE_LANG_TABLE[LANG_NUM]; +#define MSG_TEMP_CALIBRATION_DONE LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_DONE_LANG_TABLE) +extern const char* const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[LANG_NUM]; +#define MSG_TEMP_CALIBRATION_OFF LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_OFF_LANG_TABLE) +extern const char* const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[LANG_NUM]; +#define MSG_TEMP_CALIBRATION_ON LANG_TABLE_SELECT(MSG_TEMP_CALIBRATION_ON_LANG_TABLE) extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE[LANG_NUM]; #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF LANG_TABLE_SELECT(MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE) extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_cz.h b/Firmware/language_cz.h index 9dda46c22..b2267ad8c 100644 --- a/Firmware/language_cz.h +++ b/Firmware/language_cz.h @@ -264,4 +264,21 @@ #define MSG_FILAMENT_CLEAN "Je barva cista?" #define MSG_UNLOADING_FILAMENT "Vysouvam filament" -#define MSG_PAPER "Umistete list papiru na podlozku a udrzujte jej pod tryskou behem mereni prvnich 4 bodu. Pokud tryska zachyti papir, vypnete tiskarnu." \ No newline at end of file +#define MSG_PAPER "Umistete list papiru na podlozku a udrzujte jej pod tryskou behem mereni prvnich 4 bodu. Pokud tryska zachyti papir, vypnete tiskarnu." + +#define MSG_FINISHING_MOVEMENTS "Dokoncovani pohybu" +#define MSG_PRINT_PAUSED "Tisk pozastaven" +#define MSG_RESUMING_PRINT "Obnovovani tisku" +#define MSG_PID_EXTRUDER "PID kalibrace" +#define MSG_SET_TEMPERATURE "Nastavte teplotu:" +#define MSG_PID_FINISHED "PID kal. ukoncena" +#define MSG_PID_RUNNING "PID kal. " + +#define MSG_CALIBRATE_PINDA "Zkalibrovat" +#define MSG_CALIBRATION_PINDA_MENU "Teplotni kalibrace" +#define MSG_PINDA_NOT_CALIBRATED "Tiskarna nebyla teplotne zkalibrovana" +#define MSG_PINDA_PREHEAT "Predehrivani" +#define MSG_TEMP_CALIBRATION "Tepl. kal. " +#define MSG_TEMP_CALIBRATION_DONE "Teplotni kalibrace dokoncena. Pokracujte stiskem tlacitka." +#define MSG_TEMP_CALIBRATION_ON "Tepl. kal. [ON]" +#define MSG_TEMP_CALIBRATION_OFF "Tepl. kal. [OFF]" \ No newline at end of file diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 2bbcd432e..8c5e71d8a 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -267,20 +267,20 @@ #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]" #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]" #define MSG_PRINTER_DISCONNECTED "Printer disconnected" -#define MSG_FINISHING_MOVEMENTS "Finishing movements" -#define MSG_PRINT_PAUSED "Print paused" -#define MSG_RESUMING_PRINT "Resuming print" -#define MSG_PID_EXTRUDER "PID calibration" -#define MSG_SET_TEMPERATURE "Set temperature" -#define MSG_PID_FINISHED "PID cal. finished" -#define MSG_PID_RUNNING "PID cal. " -#define MSG_EEPROM_SAVING "Saving" +#define(length=20, lines=1) MSG_FINISHING_MOVEMENTS "Finishing movements" +#define(length=20, lines=1) MSG_PRINT_PAUSED "Print paused" +#define(length=20, lines=1) MSG_RESUMING_PRINT "Resuming print" +#define(length=17, lines=1) MSG_PID_EXTRUDER "PID calibration" +#define(length=19, lines=1) MSG_SET_TEMPERATURE "Set temperature:" +#define(length=20, lines=1) MSG_PID_FINISHED "PID cal. finished" +#define(length=20, lines=1) MSG_PID_RUNNING "PID cal. " + +#define(length=17, lines=1) MSG_CALIBRATE_PINDA "Calibrate" +#define(length=17, lines=1) MSG_CALIBRATION_PINDA_MENU "Temp. calibration" +#define(length=20, lines=4) MSG_PINDA_NOT_CALIBRATED "Temperature calibration has not been run yet" +#define(length=20, lines=1) MSG_PINDA_PREHEAT "Preheating" +#define(length=20, lines=1) MSG_TEMP_CALIBRATION "Temp. cal. " +#define(length=20, lines=4) MSG_TEMP_CALIBRATION_DONE "Temperature calibration is finished. Click to continue." +#define(length=20, lines=1) MSG_TEMP_CALIBRATION_ON "Temp. cal. [ON]" +#define(length=20, lines=1) MSG_TEMP_CALIBRATION_OFF "Temp. cal. [OFF]" -#define MSG_CALIBRATE_PINDA "Temp. calibration" -#define MSG_CALIBRATION_PINDA_MENU "Temp. calibration" -#define MSG_PINDA_NOT_CALIBRATED "Temperature calibration has not been run yet" -#define MSG_PINDA_PREHEAT "Preheating" -#define MSG_TEMP_CALIBRATION "Temp. calibration " -#define MSG_TEMP_CALIBRATION_DONE "Temperature calibration is finished. Click to continue." -#define MSG_TEMP_CALIBRATION_ON "Temp. cal. [ON]" -#define MSG_TEMP_CALIBRATION_OFF "Temp. cal. [OFF]" \ No newline at end of file diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 87d84cc19..07c23c132 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -556,7 +556,8 @@ void lcd_commands() strcpy(cmd1, "G1 Z"); strcat(cmd1, ftostr32(pause_lastpos[Z_AXIS])); enquecommand(cmd1); - enquecommand_P(PSTR("M83")); // set extruder to relative mode. + if (axis_relative_modes[3] == true) enquecommand_P(PSTR("M83")); // set extruder to relative mode. + else enquecommand_P(PSTR("M82")); // set extruder to absolute mode enquecommand_P(PSTR("G1 E" STRINGIFY(PAUSE_RETRACT))); //unretract enquecommand_P(PSTR("G90")); //absolute positioning lcd_commands_step = 1; @@ -2620,7 +2621,7 @@ static void lcd_calibration_menu() MENU_ITEM(function, MSG_CALIBRATE_BED, lcd_mesh_calibration); // "Calibrate Z" with storing the reference values to EEPROM. MENU_ITEM(submenu, MSG_HOMEYZ, lcd_mesh_calibration_z); - MENU_ITEM(submenu, MSG_CALIBRATION_PINDA_MENU, lcd_pinda_calibration_menu); + #ifndef SNMM //MENU_ITEM(function, MSG_CALIBRATE_E, lcd_calibrate_extruder); #endif @@ -2629,6 +2630,7 @@ MENU_ITEM(function, MSG_CALIBRATE_BED, lcd_mesh_calibration); #endif MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28 W")); MENU_ITEM(submenu, MSG_BED_CORRECTION_MENU, lcd_adjust_bed); + MENU_ITEM(submenu, MSG_CALIBRATION_PINDA_MENU, lcd_pinda_calibration_menu); MENU_ITEM(submenu, MSG_PID_EXTRUDER, pid_extruder); MENU_ITEM(submenu, MSG_SHOW_END_STOPS, menu_show_end_stops); MENU_ITEM(gcode, MSG_CALIBRATE_BED_RESET, PSTR("M44")); @@ -3900,6 +3902,7 @@ static void lcd_selftest() _progress = lcd_selftest_screen(4, _progress, 3, true, 1500); _result = lcd_selfcheck_axis(2, Z_MAX_POS); enquecommand_P(PSTR("G28 W")); + enquecommand_P(PSTR("G1 Z15")); } if (_result) diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index a718db5e2..da393a66f 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -964,7 +964,7 @@ static void lcd_implementation_status_screen() char progress[4]; lcd.setCursor(0, 3); lcd_printPGM(MSG_TEMP_CALIBRATION); - lcd.setCursor(17, 3); + lcd.setCursor(12, 3); sprintf(progress, "%d/6", custom_message_state); lcd.print(progress); } From 4eaefd923a6b26dd999624694bc0ea5b6d250dbc Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Wed, 19 Apr 2017 16:41:59 +0200 Subject: [PATCH 49/49] configuration files updated --- .../variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 17 ++++++++++++++--- .../variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 17 ++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 9b48ddc20..15a66337c 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -168,8 +168,8 @@ ADDITIONAL FEATURES SETTINGS #endif // temperature runaway -//#define TEMP_RUNAWAY_BED_HYSTERESIS 5 -//#define TEMP_RUNAWAY_BED_TIMEOUT 360 +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 #define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 #define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 @@ -370,14 +370,25 @@ THERMISTORS SETTINGS #define Z_BABYSTEP_MIN -3999 #define Z_BABYSTEP_MAX 0 +#define PINDA_PREHEAT_X 75 +#define PINDA_PREHEAT_Y 75 +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + #define PING_TIME 60 //time in s #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes #define PING_ALLERT_PERIOD 60 //time in s #define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release #define PAUSE_RETRACT 2 -#define DEFAULT_PID_TEMP 210; +#define DEFAULT_PID_TEMP 210 + +#define DEFAULT_RETRACTION 1 //used for PINDA temp compensation #endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index 9f6223e41..c45c8ec74 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -171,8 +171,8 @@ ADDITIONAL FEATURES SETTINGS #endif // temperature runaway -//#define TEMP_RUNAWAY_BED_HYSTERESIS 5 -//#define TEMP_RUNAWAY_BED_TIMEOUT 360 +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 #define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 #define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 @@ -373,14 +373,25 @@ THERMISTORS SETTINGS #define Z_BABYSTEP_MIN -3999 #define Z_BABYSTEP_MAX 0 +#define PINDA_PREHEAT_X 75 +#define PINDA_PREHEAT_Y 75 +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + #define PING_TIME 60 //time in s #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes #define PING_ALLERT_PERIOD 60 //time in s #define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release #define PAUSE_RETRACT 2 -#define DEFAULT_PID_TEMP 210; +#define DEFAULT_PID_TEMP 210 + +#define DEFAULT_RETRACTION 1 //used for PINDA temp compensation #endif //__CONFIGURATION_PRUSA_H