From 632781c4a2a5b8f33eb652324259dccaed73452a Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Thu, 21 Mar 2019 00:45:15 +0100 Subject: [PATCH 01/30] "disable_z()" for Delta PSU --- Firmware/Marlin.h | 6 +++ Firmware/Marlin_main.cpp | 43 +++++++++++++++++++ .../variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 3 ++ 3 files changed, 52 insertions(+) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 2477d1c2..9ccb81c6 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -172,6 +172,12 @@ void manage_inactivity(bool ignore_stepper_queue=false); #define disable_z() {} #endif +#ifdef PSU_Delta +#undef disable_z() +#define disable_z() disable_force_z() +void disable_force_z(); +#endif // PSU_Delta + diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7be151f9..303d4693 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9602,3 +9602,46 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } #define FIL_LOAD_LENGTH 60 + +#ifdef PSU_Delta +void disable_force_z() +{ +uint16_t z_microsteps=0; + +#ifdef TMC2130 +z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); +#endif //TMC2130 +/* +//planner_abort_hard(); +//sei(); +plan_buffer_line( + current_position[X_AXIS]+10, + current_position[Y_AXIS]+20, +// current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/axis_steps_per_unit[Z_AXIS], +current_position[Z_AXIS]+0.026, //0.025, + current_position[E_AXIS], + 40, active_extruder); +st_synchronize(); + z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); + MYSERIAL.println(z_microsteps,DEC); + + MYSERIAL.println(current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC); + MYSERIAL.println(current_position[Z_AXIS],DEC); + MYSERIAL.println(z_microsteps,DEC); + MYSERIAL.println(cs.axis_steps_per_unit[Z_AXIS],DEC); + MYSERIAL.println(float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC); +*/ +planner_abort_hard(); +sei(); +plan_buffer_line( + current_position[X_AXIS], + current_position[Y_AXIS], + current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS], + current_position[E_AXIS], + 40, active_extruder); +st_synchronize(); + +WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); +axis_known_position[Z_AXIS]=false; +} +#endif // PSU_Delta diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 1c0c6d28..9f82e79d 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -22,6 +22,9 @@ #define STEEL_SHEET #define HAS_SECOND_SERIAL_PORT +// PSU +#define PSU_Delta // uncomment if DeltaElectronics PSU installed + // Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) //#define E3D_PT100_EXTRUDER_WITH_AMP From 17a534e42b91b54673164305faeabb8f8c089f75 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Mon, 25 Mar 2019 23:28:25 +0100 Subject: [PATCH 02/30] "disable_z()" for Delta PSU II --- Firmware/Marlin_main.cpp | 4 +++- Firmware/io_atmega2560.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 303d4693..d119fbe4 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1316,7 +1316,7 @@ void setup() } #endif //TMC2130 -#if defined(Z_AXIS_ALWAYS_ON) +#if defined(Z_AXIS_ALWAYS_ON) && !defined(PSU_Delta) enable_z(); #endif farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE); @@ -9608,6 +9608,8 @@ void disable_force_z() { uint16_t z_microsteps=0; +if(PIN_INQ(Z_ENABLE_PIN)!=Z_ENABLE_ON) + return; // motor already disabled (may be ;-p ) #ifdef TMC2130 z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); #endif //TMC2130 diff --git a/Firmware/io_atmega2560.h b/Firmware/io_atmega2560.h index e8c756ff..e353eb05 100644 --- a/Firmware/io_atmega2560.h +++ b/Firmware/io_atmega2560.h @@ -368,6 +368,7 @@ #define PIN_SET(pin) PORT(pin) |= __MSK(pin) #define PIN_VAL(pin, val) if (val) PIN_SET(pin); else PIN_CLR(pin); #define PIN_GET(pin) (PIN(pin) & __MSK(pin)) +#define PIN_INQ(pin) (PORT(pin) & __MSK(pin)) #endif //_IO_ATMEGA2560 From 4b1fc690888c52ddf4edf3cefaeb41231b423bf2 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 2 Apr 2019 20:04:44 +0200 Subject: [PATCH 03/30] "disable_z()" for Delta PSU III stealthChop set if motor-disable (@ Z) required --- Firmware/Marlin.h | 4 +++ Firmware/Marlin_main.cpp | 61 +++++++++++++++++++++++++--------------- Firmware/stepper.cpp | 5 +++- 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 9ccb81c6..1516941b 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -173,9 +173,13 @@ void manage_inactivity(bool ignore_stepper_queue=false); #endif #ifdef PSU_Delta +void init_force_z(); #undef disable_z() #define disable_z() disable_force_z() void disable_force_z(); +#undef enable_disable_z() +#define enable_z() enable_force_z() +void enable_force_z(); #endif // PSU_Delta diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d119fbe4..8aa2c6c8 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9604,35 +9604,27 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) #define FIL_LOAD_LENGTH 60 #ifdef PSU_Delta +bool bEnableForce_z; + +void init_force_z() +{ +WRITE(Z_ENABLE_PIN,Z_ENABLE_ON); +bEnableForce_z=true; // "true"-value enforce "disable_force_z()" executing +disable_force_z(); +} + void disable_force_z() { uint16_t z_microsteps=0; -if(PIN_INQ(Z_ENABLE_PIN)!=Z_ENABLE_ON) +if(!bEnableForce_z) return; // motor already disabled (may be ;-p ) +bEnableForce_z=false; + +// alignment to full-step #ifdef TMC2130 z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); -#endif //TMC2130 -/* -//planner_abort_hard(); -//sei(); -plan_buffer_line( - current_position[X_AXIS]+10, - current_position[Y_AXIS]+20, -// current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/axis_steps_per_unit[Z_AXIS], -current_position[Z_AXIS]+0.026, //0.025, - current_position[E_AXIS], - 40, active_extruder); -st_synchronize(); - z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS); - MYSERIAL.println(z_microsteps,DEC); - - MYSERIAL.println(current_position[Z_AXIS]+float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC); - MYSERIAL.println(current_position[Z_AXIS],DEC); - MYSERIAL.println(z_microsteps,DEC); - MYSERIAL.println(cs.axis_steps_per_unit[Z_AXIS],DEC); - MYSERIAL.println(float((1024-z_microsteps+7)>>4)/cs.axis_steps_per_unit[Z_AXIS],DEC); -*/ +#endif // TMC2130 planner_abort_hard(); sei(); plan_buffer_line( @@ -9643,7 +9635,30 @@ plan_buffer_line( 40, active_extruder); st_synchronize(); -WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); +// switching to silent mode +#ifdef TMC2130 +tmc2130_mode=TMC2130_MODE_SILENT; +update_mode_profile(); +tmc2130_init(); +#endif // TMC2130 + axis_known_position[Z_AXIS]=false; } + + +void enable_force_z() +{ +if(bEnableForce_z) + return; // motor already enabled (may be ;-p ) +bEnableForce_z=true; + +// mode recovering +#ifdef TMC2130 +tmc2130_mode=eeprom_read_byte((uint8_t*)EEPROM_SILENT)?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; +update_mode_profile(); +tmc2130_init(); +#endif // TMC2130 + +WRITE(Z_ENABLE_PIN,Z_ENABLE_ON); // slightly redundant ;-p +} #endif // PSU_Delta diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index c21a4e9f..dfb2dbe2 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -1122,7 +1122,7 @@ void clear_current_adv_vars() { } #endif // LIN_ADVANCE - + void st_init() { #ifdef TMC2130 @@ -1306,6 +1306,9 @@ void st_init() SET_OUTPUT(Z2_STEP_PIN); WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN); #endif + #ifdef PSU_Delta + init_force_z(); + #endif // PSU_Delta disable_z(); #endif #if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1) From 1d8c24e8a9877eaf97240b73f53d69650f1093af Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Wed, 5 Jun 2019 19:22:04 +0200 Subject: [PATCH 04/30] "disable_z()" for Delta PSU IV correction for (motor) mode switching --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 13 +++++++++++-- Firmware/tmc2130.cpp | 7 ++++++- Firmware/tmc2130.h | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 1516941b..149d3298 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -174,6 +174,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); #ifdef PSU_Delta void init_force_z(); +void check_force_z(); #undef disable_z() #define disable_z() disable_force_z() void disable_force_z(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 8aa2c6c8..2b873354 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1279,6 +1279,9 @@ void setup() update_mode_profile(); tmc2130_init(); #endif //TMC2130 +#ifdef PSU_Delta + init_force_z(); // ! important for correct Z-axis initialization +#endif // PSU_Delta setup_photpin(); @@ -9613,6 +9616,12 @@ bEnableForce_z=true; // "true"-value enforce "disab disable_force_z(); } +void check_force_z() +{ +if(!(bEnableForce_z||eeprom_read_byte((uint8_t*)EEPROM_SILENT))) + init_force_z(); // causes enforced switching into disable-state +} + void disable_force_z() { uint16_t z_microsteps=0; @@ -9639,7 +9648,7 @@ st_synchronize(); #ifdef TMC2130 tmc2130_mode=TMC2130_MODE_SILENT; update_mode_profile(); -tmc2130_init(); +tmc2130_init(true); #endif // TMC2130 axis_known_position[Z_AXIS]=false; @@ -9656,7 +9665,7 @@ bEnableForce_z=true; #ifdef TMC2130 tmc2130_mode=eeprom_read_byte((uint8_t*)EEPROM_SILENT)?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; update_mode_profile(); -tmc2130_init(); +tmc2130_init(true); #endif // TMC2130 WRITE(Z_ENABLE_PIN,Z_ENABLE_ON); // slightly redundant ;-p diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index 8cd3422a..7c35815c 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -143,7 +143,7 @@ uint16_t __tcoolthrs(uint8_t axis) return 0; } -void tmc2130_init() +void tmc2130_init(bool bSupressFlag=false) { // DBG(_n("tmc2130_init(), mode=%S\n"), tmc2130_mode?_n("STEALTH"):_n("NORMAL")); WRITE(X_TMC2130_CS, HIGH); @@ -216,6 +216,11 @@ void tmc2130_init() tmc2130_set_wave(E_AXIS, 247, tmc2130_wave_fac[E_AXIS]); #endif //TMC2130_LINEARITY_CORRECTION +#ifdef PSU_Delta + if(!bSupressFlag) + check_force_z(); +#endif // PSU_Delta + } uint8_t tmc2130_sample_diag() diff --git a/Firmware/tmc2130.h b/Firmware/tmc2130.h index 1c854f79..a1d160f0 100644 --- a/Firmware/tmc2130.h +++ b/Firmware/tmc2130.h @@ -51,7 +51,7 @@ typedef struct extern tmc2130_chopper_config_t tmc2130_chopper_config[4]; //initialize tmc2130 -extern void tmc2130_init(); +extern void tmc2130_init(bool bSupressFlag=false); //check diag pins (called from stepper isr) extern void tmc2130_st_isr(); //update stall guard (called from st_synchronize inside the loop) From b5168bd6c2b165094d5479b5f17fc242e3411354 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 24 Jun 2019 17:30:56 +0200 Subject: [PATCH 05/30] fan error fix --- Firmware/Marlin_main.cpp | 9 +++++++++ Firmware/temperature.cpp | 7 +++++-- Firmware/ultralcd.cpp | 5 ++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 711c428b..7f2efe35 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9387,6 +9387,11 @@ void restore_print_from_ram_and_continue(float e_move) fanSpeed = saved_fanSpeed; float e = saved_pos[E_AXIS] - e_move; plan_set_e_position(e); + + #ifdef FANCHECK + fans_check_enabled = false; + #endif + //first move print head in XY to the saved position: plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], current_position[Z_AXIS], saved_pos[E_AXIS] - e_move, homing_feedrate[Z_AXIS]/13, active_extruder); st_synchronize(); @@ -9397,6 +9402,10 @@ void restore_print_from_ram_and_continue(float e_move) plan_buffer_line(saved_pos[X_AXIS], saved_pos[Y_AXIS], saved_pos[Z_AXIS], saved_pos[E_AXIS], 35, active_extruder); st_synchronize(); + #ifdef FANCHECK + fans_check_enabled = true; + #endif + memcpy(current_position, saved_pos, sizeof(saved_pos)); memcpy(destination, current_position, sizeof(destination)); if (saved_printing_type == PRINTING_TYPE_SD) { //was sd printing diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 9c49cf79..7ea6d07c 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -500,8 +500,9 @@ void checkFanSpeed() max_print_fan_errors = 15; //15 seconds max_extruder_fan_errors = 5; //5 seconds #endif //FAN_SOFT_PWM - - fans_check_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED) > 0); + + if(fans_check_enabled != false) + fans_check_enabled = (eeprom_read_byte((uint8_t*)EEPROM_FAN_CHECK_ENABLED) > 0); static unsigned char fan_speed_errors[2] = { 0,0 }; #if (defined(FANCHECK) && defined(TACH_0) && (TACH_0 >-1)) if ((fan_speed[0] == 0) && (current_temperature[0] > EXTRUDER_AUTO_FAN_TEMPERATURE)) fan_speed_errors[0]++; @@ -560,6 +561,8 @@ void fanSpeedError(unsigned char _fan) { else { setTargetHotend0(0); SERIAL_ECHOLNPGM("// action:pause"); //for octoprint + heating_status = 0; + fan_check_error = EFCE_REPORTED; } switch (_fan) { case 0: // extracting the same code from case 0 and case 1 into a function saves 72B diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f69efbbc..0a22a937 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6380,6 +6380,7 @@ static void lcd_test_menu() void lcd_resume_print() { lcd_return_to_status(); + lcd_reset_alert_level(); lcd_setstatuspgm(_T(MSG_RESUMING_PRINT)); lcd_reset_alert_level(); //for fan speed error restore_print_from_ram_and_continue(0.0); @@ -6485,7 +6486,9 @@ static void lcd_main_menu() } else { - MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT + checkFanSpeed(); //Check manually to get most recent fan speed status + if(fan_check_error == EFCE_OK) + MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT } MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } From 3e9dc91cefac628539cabf2099b78285867b70df Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 24 Jun 2019 18:01:49 +0200 Subject: [PATCH 06/30] ifdef for mk2 --- Firmware/ultralcd.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0a22a937..47c42747 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6486,9 +6486,14 @@ static void lcd_main_menu() } else { - checkFanSpeed(); //Check manually to get most recent fan speed status - if(fan_check_error == EFCE_OK) - MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT + #ifdef FANCHECK + checkFanSpeed(); //Check manually to get most recent fan speed status + if(fan_check_error == EFCE_OK) + MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT + #else + MENU_ITEM_SUBMENU_P(_i("Resume print"), lcd_resume_print);////MSG_RESUME_PRINT + #endif + } MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } From a59e7090ead7bafb46b4478211cf6283f86ff368 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Thu, 27 Jun 2019 17:32:40 +0200 Subject: [PATCH 07/30] Increase version. --- Firmware/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index eee1b167..acdadfe7 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.7.2-RC1" -#define FW_COMMIT_NR 2359 +#define FW_VERSION "3.7.2" +#define FW_COMMIT_NR 2363 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN From 759d9f5a2ee362eab5ca9184bbf7994ba6ced219 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 15 Jul 2019 11:41:16 +0200 Subject: [PATCH 08/30] small text edits --- Firmware/sound.h | 2 +- lang/lang_en_cz.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/sound.h b/Firmware/sound.h index 2c14dfee..bdd32ec8 100644 --- a/Firmware/sound.h +++ b/Firmware/sound.h @@ -6,7 +6,7 @@ #define MSG_SOUND_MODE_LOUD "Sound [loud]" #define MSG_SOUND_MODE_ONCE "Sound [once]" #define MSG_SOUND_MODE_SILENT "Sound [silent]" -#define MSG_SOUND_MODE_BLIND "Sound [blind]" +#define MSG_SOUND_MODE_BLIND "Sound [blind]" #define e_SOUND_MODE_NULL 0xFF diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 027d0409..b4f61333 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -828,7 +828,7 @@ # "Press the knob" -"Stisknete hl. tlacitko" +"Stisknete tlacitko" #MSG_PRINT_PAUSED c=20 r=1 "Print paused" From 8fb30f886a6090fa5bab5beb73a63af3a82e6c28 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Mon, 15 Jul 2019 14:30:21 +0200 Subject: [PATCH 09/30] octoprint stop fix --- Firmware/Marlin_main.cpp | 6 +++++- Firmware/temperature.cpp | 2 +- Firmware/ultralcd.cpp | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bde7239..6f43c7f8 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6734,6 +6734,10 @@ Sigma_Exit: } break; + case 603: { //! M603 - Stop print + lcd_print_stop(); + } + #ifdef PINDA_THERMISTOR case 860: // M860 - Wait for PINDA thermistor to reach target temperature. { @@ -9501,7 +9505,6 @@ void restore_print_from_ram_and_continue(float e_move) card.setIndex(saved_sdpos); sdpos_atomic = saved_sdpos; card.sdprinting = true; - printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this } else if (saved_printing_type == PRINTING_TYPE_USB) { //was usb printing gcode_LastN = saved_sdpos; //saved_sdpos was reused for storing line number when usb printing @@ -9511,6 +9514,7 @@ void restore_print_from_ram_and_continue(float e_move) else { //not sd printing nor usb printing } + printf_P(PSTR("ok\n")); //dummy response because of octoprint is waiting for this lcd_setstatuspgm(_T(WELCOME_MSG)); saved_printing = false; } diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 779bee32..536e96bf 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -547,7 +547,7 @@ void fanSpeedError(unsigned char _fan) { } else { fan_check_error = EFCE_DETECTED; - + SERIAL_ECHOLNPGM("// action:pause"); //for octoprint } } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e1d9e0ab..e8790886 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6952,7 +6952,6 @@ void lcd_print_stop() if(!card.sdprinting) { SERIAL_ECHOLNPGM("// action:cancel"); // for Octoprint - return; } saved_printing = false; cancel_heatup = true; From 549a8a1a6b56b38c661f4079fc43262afef7d608 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 16:23:16 +0200 Subject: [PATCH 10/30] Restore print fan speed earlier then nozzle temperature. Avoids nozzle temperature dip when fan is turned on. --- Firmware/Marlin_main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bde7239..81e87ea1 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9456,10 +9456,11 @@ void stop_and_save_print_to_ram(float z_move, float e_move) //! @brief Restore print from ram //! -//! Restore print saved by stop_and_save_print_to_ram(). Is blocking, -//! waits for extruder temperature restore, then restores position and continues -//! print moves. -//! Internaly lcd_update() is called by wait_for_heater(). +//! Restore print saved by stop_and_save_print_to_ram(). Is blocking, restores +//! print fan speed, waits for extruder temperature restore, then restores +//! position and continues print moves. +//! +//! Internally lcd_update() is called by wait_for_heater(). //! //! @param e_move void restore_print_from_ram_and_continue(float e_move) @@ -9474,6 +9475,7 @@ void restore_print_from_ram_and_continue(float e_move) // for (int axis = X_AXIS; axis <= E_AXIS; axis++) // current_position[axis] = st_get_position_mm(axis); active_extruder = saved_active_extruder; //restore active_extruder + fanSpeed = saved_fanSpeed; if (saved_extruder_temperature) { setTargetHotendSafe(saved_extruder_temperature, saved_active_extruder); heating_status = 1; @@ -9482,7 +9484,6 @@ void restore_print_from_ram_and_continue(float e_move) } feedrate = saved_feedrate2; //restore feedrate axis_relative_modes[E_AXIS] = saved_extruder_relative_mode; - fanSpeed = saved_fanSpeed; float e = saved_pos[E_AXIS] - e_move; plan_set_e_position(e); //first move print head in XY to the saved position: From ab4e7896885575a5046916be2ef1634053e37a36 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 17:22:39 +0200 Subject: [PATCH 11/30] Partially revert "aeed49a Fix filament runout on optical filament sensors" Revert plan move to filament change position before enqued M600. This was workaround to problem that restore_print_from_ram_and_continue() did 3s heating pause before resuming print. This problem will be fixed properly in restore_print_from_ram_and_continue() in next commit. Save 166B of FLASH. --- Firmware/fsensor.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index fd7936ee..f20f647d 100755 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -522,19 +522,6 @@ void fsensor_st_block_chunk(block_t* bl, int cnt) } } -//! This ensures generating z-position at least 25mm above the heat bed. -//! Making this a template enables changing the computation data type easily at all spots where necessary. -//! @param current_z current z-position -//! @return z-position at least 25mm above the heat bed plus FILAMENTCHANGE_ZADD -template -inline T fsensor_clamp_z(float current_z){ - T z( current_z ); - if(z < T(25)){ // make sure the compiler understands, that the constant 25 is of correct type - // - necessary for uint8_t -> results in shorter code - z = T(25); // move to at least 25mm above heat bed - } - return z + T(FILAMENTCHANGE_ZADD); // always move above the printout by FILAMENTCHANGE_ZADD (default 2mm) -} //! Common code for enqueing M600 and supplemental codes into the command queue. //! Used both for the IR sensor and the PAT9125 @@ -545,22 +532,6 @@ void fsensor_enque_M600(){ enquecommand_front_P(PSTR("PRUSA fsensor_recover")); fsensor_m600_enqueued = true; enquecommand_front_P((PSTR("M600"))); -#define xstr(a) str(a) -#define str(a) #a - static const char gcodeMove[] PROGMEM = - "G1 X" xstr(FILAMENTCHANGE_XPOS) - " Y" xstr(FILAMENTCHANGE_YPOS) - " Z%u"; -#undef str -#undef xstr - char buf[32]; - // integer arithmetics is far shorter, I don't need a precise float position here, just move a bit above - // 8bit arithmetics in fsensor_clamp_z is 10B shorter than 16bit (not talking about float ;) ) - // The compile-time static_assert here ensures, that the computation gets enough bits in case of Z-range too high, - // i.e. makes the user change the data type, which also results in larger code - static_assert(Z_MAX_POS < (255 - FILAMENTCHANGE_ZADD), "Z-range too high, change fsensor_clamp_z to "); - sprintf_P(buf, gcodeMove, fsensor_clamp_z(current_position[Z_AXIS]) ); - enquecommand_front(buf, false); } //! @brief filament sensor update (perform M600 on filament runout) From 9083d151b2b3387b68e096f3b199525b9113e784 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 18:07:05 +0200 Subject: [PATCH 12/30] wait_for_heater() in restore_print_from_ram_and_continue() only if saved_extruder_temperature differs from target hot-end temperature. This fixes problem, that restore_print_from_ram_and_continue() blocked for heating for at least TEMP_RESIDENCY_TIME (3 seconds) even if temperature was resumed by M600 command. --- 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 81e87ea1..7372dae9 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9476,7 +9476,8 @@ void restore_print_from_ram_and_continue(float e_move) // current_position[axis] = st_get_position_mm(axis); active_extruder = saved_active_extruder; //restore active_extruder fanSpeed = saved_fanSpeed; - if (saved_extruder_temperature) { + if (degTargetHotend(saved_active_extruder) != saved_extruder_temperature) + { setTargetHotendSafe(saved_extruder_temperature, saved_active_extruder); heating_status = 1; wait_for_heater(_millis(), saved_active_extruder); From f0727214ed11cc8872409d94349f150c7be962ee Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Mon, 15 Jul 2019 19:15:15 +0200 Subject: [PATCH 13/30] Document --- Firmware/temperature.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Firmware/temperature.h b/Firmware/temperature.h index 27a7e713..e9ba11b4 100755 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -122,6 +122,7 @@ inline void babystepsTodoZsubtract(int n) //inline so that there is no performance decrease. //deg=degreeCelsius +// Doesn't save FLASH when FORCE_INLINE removed. FORCE_INLINE float degHotend(uint8_t extruder) { return current_temperature[extruder]; }; @@ -140,6 +141,7 @@ FORCE_INLINE float degBed() { return current_temperature_bed; }; +// Doesn't save FLASH when FORCE_INLINE removed. FORCE_INLINE float degTargetHotend(uint8_t extruder) { return target_temperature[extruder]; }; @@ -148,11 +150,13 @@ FORCE_INLINE float degTargetBed() { return target_temperature_bed; }; +// Doesn't save FLASH when FORCE_INLINE removed. FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t extruder) { target_temperature[extruder] = celsius; resetPID(extruder); }; +// Doesn't save FLASH when not inlined. static inline void setTargetHotendSafe(const float &celsius, uint8_t extruder) { if (extruder Date: Mon, 15 Jul 2019 20:32:58 +0300 Subject: [PATCH 14/30] Lcd optimization - 1K of flash saved --- Firmware/Marlin_main.cpp | 14 +- Firmware/lcd.cpp | 276 +++++++++++++++------------------------ Firmware/lcd.h | 42 +----- Firmware/ultralcd.cpp | 97 +++++++------- lang/lang_en.txt | 4 +- lang/lang_en_cz.txt | 8 +- lang/lang_en_de.txt | 8 +- lang/lang_en_es.txt | 8 +- lang/lang_en_fr.txt | 8 +- lang/lang_en_it.txt | 8 +- lang/lang_en_pl.txt | 8 +- 11 files changed, 190 insertions(+), 291 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 3bde7239..e4698df4 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -775,12 +775,8 @@ int uart_putchar(char c, FILE *) void lcd_splash() { -// lcd_puts_at_P(0, 1, PSTR(" Original Prusa ")); -// lcd_puts_at_P(0, 2, PSTR(" 3D Printers ")); -// lcd_puts_P(PSTR("\x1b[1;3HOriginal Prusa\x1b[2;4H3D Printers")); -// fputs_P(PSTR(ESC_2J ESC_H(1,1) "Original Prusa i3" ESC_H(3,2) "Prusa Research"), lcdout); - lcd_puts_P(PSTR(ESC_2J ESC_H(1,1) "Original Prusa i3" ESC_H(3,2) "Prusa Research")); -// lcd_printf_P(_N(ESC_2J "x:%.3f\ny:%.3f\nz:%.3f\ne:%.3f"), _x, _y, _z, _e); + lcd_clear(); // clears display and homes screen + lcd_puts_P(PSTR("\n Original Prusa i3\n Prusa Research")); } @@ -910,7 +906,7 @@ void update_sec_lang_from_external_flash() uint32_t src_addr; if (lang_get_header(lang, &header, &src_addr)) { - fputs_P(PSTR(ESC_H(1,3) "Language update."), lcdout); + lcd_puts_at_P(1,3,PSTR("Language update.")); for (uint8_t i = 0; i < state; i++) fputc('.', lcdout); _delay(100); boot_reserved = (state + 1) | (lang << 4); @@ -984,8 +980,8 @@ void list_sec_lang_from_external_flash() static void w25x20cl_err_msg() { - lcd_puts_P(_n(ESC_2J ESC_H(0,0) "External SPI flash" ESC_H(0,1) "W25X20CL is not res-" - ESC_H(0,2) "ponding. Language" ESC_H(0,3) "switch unavailable.")); + lcd_clear(); + lcd_puts_P(_n("External SPI flash\nW25X20CL is not res-\nponding. Language\nswitch unavailable.")); } // "Setup" function is called by the Arduino framework on startup. diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 5bd7cad6..4df14bfb 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -16,6 +16,13 @@ //-// #include "sound.h" +#define LCD_DEFAULT_DELAY 100 + +#if (defined(LCD_PINS_D0) && defined(LCD_PINS_D1) && defined(LCD_PINS_D2) && defined(LCD_PINS_D3)) + #define LCD_8BIT +#endif + +// #define VT100 // commands #define LCD_CLEARDISPLAY 0x01 @@ -55,73 +62,63 @@ #define LCD_5x10DOTS 0x04 #define LCD_5x8DOTS 0x00 +// bitmasks for flag argument settings +#define LCD_RS_FLAG 0x01 +#define LCD_HALF_FLAG 0x02 FILE _lcdout; // = {0}; Global variable is always zero initialized, no need to explicitly state that. +uint8_t lcd_displayfunction = 0; +uint8_t lcd_displaycontrol = 0; +uint8_t lcd_displaymode = 0; -uint8_t lcd_rs_pin; // LOW: command. HIGH: character. -uint8_t lcd_rw_pin; // LOW: write to LCD. HIGH: read from LCD. -uint8_t lcd_enable_pin; // activated by a HIGH pulse. -uint8_t lcd_data_pins[8]; - -uint8_t lcd_displayfunction; -uint8_t lcd_displaycontrol; -uint8_t lcd_displaymode; - -uint8_t lcd_numlines; uint8_t lcd_currline; +#ifdef VT100 uint8_t lcd_escape[8]; - +#endif void lcd_pulseEnable(void) -{ - digitalWrite(lcd_enable_pin, LOW); - delayMicroseconds(1); - digitalWrite(lcd_enable_pin, HIGH); - delayMicroseconds(1); // enable pulse must be >450ns - digitalWrite(lcd_enable_pin, LOW); - delayMicroseconds(100); // commands need > 37us to settle +{ + WRITE(LCD_PINS_ENABLE,HIGH); + _delay_us(1); // enable pulse must be >450ns + WRITE(LCD_PINS_ENABLE,LOW); } -void lcd_write4bits(uint8_t value) +void lcd_writebits(uint8_t value) { - for (int i = 0; i < 4; i++) - { - pinMode(lcd_data_pins[i], OUTPUT); - digitalWrite(lcd_data_pins[i], (value >> i) & 0x01); - } +#ifdef LCD_8BIT + WRITE(LCD_PINS_D0, value & 0x01); + WRITE(LCD_PINS_D1, value & 0x02); + WRITE(LCD_PINS_D2, value & 0x04); + WRITE(LCD_PINS_D3, value & 0x08); +#endif + WRITE(LCD_PINS_D4, value & 0x10); + WRITE(LCD_PINS_D5, value & 0x20); + WRITE(LCD_PINS_D6, value & 0x40); + WRITE(LCD_PINS_D7, value & 0x80); + lcd_pulseEnable(); } -void lcd_write8bits(uint8_t value) +void lcd_send(uint8_t data, uint8_t flags, uint16_t duration = LCD_DEFAULT_DELAY) { - for (int i = 0; i < 8; i++) + WRITE(LCD_PINS_RS,flags&LCD_RS_FLAG); + _delay_us(5); + lcd_writebits(data); +#ifndef LCD_8BIT + if (!(flags & LCD_HALF_FLAG)) { - pinMode(lcd_data_pins[i], OUTPUT); - digitalWrite(lcd_data_pins[i], (value >> i) & 0x01); + _delay_us(LCD_DEFAULT_DELAY); + lcd_writebits(data<<4); } - lcd_pulseEnable(); +#endif + delayMicroseconds(duration); } -// write either command or data, with automatic 4/8-bit selection -void lcd_send(uint8_t value, uint8_t mode) +void lcd_command(uint8_t value, uint16_t delayExtra = 0) { - digitalWrite(lcd_rs_pin, mode); - // if there is a RW pin indicated, set it low to Write - if (lcd_rw_pin != 255) digitalWrite(lcd_rw_pin, LOW); - if (lcd_displayfunction & LCD_8BITMODE) - lcd_write8bits(value); - else - { - lcd_write4bits(value>>4); - lcd_write4bits(value); - } -} - -void lcd_command(uint8_t value) -{ - lcd_send(value, LOW); + lcd_send(value, LOW, LCD_DEFAULT_DELAY + delayExtra); } void lcd_clear(void); @@ -141,141 +138,98 @@ void lcd_no_autoscroll(void); void lcd_set_cursor(uint8_t col, uint8_t row); void lcd_createChar_P(uint8_t location, const uint8_t* charmap); -uint8_t lcd_escape_write(uint8_t chr); +#ifdef VT100 +void lcd_escape_write(uint8_t chr); +#endif -uint8_t lcd_write(uint8_t value) +void lcd_write(uint8_t value) { - if (value == '\n') + if (value == '\n' || value == '\r') { if (lcd_currline > 3) lcd_currline = -1; lcd_set_cursor(0, lcd_currline + 1); // LF - return 1; + return; } - if (lcd_escape[0] || (value == 0x1b)) - return lcd_escape_write(value); + #ifdef VT100 + if (lcd_escape[0] || (value == 0x1b)){ + lcd_escape_write(value); + return; + } + #endif lcd_send(value, HIGH); - return 1; // assume sucess } -static void lcd_begin(uint8_t lines, uint8_t dotsize, uint8_t clear) +static void lcd_begin(uint8_t clear) { - if (lines > 1) lcd_displayfunction |= LCD_2LINE; - lcd_numlines = lines; lcd_currline = 0; - // for some 1 line displays you can select a 10 pixel high font - if ((dotsize != 0) && (lines == 1)) lcd_displayfunction |= LCD_5x10DOTS; - // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION! - // according to datasheet, we need at least 40ms after power rises above 2.7V - // before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50 - _delay_us(50000); - // Now we pull both RS and R/W low to begin commands - digitalWrite(lcd_rs_pin, LOW); - digitalWrite(lcd_enable_pin, LOW); - if (lcd_rw_pin != 255) - digitalWrite(lcd_rw_pin, LOW); - //put the LCD into 4 bit or 8 bit mode - if (!(lcd_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 - lcd_write4bits(0x03); - _delay_us(4500); // wait min 4.1ms - // second try - lcd_write4bits(0x03); - _delay_us(4500); // wait min 4.1ms - // third go! - lcd_write4bits(0x03); - _delay_us(150); - // finally, set to 4-bit interface - lcd_write4bits(0x02); - } - else - { - // this is according to the hitachi HD44780 datasheet - // page 45 figure 23 - // Send function set command sequence - lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); - _delay_us(4500); // wait more than 4.1ms - // second try - lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); - _delay_us(150); - // third go - lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); - } - // finally, set # lines, font size, etc. - lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); - _delay_us(60); + + lcd_send(LCD_FUNCTIONSET | LCD_8BITMODE, LOW | LCD_HALF_FLAG, 4500); // wait min 4.1ms + // second try + lcd_send(LCD_FUNCTIONSET | LCD_8BITMODE, LOW | LCD_HALF_FLAG, 150); + // third go! + lcd_send(LCD_FUNCTIONSET | LCD_8BITMODE, LOW | LCD_HALF_FLAG, 150); +#ifndef LCD_8BIT + // set to 4-bit interface + lcd_send(LCD_FUNCTIONSET | LCD_4BITMODE, LOW | LCD_HALF_FLAG, 150); +#endif + + // finally, set # lines, font size, etc.0 + lcd_command(LCD_FUNCTIONSET | lcd_displayfunction); // turn the display on with no cursor or blinking default - lcd_displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF; + lcd_displaycontrol = LCD_CURSOROFF | LCD_BLINKOFF; lcd_display(); - _delay_us(60); // clear it off if (clear) lcd_clear(); - _delay_us(3000); // Initialize to default text direction (for romance languages) lcd_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; // set the entry mode lcd_command(LCD_ENTRYMODESET | lcd_displaymode); - _delay_us(60); + + #ifdef VT100 lcd_escape[0] = 0; + #endif } int lcd_putchar(char c, FILE *) { lcd_write(c); - return 0; } void lcd_init(void) { - uint8_t fourbitmode = 1; - lcd_rs_pin = LCD_PINS_RS; - lcd_rw_pin = 255; - lcd_enable_pin = LCD_PINS_ENABLE; - lcd_data_pins[0] = LCD_PINS_D4; - lcd_data_pins[1] = LCD_PINS_D5; - lcd_data_pins[2] = LCD_PINS_D6; - lcd_data_pins[3] = LCD_PINS_D7; - lcd_data_pins[4] = 0; - lcd_data_pins[5] = 0; - lcd_data_pins[6] = 0; - lcd_data_pins[7] = 0; - pinMode(lcd_rs_pin, OUTPUT); - // we can save 1 pin by not using RW. Indicate by passing 255 instead of pin# - if (lcd_rw_pin != 255) pinMode(lcd_rw_pin, OUTPUT); - pinMode(lcd_enable_pin, OUTPUT); - if (fourbitmode) lcd_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS; - else lcd_displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS; - lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 1); - //lcd_clear(); + SET_OUTPUT(LCD_PINS_RS); + SET_OUTPUT(LCD_PINS_ENABLE); +#ifdef LCD_8BIT + lcd_displayfunction |= LCD_8BITMODE; +#endif + lcd_displayfunction |= LCD_2LINE; + _delay_us(50000); + lcd_begin(1); //first time init fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream } void lcd_refresh(void) { - lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 1); + lcd_begin(1); lcd_set_custom_characters(); } void lcd_refresh_noclear(void) { - lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 0); + lcd_begin(0); lcd_set_custom_characters(); } - - void lcd_clear(void) { - lcd_command(LCD_CLEARDISPLAY); // clear display, set cursor position to zero - _delay_us(1600); // this command takes a long time + lcd_command(LCD_CLEARDISPLAY, 1600); // clear display, set cursor position to zero + lcd_currline = 0; } void lcd_home(void) { - lcd_command(LCD_RETURNHOME); // set cursor position to zero - _delay_us(1600); // this command takes a long time! + lcd_command(LCD_RETURNHOME, 1600); // set cursor position to zero + lcd_currline = 0; } // Turn the display on/off (quickly) @@ -359,8 +313,8 @@ void lcd_no_autoscroll(void) void lcd_set_cursor(uint8_t col, uint8_t row) { int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }; - if ( row >= lcd_numlines ) - row = lcd_numlines-1; // we count rows starting w/0 + if (row >= LCD_HEIGHT) + row = LCD_HEIGHT - 1; // we count rows starting w/0 lcd_currline = row; lcd_command(LCD_SETDDRAMADDR | (col + row_offsets[row])); } @@ -375,12 +329,14 @@ void lcd_createChar_P(uint8_t location, const uint8_t* charmap) lcd_send(pgm_read_byte(&charmap[i]), HIGH); } +#ifdef VT100 + //Supported VT100 escape codes: //EraseScreen "\x1b[2J" //CursorHome "\x1b[%d;%dH" //CursorShow "\x1b[?25h" //CursorHide "\x1b[?25l" -uint8_t lcd_escape_write(uint8_t chr) +void lcd_escape_write(uint8_t chr) { #define escape_cnt (lcd_escape[0]) //escape character counter #define is_num_msk (lcd_escape[1]) //numeric character bit mask @@ -410,26 +366,26 @@ uint8_t lcd_escape_write(uint8_t chr) switch (escape_cnt++) { case 0: - if (chr == 0x1b) return 1; // escape = "\x1b" + if (chr == 0x1b) return; // escape = "\x1b" break; case 1: is_num_msk = 0x00; // reset 'is number' bit mask - if (chr == '[') return 1; // escape = "\x1b[" + if (chr == '[') return; // escape = "\x1b[" break; case 2: switch (chr) { - case '2': return 1; // escape = "\x1b[2" - case '?': return 1; // escape = "\x1b[?" + case '2': return; // escape = "\x1b[2" + case '?': return; // escape = "\x1b[?" default: - if (chr_is_num) return 1; // escape = "\x1b[%1d" + if (chr_is_num) return; // escape = "\x1b[%1d" } break; case 3: switch (lcd_escape[2]) { case '?': // escape = "\x1b[?" - if (chr == '2') return 1; // escape = "\x1b[?2" + if (chr == '2') return; // escape = "\x1b[?2" break; case '2': if (chr == 'J') // escape = "\x1b[2J" @@ -438,20 +394,20 @@ uint8_t lcd_escape_write(uint8_t chr) if (e_2_is_num && // escape = "\x1b[%1d" ((chr == ';') || // escape = "\x1b[%1d;" chr_is_num)) // escape = "\x1b[%2d" - return 1; + return; } break; case 4: switch (lcd_escape[2]) { case '?': // "\x1b[?" - if ((lcd_escape[3] == '2') && (chr == '5')) return 1; // escape = "\x1b[?25" + if ((lcd_escape[3] == '2') && (chr == '5')) return; // escape = "\x1b[?25" break; default: if (e_2_is_num) // escape = "\x1b[%1d" { - if ((lcd_escape[3] == ';') && chr_is_num) return 1; // escape = "\x1b[%1d;%1d" - else if (e_3_is_num && (chr == ';')) return 1; // escape = "\x1b[%2d;" + if ((lcd_escape[3] == ';') && chr_is_num) return; // escape = "\x1b[%1d;%1d" + else if (e_3_is_num && (chr == ';')) return; // escape = "\x1b[%2d;" } } break; @@ -478,10 +434,10 @@ uint8_t lcd_escape_write(uint8_t chr) if (chr == 'H') // escape = "\x1b%1d;%1dH" lcd_set_cursor(e4_num, e2_num); // CursorHome else if (chr_is_num) - return 1; // escape = "\x1b%1d;%2d" + return; // escape = "\x1b%1d;%2d" } else if (e_3_is_num && (lcd_escape[4] == ';') && chr_is_num) - return 1; // escape = "\x1b%2d;%1d" + return; // escape = "\x1b%2d;%1d" } } break; @@ -495,7 +451,7 @@ uint8_t lcd_escape_write(uint8_t chr) if (chr == 'H') // escape = "\x1b%2d;%1dH" lcd_set_cursor(e5_num, e23_num); // CursorHome else if (chr_is_num) // "\x1b%2d;%2d" - return 1; + return; } } break; @@ -506,10 +462,9 @@ uint8_t lcd_escape_write(uint8_t chr) break; } escape_cnt = 0; // reset escape - return 1; // assume sucess } - +#endif //VT100 int lcd_putc(int c) @@ -648,16 +603,6 @@ void lcd_printFloat(double number, uint8_t digits) } - - - - - - - - - - uint8_t lcd_draw_update = 2; int32_t lcd_encoder = 0; uint8_t lcd_encoder_bits = 0; @@ -710,7 +655,7 @@ Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); for(int8_t i = 0; i < 10; i++) { Sound_MakeCustom(100,0,false); - delayMicroseconds(100); + _delay_us(100); } */ } @@ -722,13 +667,6 @@ void lcd_quick_feedback(void) lcd_beeper_quick_feedback(); } - - - - - - - void lcd_update(uint8_t lcdDrawUpdateOverride) { if (lcd_draw_update < lcdDrawUpdateOverride) diff --git a/Firmware/lcd.h b/Firmware/lcd.h index 9f3eb5c1..d4d978f2 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -13,20 +13,16 @@ extern FILE _lcdout; #define lcdout (&_lcdout) extern int lcd_putchar(char c, FILE *stream); - extern void lcd_init(void); extern void lcd_refresh(void); extern void lcd_refresh_noclear(void); - - extern void lcd_clear(void); extern void lcd_home(void); - /*extern void lcd_no_display(void); extern void lcd_display(void); extern void lcd_no_blink(void); @@ -45,7 +41,6 @@ extern void lcd_set_cursor(uint8_t col, uint8_t row); extern void lcd_createChar_P(uint8_t, const uint8_t*); - extern int lcd_putc(int c); extern int lcd_puts_P(const char* str); extern int lcd_puts_at_P(uint8_t c, uint8_t r, const char* str); @@ -66,7 +61,9 @@ extern void lcd_print(double, int = 2); //! @brief Clear screen #define ESC_2J "\x1b[2J" +//! @brief Show cursor #define ESC_25h "\x1b[?25h" +//! @brief Hide cursor #define ESC_25l "\x1b[?25l" //! @brief Set cursor to //! @param c column @@ -118,9 +115,6 @@ extern lcd_lcdupdate_func_t lcd_lcdupdate_func; - - - extern uint8_t lcd_clicked(void); extern void lcd_beeper_quick_feedback(void); @@ -128,13 +122,6 @@ extern void lcd_beeper_quick_feedback(void); //Cause an LCD refresh, and give the user visual or audible feedback that something has happened extern void lcd_quick_feedback(void); - - - - - - - extern void lcd_update(uint8_t lcdDrawUpdateOverride); extern void lcd_update_enable(uint8_t enabled); @@ -165,29 +152,6 @@ private: }; - - - - - - - - - - - - - - - - - -/** -* Implementation of the LCD display routines for a Hitachi HD44780 display. These are common LCD character displays. -* When selecting the Russian language, a slightly different LCD implementation is used to handle UTF8 characters. -**/ - - //////////////////////////////////// // Setup button and encode mappings for each panel (into 'lcd_buttons' variable // @@ -223,8 +187,6 @@ private: #define encrot3 1 - - //Custom characters defined in the first 8 characters of the LCD #define LCD_STR_BEDTEMP "\x00" #define LCD_STR_DEGREE "\x01" diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e1d9e0ab..c9759323 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1771,8 +1771,8 @@ void lcd_menu_extruder_info() // NOT static due to using ins lcd_timeoutToStatus.stop(); //infinite timeout + lcd_home(); lcd_printf_P(_N( - ESC_H(0,0) "%S: %4d RPM\n" "%S: %4d RPM\n" ), @@ -1833,8 +1833,8 @@ static void lcd_menu_fails_stats_mmu_print() lcd_timeoutToStatus.stop(); //infinite timeout uint8_t fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL); uint16_t load_fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL); -// lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY); - lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3)), _i("Last print failures"), _i("MMU fails"), fails, _i("MMU load fails"), load_fails); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " %S %-3d\n" " %S %-3d"), _i("Last print failures"), _i("MMU fails"), fails, _i("MMU load fails"), load_fails); menu_back_if_clicked_fb(); } @@ -1850,8 +1850,8 @@ static void lcd_menu_fails_stats_mmu_total() lcd_timeoutToStatus.stop(); //infinite timeout uint8_t fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL_TOT); uint16_t load_fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL_TOT); -// lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY); - lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3) "%S %-3d"), _i("Total failures"), _i("MMU fails"), fails, _i("MMU load fails"), load_fails, _i("MMU power fails"), mmu_power_failures); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " %S %-3d\n" " %S %-3d\n" " %S %-3d"), _i("Total failures"), _i("MMU fails"), fails, _i("MMU load fails"), load_fails, _i("MMU power fails"), mmu_power_failures); menu_back_if_clicked_fb(); } @@ -1869,8 +1869,8 @@ static void lcd_menu_fails_stats_total() uint16_t filam = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); uint16_t crashX = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT); uint16_t crashY = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT); -// lcd_printf_P(PSTR(ESC_H(0,0) "Total failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY); - lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3) "%S X %-3d Y %-3d"), _i("Total failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " %S %-3d\n" " %S %-3d\n" " %S X %-3d Y %-3d"), _i("Total failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY); menu_back_if_clicked_fb(); } @@ -1887,8 +1887,8 @@ static void lcd_menu_fails_stats_print() uint8_t filam = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT); uint8_t crashX = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_X); uint8_t crashY = eeprom_read_byte((uint8_t*)EEPROM_CRASH_COUNT_Y); -// lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Power failures %-3d" ESC_H(1,2) "Filam. runouts %-3d" ESC_H(1,3) "Crash X %-3d Y %-3d"), power, filam, crashX, crashY); - lcd_printf_P(PSTR(ESC_H(0,0) "%S" ESC_H(1,1) "%S %-3d" ESC_H(1,2) "%S %-3d" ESC_H(1,3) "%S X %-3d Y %-3d"), _i("Last print failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " %S %-3d\n" " %S %-3d\n" " %S X %-3d Y %-3d"), _i("Last print failures"), _i("Power failures"), power, _i("Filam. runouts"), filam, _i("Crash"), crashX, crashY); menu_back_if_clicked_fb(); } @@ -1929,7 +1929,8 @@ static void lcd_menu_fails_stats() lcd_timeoutToStatus.stop(); //infinite timeout uint8_t filamentLast = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT); uint16_t filamentTotal = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); - lcd_printf_P(PSTR(ESC_H(0,0) "Last print failures" ESC_H(1,1) "Filam. runouts %-3d" ESC_H(0,2) "Total failures" ESC_H(1,3) "Filam. runouts %-3d"), filamentLast, filamentTotal); + lcd_home(); + lcd_printf_P(PSTR("Last print failures\n" " Filam. runouts %-3d\n" "Total failures\n" " Filam. runouts %-3d"), filamentLast, filamentTotal); menu_back_if_clicked(); } #else @@ -1953,7 +1954,8 @@ extern char* __malloc_heap_end; static void lcd_menu_debug() { #ifdef DEBUG_STACK_MONITOR - lcd_printf_P(PSTR(ESC_H(1,1) "RAM statistics" ESC_H(5,1) "SP_min: 0x%04x" ESC_H(1,2) "heap_start: 0x%04x" ESC_H(3,3) "heap_end: 0x%04x"), SP_min, __malloc_heap_start, __malloc_heap_end); + lcd_home(); + lcd_printf_P(PSTR("RAM statistics\n" " SP_min: 0x%04x\n" " heap_start: 0x%04x\n" " heap_end: 0x%04x"), SP_min, __malloc_heap_start, __malloc_heap_end); #endif //DEBUG_STACK_MONITOR menu_back_if_clicked_fb(); @@ -1963,12 +1965,13 @@ static void lcd_menu_debug() static void lcd_menu_temperatures() { lcd_timeoutToStatus.stop(); //infinite timeout - - lcd_printf_P(PSTR(ESC_H(1,0) "%S: %d%c" ESC_H(1,1) "%S: %d%c"), _i("Nozzle"), (int)current_temperature[0], '\x01', _i("Bed"), (int)current_temperature_bed, '\x01'); + + lcd_home(); + lcd_printf_P(PSTR(" %S: %d%c \n" " %S: %d%c \n"), _i("Nozzle"), (int)current_temperature[0], '\x01', _i("Bed"), (int)current_temperature_bed, '\x01'); #ifdef AMBIENT_THERMISTOR - lcd_printf_P(PSTR(ESC_H(1,2) "%S: %d%c" ESC_H(1,3) "PINDA: %d%c"), _i("Ambient"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01'); + lcd_printf_P(PSTR(" %S: %d%c\n" " PINDA: %d%c"), _i("Ambient"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01'); #else //AMBIENT_THERMISTOR - lcd_printf_P(PSTR(ESC_H(1,2) "PINDA: %d%c"), (int)current_temperature_pinda, '\x01'); + lcd_printf_P(PSTR(" PINDA: %d%c"), (int)current_temperature_pinda, '\x01'); #endif //AMBIENT_THERMISTOR menu_back_if_clicked(); @@ -1984,7 +1987,8 @@ static void lcd_menu_voltages() lcd_timeoutToStatus.stop(); //infinite timeout float volt_pwr = VOLT_DIV_REF * ((float)current_voltage_raw_pwr / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC; float volt_bed = VOLT_DIV_REF * ((float)current_voltage_raw_bed / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC; - lcd_printf_P(PSTR(ESC_H(1,1)"PWR: %d.%01dV" ESC_H(1,2)"BED: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr)), (int)volt_bed, (int)(10*fabs(volt_bed - (int)volt_bed))); + lcd_home(); + lcd_printf_P(PSTR(" PWR: %d.%01dV\n" " BED: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr)), (int)volt_bed, (int)(10*fabs(volt_bed - (int)volt_bed))); menu_back_if_clicked(); } #endif //defined VOLT_BED_PIN || defined VOLT_PWR_PIN @@ -1992,7 +1996,8 @@ static void lcd_menu_voltages() #ifdef TMC2130 static void lcd_menu_belt_status() { - lcd_printf_P(PSTR(ESC_H(1,0) "%S" ESC_H(2,1) "X %d" ESC_H(2,2) "Y %d" ), _i("Belt status"), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y))); + lcd_home(); + lcd_printf_P(PSTR("%S\n" " X %d\n" " Y %d"), _i("Belt status"), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y))); menu_back_if_clicked(); } #endif //TMC2130 @@ -2817,18 +2822,14 @@ void lcd_menu_statistics() const int _m = (_t - (_h * 3600ul)) / 60ul; const int _s = _t - ((_h * 3600ul) + (_m * 60ul)); + lcd_clear(); lcd_printf_P(_N( - ESC_2J - "%S:" - ESC_H(6,1) "%8.2fm \n" - "%S :" - ESC_H(8,3) "%2dh %02dm %02ds" - ), - _i("Filament used"), - _met, - _i("Print time"), - _h, _m, _s - ); + "%S:\n" + "%8.2fm\n" + "%S:\n" + "%2dh %02dm %02ds" + ),_i("Filament used"), _met, _i("Print time"), _h, _m, _s); + menu_back_if_clicked_fb(); } else @@ -2844,18 +2845,14 @@ void lcd_menu_statistics() _hours = (_time - (_days * 1440)) / 60; _minutes = _time - ((_days * 1440) + (_hours * 60)); + lcd_clear(); lcd_printf_P(_N( - ESC_2J - "%S :" - ESC_H(9,1) "%8.2f m\n" - "%S :\n" - "%7ldd :%2hhdh :%02hhd m" - ), - _i("Total filament"), - _filament_m, - _i("Total print time"), - _days, _hours, _minutes - ); + "%S:\n" + "%8.2fm\n" + "%S:\n" + "%7ldd :%2hhdh :%02hhdm" + ), _i("Total filament"), _filament_m, _i("Total print time"), _days, _hours, _minutes); + KEEPALIVE_STATE(PAUSED_FOR_USER); while (!lcd_clicked()) { @@ -2953,8 +2950,8 @@ static void lcd_menu_xyz_y_min() //---------------------- float distanceMin[2]; count_xyz_details(distanceMin); + lcd_home(); lcd_printf_P(_N( - ESC_H(0,0) "%S:\n" "%S\n" "%S:\n" @@ -2990,8 +2987,8 @@ static void lcd_menu_xyz_skew() //|Severe skew: 0.25d| //---------------------- float angleDiff = eeprom_read_float((float*)(EEPROM_XYZ_CAL_SKEW)); + lcd_home(); lcd_printf_P(_N( - ESC_H(0,0) "%S:\n" "%S\n" "%S: %5.2f\x01\n" @@ -3002,10 +2999,14 @@ static void lcd_menu_xyz_skew() _i("Slight skew"), _deg(bed_skew_angle_mild), _i("Severe skew"), _deg(bed_skew_angle_extreme) ); - if (angleDiff < 100) - lcd_printf_P(_N(ESC_H(15,0)"%4.2f\x01"), _deg(angleDiff)); - else - lcd_puts_P(_N(ESC_H(15,0)"N/A")); + if (angleDiff < 100){ + lcd_set_cursor(15,0); + lcd_printf_P(_N("%4.2f\x01"), _deg(angleDiff)); + } + else{ + lcd_set_cursor(15,0); + lcd_puts_P(_N("N/A")); + } if (lcd_clicked()) menu_goto(lcd_menu_xyz_offset, 0, true, true); } @@ -4355,7 +4356,8 @@ static void lcd_crash_mode_info() static uint32_t tim = 0; if ((tim + 1000) < _millis()) { - fputs_P(_i("\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode"), lcdout);////MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 + lcd_clear(); + fputs_P(_i("Crash detection can\rbe turned on only in\rNormal mode"), lcdout);////MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 tim = _millis(); } menu_back_if_clicked(); @@ -4367,7 +4369,8 @@ static void lcd_crash_mode_info2() static uint32_t tim = 0; if ((tim + 1000) < _millis()) { - fputs_P(_i("\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode"), lcdout);////MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 + lcd_clear(); + fputs_P(_i("WARNING:\rCrash detection\rdisabled in\rStealth mode"), lcdout);////MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 tim = _millis(); } menu_back_if_clicked(); diff --git a/lang/lang_en.txt b/lang/lang_en.txt index b8ea25d0..c8d35cce 100755 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -8,10 +8,10 @@ "[0;0] point offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" +"Crash detection can\rbe turned on only in\rNormal mode" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" # ">Cancel" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 027d0409..13a110a4 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -11,12 +11,12 @@ "[0;0] odsazeni bodu" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JCrash detekce muze\x1b[1;0Hbyt zapnuta pouze v\x1b[2;0HNormal modu" +Crash detection can\rbe turned on only in\rNormal mode" +Crash detekce muze\rbyt zapnuta pouze v\rNormal modu" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JPOZOR:\x1b[1;0HCrash detekce\x1b[2;0Hdeaktivovana ve\x1b[3;0HStealth modu" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +POZOR:\rCrash detekce\rdeaktivovana ve\rStealth modu" # ">Cancel" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index c4c80d93..55f0040d 100755 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -11,12 +11,12 @@ "[0;0] Punktversatz" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JCrash Erkennung kann\x1b[1;0Hnur im Modus Normal\x1b[2;0Hgenutzt werden" +Crash detection can\rbe turned on only in\rNormal mode" +Crash Erkennung kann\rnur im Modus Normal\rgenutzt werden" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JWARNUNG:\x1b[1;0HCrash Erkennung\x1b[2;0Hdeaktiviert im\x1b[3;0HStealth Modus" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +WARNUNG:\rCrash Erkennung\rdeaktiviert im\rStealth Modus" # ">Cancel" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 2f4dc251..ef402c5d 100755 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -11,12 +11,12 @@ "[0;0] punto offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JDec. choque\x1b[1;0Hpuede ser activada solo en\x1b[2;0HModo normal" +Crash detection can\rbe turned on only in\rNormal mode" +Dec. choque\rpuede ser activada solo en\rModo normal" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JATENCION:\x1b[1;0HDec. choque\x1b[2;0Hdesactivada en\x1b[3;0HModo silencio" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +ATENCION:\rDec. choque\rdesactivada en\rModo silencio" # ">Cancel" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index dfb0dd85..f7fb5857 100755 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -11,12 +11,12 @@ "Offset point [0;0]" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JLa detection de crash peut etre\x1b[1;0Hactive seulement\x1b[2;0Hen mode Normal" +Crash detection can\rbe turned on only in\rNormal mode" +La detection de crash peut etre\ractive seulement\ren mode Normal" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JATTENTION :\x1b[1;0HDetection de crash\x1b[2;0H desactivee en\x1b[3;0Hmode Furtif" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +ATTENTION :\rDetection de crash\r desactivee en\rmode Furtif" # ">Cancel" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 9637777f..ed327cef 100755 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -11,12 +11,12 @@ "[0;0] punto offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JRilev. impatto\x1b[1;0Hattivabile solo\x1b[2;0Hin Modalita normale" +Crash detection can\rbe turned on only in\rNormal mode" +Rilev. impatto\rattivabile solo\rin Modalita normale" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JATTENZIONE:\x1b[1;0HRilev. impatto\x1b[2;0Hdisattivato in\x1b[3;0HModalita silenziosa" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +ATTENZIONE:\rRilev. impatto\rdisattivato in\rModalita silenziosa" # ">Cancel" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index fe422cc3..6b34a3d3 100755 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -11,12 +11,12 @@ "[0;0] przesuniecie punktu" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -"\x1b[2JCrash detection can\x1b[1;0Hbe turned on only in\x1b[2;0HNormal mode" -"\x1b[2JWykrywanie zderzen moze\x1b[1;0Hbyc wlaczone tylko w\x1b[2;0Htrybie Normalnym" +Crash detection can\rbe turned on only in\rNormal mode" +Wykrywanie zderzen moze\rbyc wlaczone tylko w\rtrybie Normalnym" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -"\x1b[2JWARNING:\x1b[1;0HCrash detection\x1b[2;0Hdisabled in\x1b[3;0HStealth mode" -"\x1b[2JUWAGA:\x1b[1;0HWykrywanie zderzen\x1b[2;0Hwylaczone w\x1b[3;0Htrybie Stealth" +WARNING:\rCrash detection\rdisabled in\rStealth mode" +UWAGA:\rWykrywanie zderzen\rwylaczone w\rtrybie Stealth" # ">Cancel" From 0481db87d672093e9615927061aefa9652e3f5fd Mon Sep 17 00:00:00 2001 From: leptun Date: Tue, 16 Jul 2019 12:12:09 +0300 Subject: [PATCH 15/30] Fix missing commas --- lang/lang_en_cz.txt | 8 ++++---- lang/lang_en_de.txt | 8 ++++---- lang/lang_en_es.txt | 8 ++++---- lang/lang_en_fr.txt | 8 ++++---- lang/lang_en_it.txt | 8 ++++---- lang/lang_en_pl.txt | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 13a110a4..74bf63d0 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -11,12 +11,12 @@ "[0;0] odsazeni bodu" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Crash detekce muze\rbyt zapnuta pouze v\rNormal modu" +"Crash detection can\rbe turned on only in\rNormal mode" +"Crash detekce muze\rbyt zapnuta pouze v\rNormal modu" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -POZOR:\rCrash detekce\rdeaktivovana ve\rStealth modu" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"POZOR:\rCrash detekce\rdeaktivovana ve\rStealth modu" # ">Cancel" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 55f0040d..3c2c8a14 100755 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -11,12 +11,12 @@ "[0;0] Punktversatz" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Crash Erkennung kann\rnur im Modus Normal\rgenutzt werden" +"Crash detection can\rbe turned on only in\rNormal mode" +"Crash Erkennung kann\rnur im Modus Normal\rgenutzt werden" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -WARNUNG:\rCrash Erkennung\rdeaktiviert im\rStealth Modus" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"WARNUNG:\rCrash Erkennung\rdeaktiviert im\rStealth Modus" # ">Cancel" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index ef402c5d..3f4629e9 100755 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -11,12 +11,12 @@ "[0;0] punto offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Dec. choque\rpuede ser activada solo en\rModo normal" +"Crash detection can\rbe turned on only in\rNormal mode" +"Dec. choque\rpuede ser activada solo en\rModo normal" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -ATENCION:\rDec. choque\rdesactivada en\rModo silencio" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"ATENCION:\rDec. choque\rdesactivada en\rModo silencio" # ">Cancel" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index f7fb5857..2919f11f 100755 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -11,12 +11,12 @@ "Offset point [0;0]" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -La detection de crash peut etre\ractive seulement\ren mode Normal" +"Crash detection can\rbe turned on only in\rNormal mode" +"La detection de crash peut etre\ractive seulement\ren mode Normal" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -ATTENTION :\rDetection de crash\r desactivee en\rmode Furtif" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"ATTENTION :\rDetection de crash\r desactivee en\rmode Furtif" # ">Cancel" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index ed327cef..0726fef2 100755 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -11,12 +11,12 @@ "[0;0] punto offset" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Rilev. impatto\rattivabile solo\rin Modalita normale" +"Crash detection can\rbe turned on only in\rNormal mode" +"Rilev. impatto\rattivabile solo\rin Modalita normale" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -ATTENZIONE:\rRilev. impatto\rdisattivato in\rModalita silenziosa" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"ATTENZIONE:\rRilev. impatto\rdisattivato in\rModalita silenziosa" # ">Cancel" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index 6b34a3d3..6919d057 100755 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -11,12 +11,12 @@ "[0;0] przesuniecie punktu" #MSG_CRASH_DET_ONLY_IN_NORMAL c=20 r=4 -Crash detection can\rbe turned on only in\rNormal mode" -Wykrywanie zderzen moze\rbyc wlaczone tylko w\rtrybie Normalnym" +"Crash detection can\rbe turned on only in\rNormal mode" +"Wykrywanie zderzen moze\rbyc wlaczone tylko w\rtrybie Normalnym" #MSG_CRASH_DET_STEALTH_FORCE_OFF c=20 r=4 -WARNING:\rCrash detection\rdisabled in\rStealth mode" -UWAGA:\rWykrywanie zderzen\rwylaczone w\rtrybie Stealth" +"WARNING:\rCrash detection\rdisabled in\rStealth mode" +"UWAGA:\rWykrywanie zderzen\rwylaczone w\rtrybie Stealth" # ">Cancel" From 6b8a5bc3ac5c35ab038f7696a4c53bd09e2cd506 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 17:31:56 +0200 Subject: [PATCH 16/30] Fix compiler warnings sketch/tmc2130.cpp:146:42: warning: default argument given for parameter 1 of 'void tmc2130_init(bool)' [-fpermissive] sketch/tmc2130.cpp:146:24: warning: unused parameter 'bSupressFlag' [-Wunused-parameter] --- Firmware/tmc2130.cpp | 7 +++++-- Firmware/tmc2130.h | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index f9dee3be..15188fc4 100755 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -142,8 +142,11 @@ uint16_t __tcoolthrs(uint8_t axis) } return 0; } - -void tmc2130_init(bool bSupressFlag=false) +#ifdef PSU_Delta +void tmc2130_init(bool bSupressFlag) +#else +void tmc2130_init() +#endif { // DBG(_n("tmc2130_init(), mode=%S\n"), tmc2130_mode?_n("STEALTH"):_n("NORMAL")); WRITE(X_TMC2130_CS, HIGH); diff --git a/Firmware/tmc2130.h b/Firmware/tmc2130.h index a1d160f0..ed4c0d7c 100644 --- a/Firmware/tmc2130.h +++ b/Firmware/tmc2130.h @@ -51,7 +51,11 @@ typedef struct extern tmc2130_chopper_config_t tmc2130_chopper_config[4]; //initialize tmc2130 +#ifdef PSU_Delta extern void tmc2130_init(bool bSupressFlag=false); +#else +extern void tmc2130_init(); +#endif //check diag pins (called from stepper isr) extern void tmc2130_st_isr(); //update stall guard (called from st_synchronize inside the loop) From cee875fc6aef5b388c28d9244849298aa1128a7e Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 17:40:28 +0200 Subject: [PATCH 17/30] Fix compiler warnings: warning: enumeration value '_None' not handled in switch [-Wswitch] warning: enumeration value '_Undef' not handled in switch [-Wswitch] --- Firmware/util.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Firmware/util.cpp b/Firmware/util.cpp index b2105e92..fc6b0f0b 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -393,6 +393,9 @@ switch(oCheckMode) lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckMode::_None: + case ClCheckMode::_Undef: + break; } bSettings=false; // flag ('fake parameter') for 'lcd_checking_menu()' function menu_submenu(lcd_checking_menu); @@ -419,6 +422,9 @@ switch(oCheckModel) lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckModel::_None: + case ClCheckModel::_Undef: + break; } } @@ -462,6 +468,9 @@ switch(oCheckVersion) lcd_show_fullscreen_message_and_wait_P(_i("FW version doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckVersion::_None: + case ClCheckVersion::_Undef: + break; } } @@ -488,6 +497,9 @@ switch(oCheckGcode) lcd_show_fullscreen_message_and_wait_P(_i("G-code level doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckGcode::_None: + case ClCheckGcode::_Undef: + break; } } @@ -547,6 +559,9 @@ switch(oCheckModel) lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); lcd_print_stop(); break; + case ClCheckModel::_None: + case ClCheckModel::_Undef: + break; } } From 3e292fd6b0cd61801d6e5457f78b8e72d72ccbf6 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 18:16:05 +0200 Subject: [PATCH 18/30] Fix compiler warnings: sketch/Marlin.h:178:17: warning: extra tokens at end of #undef directive sketch/Marlin.h:181:24: warning: extra tokens at end of #undef directive sketch/Marlin.h:182:0: warning: "enable_z" redefined --- Firmware/Marlin.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 35cfe651..a4434661 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -173,14 +173,14 @@ void manage_inactivity(bool ignore_stepper_queue=false); #endif #ifdef PSU_Delta -void init_force_z(); -void check_force_z(); -#undef disable_z() -#define disable_z() disable_force_z() -void disable_force_z(); -#undef enable_disable_z() -#define enable_z() enable_force_z() -void enable_force_z(); + void init_force_z(); + void check_force_z(); + #undef disable_z + #define disable_z() disable_force_z() + void disable_force_z(); + #undef enable_z + #define enable_z() enable_force_z() + void enable_force_z(); #endif // PSU_Delta From fecccf50e50f52556e1584b6f6b23bc18e3265ef Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 16:52:23 +0200 Subject: [PATCH 19/30] Remove duplicate prototypes from ultralcd.h. Make functions unreferenced outside lcd.cpp static. Disable unused functions by preprocessor to suppress warnings. --- Firmware/lcd.cpp | 69 +++++++++++++++++++++++---------------------- Firmware/ultralcd.h | 3 -- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 4df14bfb..765a821a 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -10,7 +10,7 @@ #include "Configuration.h" #include "pins.h" #include -//#include +#include #include "Marlin.h" #include "fastio.h" //-// @@ -78,14 +78,34 @@ uint8_t lcd_currline; uint8_t lcd_escape[8]; #endif -void lcd_pulseEnable(void) +static void lcd_display(void); + +#if 0 +static void lcd_no_display(void); +static void lcd_no_cursor(void); +static void lcd_cursor(void); +static void lcd_no_blink(void); +static void lcd_blink(void); +static void lcd_scrollDisplayLeft(void); +static void lcd_scrollDisplayRight(void); +static void lcd_leftToRight(void); +static void lcd_rightToLeft(void); +static void lcd_autoscroll(void); +static void lcd_no_autoscroll(void); +#endif + +#ifdef VT100 +void lcd_escape_write(uint8_t chr); +#endif + +static void lcd_pulseEnable(void) { WRITE(LCD_PINS_ENABLE,HIGH); _delay_us(1); // enable pulse must be >450ns WRITE(LCD_PINS_ENABLE,LOW); } -void lcd_writebits(uint8_t value) +static void lcd_writebits(uint8_t value) { #ifdef LCD_8BIT WRITE(LCD_PINS_D0, value & 0x01); @@ -101,7 +121,7 @@ void lcd_writebits(uint8_t value) lcd_pulseEnable(); } -void lcd_send(uint8_t data, uint8_t flags, uint16_t duration = LCD_DEFAULT_DELAY) +static void lcd_send(uint8_t data, uint8_t flags, uint16_t duration = LCD_DEFAULT_DELAY) { WRITE(LCD_PINS_RS,flags&LCD_RS_FLAG); _delay_us(5); @@ -116,33 +136,12 @@ void lcd_send(uint8_t data, uint8_t flags, uint16_t duration = LCD_DEFAULT_DELAY delayMicroseconds(duration); } -void lcd_command(uint8_t value, uint16_t delayExtra = 0) +static void lcd_command(uint8_t value, uint16_t delayExtra = 0) { lcd_send(value, LOW, LCD_DEFAULT_DELAY + delayExtra); } -void lcd_clear(void); -void lcd_home(void); -void lcd_no_display(void); -void lcd_display(void); -void lcd_no_cursor(void); -void lcd_cursor(void); -void lcd_no_blink(void); -void lcd_blink(void); -void lcd_scrollDisplayLeft(void); -void lcd_scrollDisplayRight(void); -void lcd_leftToRight(void); -void lcd_rightToLeft(void); -void lcd_autoscroll(void); -void lcd_no_autoscroll(void); -void lcd_set_cursor(uint8_t col, uint8_t row); -void lcd_createChar_P(uint8_t location, const uint8_t* charmap); - -#ifdef VT100 -void lcd_escape_write(uint8_t chr); -#endif - -void lcd_write(uint8_t value) +static void lcd_write(uint8_t value) { if (value == '\n' || value == '\r') { @@ -190,7 +189,7 @@ static void lcd_begin(uint8_t clear) #endif } -int lcd_putchar(char c, FILE *) +static int lcd_putchar(char c, FILE *) { lcd_write(c); } @@ -233,18 +232,19 @@ void lcd_home(void) } // Turn the display on/off (quickly) +void lcd_display(void) +{ + lcd_displaycontrol |= LCD_DISPLAYON; + lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol); +} + +#if 0 void lcd_no_display(void) { lcd_displaycontrol &= ~LCD_DISPLAYON; lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol); } -void lcd_display(void) -{ - lcd_displaycontrol |= LCD_DISPLAYON; - lcd_command(LCD_DISPLAYCONTROL | lcd_displaycontrol); -} - // Turns the underline cursor on/off void lcd_no_cursor(void) { @@ -309,6 +309,7 @@ void lcd_no_autoscroll(void) lcd_displaymode &= ~LCD_ENTRYSHIFTINCREMENT; lcd_command(LCD_ENTRYMODESET | lcd_displaymode); } +#endif void lcd_set_cursor(uint8_t col, uint8_t row) { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index cb2aad10..a8070eca 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -7,9 +7,6 @@ #include "menu.h" #include "mesh_bed_calibration.h" -extern int lcd_puts_P(const char* str); -extern int lcd_printf_P(const char* format, ...); - extern void menu_lcd_longpress_func(void); extern void menu_lcd_charsetup_func(void); extern void menu_lcd_lcdupdate_func(void); From a54fd29fa4d27f74eb05b2be2352c11c8bf1e841 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 17:21:28 +0200 Subject: [PATCH 20/30] Fix sketch/lcd.cpp:196:1: warning: no return statement in function returning non-void [-Wreturn-type]. --- Firmware/lcd.cpp | 1 + Firmware/lcd.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 765a821a..7376014d 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -192,6 +192,7 @@ static void lcd_begin(uint8_t clear) static int lcd_putchar(char c, FILE *) { lcd_write(c); + return c; } void lcd_init(void) diff --git a/Firmware/lcd.h b/Firmware/lcd.h index d4d978f2..790c0a95 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -11,7 +11,6 @@ extern FILE _lcdout; #define lcdout (&_lcdout) -extern int lcd_putchar(char c, FILE *stream); extern void lcd_init(void); From e6255e8451acfec30c363561869deac8465f0710 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Tue, 16 Jul 2019 19:18:31 +0200 Subject: [PATCH 21/30] octoprint fan error work --- Firmware/Marlin_main.cpp | 1 - Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/temperature.cpp | 9 +++++---- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6f43c7f8..35827021 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9432,7 +9432,6 @@ void stop_and_save_print_to_ram(float z_move, float e_move) if(!saved_extruder_relative_mode){ enquecommand(PSTR("M83"), true); } - //retract 45mm/s // A single sprintf may not be faster, but is definitely 20B shorter // than a sequence of commands building the string piece by piece diff --git a/Firmware/messages.c b/Firmware/messages.c index 0a750612..5c6cb796 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -128,3 +128,4 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; //// const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// +const char MSG_OCTOPRINT_PAUSE[] PROGMEM_N1 = "// action:pause"; //// diff --git a/Firmware/messages.h b/Firmware/messages.h index 6260e0d3..1dc4880c 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -129,6 +129,7 @@ extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; +extern const char MSG_OCTOPRINT_PAUSE[]; #if defined(__cplusplus) } diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 536e96bf..f9bb11f8 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -40,7 +40,7 @@ #include #include "adc.h" #include "ConfigurationStore.h" - +#include "messages.h" #include "Timer.h" #include "Configuration_prusa.h" @@ -541,18 +541,18 @@ static void fanSpeedErrorBeep(const char *serialMsg, const char *lcdMsg){ void fanSpeedError(unsigned char _fan) { if (get_message_level() != 0 && isPrintPaused) return; //to ensure that target temp. is not set to zero in case taht we are resuming print - if (card.sdprinting) { + if (card.sdprinting || is_usb_printing) { if (heating_status != 0) { lcd_print_stop(); } else { fan_check_error = EFCE_DETECTED; - SERIAL_ECHOLNPGM("// action:pause"); //for octoprint + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); } } else { + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //for octoprint setTargetHotend0(0); - SERIAL_ECHOLNPGM("// action:pause"); //for octoprint } switch (_fan) { case 0: // extracting the same code from case 0 and case 1 into a function saves 72B @@ -562,6 +562,7 @@ void fanSpeedError(unsigned char _fan) { fanSpeedErrorBeep(PSTR("Print fan speed is lower than expected"), PSTR("Err: PRINT FAN ERROR") ); break; } + SERIAL_PROTOCOLLNRPGM(MSG_OK); } #endif //(defined(TACH_0) && TACH_0 >-1) || (defined(TACH_1) && TACH_1 > -1) From 0c660a6fb1d61a496a484b916266a20993fa74f4 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 16 Jul 2019 17:21:28 +0200 Subject: [PATCH 22/30] Revert "Fix sketch/lcd.cpp:196:1: warning: no return statement in function returning non-void [-Wreturn-type]." This reverts commit a54fd29fa4d27f74eb05b2be2352c11c8bf1e841. --- Firmware/lcd.cpp | 1 - Firmware/lcd.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 7376014d..765a821a 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -192,7 +192,6 @@ static void lcd_begin(uint8_t clear) static int lcd_putchar(char c, FILE *) { lcd_write(c); - return c; } void lcd_init(void) diff --git a/Firmware/lcd.h b/Firmware/lcd.h index 790c0a95..d4d978f2 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -11,6 +11,7 @@ extern FILE _lcdout; #define lcdout (&_lcdout) +extern int lcd_putchar(char c, FILE *stream); extern void lcd_init(void); From 034cbff10a5c872b0cd2661f22d0fb0ccab08174 Mon Sep 17 00:00:00 2001 From: MRprusa3d Date: Tue, 16 Jul 2019 20:10:49 +0200 Subject: [PATCH 23/30] GUI updates --- Firmware/eeprom.h | 61 +++++++++++++++++++++++++++---------------- Firmware/messages.c | 1 + Firmware/messages.h | 1 + Firmware/ultralcd.cpp | 35 +++++++++++++++---------- Firmware/ultralcd.h | 3 ++- Firmware/util.cpp | 56 ++++++++++++++++++++++++++------------- 6 files changed, 102 insertions(+), 55 deletions(-) diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index 464a1fb0..54f30ccd 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -1,6 +1,35 @@ #ifndef EEPROM_H #define EEPROM_H +#include + +#ifdef __cplusplus +void eeprom_init(); +extern bool is_sheet_initialized(); +#endif + + +typedef struct +{ + char name[7]; //!< Can be null terminated, doesn't need to be null terminated + int16_t z_offset; //!< Z_BABYSTEP_MIN .. Z_BABYSTEP_MAX = Z_BABYSTEP_MIN*2/1000 [mm] .. Z_BABYSTEP_MAX*2/1000 [mm] + uint8_t bed_temp; //!< 0 .. 254 [°C] + uint8_t pinda_temp; //!< 0 .. 254 [°C] +} Sheet; + +typedef struct +{ + Sheet s[3]; + uint8_t active_sheet; +} Sheets; +// sizeof(Sheets). Do not change it unless EEPROM_Sheets_base is last item in EEPROM. +// Otherwise it would move following items. +#define EEPROM_SHEETS_SIZEOF 34 + +#ifdef __cplusplus +static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEPROM_SHEETS_SIZEOF."); +#endif + #define EEPROM_EMPTY_VALUE 0xFF // The total size of the EEPROM is // 4096 for the Atmega2560 @@ -171,31 +200,17 @@ #define EEPROM_CHECK_VERSION (EEPROM_CHECK_MODEL-1) // uint8 #define EEPROM_CHECK_GCODE (EEPROM_CHECK_VERSION-1) // uint8 +#define EEPROM_SHEETS_BASE (EEPROM_CHECK_GCODE - EEPROM_SHEETS_SIZEOF) // Sheets +static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE); + + +//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items. +#define EEPROM_LAST_ITEM EEPROM_SHEETS_BASE // !!!!! // !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!! // !!!!! -//TMC2130 configuration -#define EEPROM_TMC_AXIS_SIZE //axis configuration block size -#define EEPROM_TMC_X (EEPROM_TMC + 0 * EEPROM_TMC_AXIS_SIZE) //X axis configuration blok -#define EEPROM_TMC_Y (EEPROM_TMC + 1 * EEPROM_TMC_AXIS_SIZE) //Y axis -#define EEPROM_TMC_Z (EEPROM_TMC + 2 * EEPROM_TMC_AXIS_SIZE) //Z axis -#define EEPROM_TMC_E (EEPROM_TMC + 3 * EEPROM_TMC_AXIS_SIZE) //E axis -//TMC2130 - X axis -#define EEPROM_TMC_X_USTEPS_INTPOL (EEPROM_TMC_X + 0) // 1byte, bit 0..4 USTEPS, bit 7 INTPOL -#define EEPROM_TMC_X_PWM_AMPL (EEPROM_TMC_X + 1) // 1byte (0..255) -#define EEPROM_TMC_X_PWM_GRAD_FREQ (EEPROM_TMC_X + 2) // 1byte, bit 0..3 GRAD, bit 4..5 FREQ -#define EEPROM_TMC_X_TCOOLTHRS (EEPROM_TMC_X + 3) // 2bytes (0..) -#define EEPROM_TMC_X_SG_THRS (EEPROM_TMC_X + 5) // 1byte, (-64..+63) -#define EEPROM_TMC_X_CURRENT_H (EEPROM_TMC_X + 6) // 1byte, (0..63) -#define EEPROM_TMC_X_CURRENT_R (EEPROM_TMC_X + 7) // 1byte, (0..63) -#define EEPROM_TMC_X_HOME_SG_THRS (EEPROM_TMC_X + 8) // 1byte, (-64..+63) -#define EEPROM_TMC_X_HOME_CURRENT_R (EEPROM_TMC_X + 9) // 1byte, (-64..+63) -#define EEPROM_TMC_X_HOME_DTCOOLTHRS (EEPROM_TMC_X + 10) // 1byte (-128..+127) -#define EEPROM_TMC_X_DTCOOLTHRS_LOW (EEPROM_TMC_X + 11) // 1byte (-128..+127) -#define EEPROM_TMC_X_DTCOOLTHRS_HIGH (EEPROM_TMC_X + 12) // 1byte (-128..+127) -#define EEPROM_TMC_X_SG_THRS_LOW (EEPROM_TMC_X + 13) // 1byte, (-64..+63) -#define EEPROM_TMC_X_SG_THRS_HIGH (EEPROM_TMC_X + 14) // 1byte, (-64..+63) + // Currently running firmware, each digit stored as uint16_t. // The flavor differentiates a dev, alpha, beta, release candidate or a release version. @@ -209,7 +224,9 @@ #ifdef __cplusplus #include "ConfigurationStore.h" -static M500_conf * const EEPROM_M500_base = reinterpret_cast(20); //offset for storing settings using M500 +static_assert(EEPROM_FIRMWARE_VERSION_END < 20, "Firmware version EEPROM address conflicts with EEPROM_M500_base"); +static constexpr M500_conf * const EEPROM_M500_base = reinterpret_cast(20); //offset for storing settings using M500 +static_assert(((sizeof(M500_conf) + 20) < EEPROM_LAST_ITEM), "M500_conf address space conflicts with previous items."); #endif enum diff --git a/Firmware/messages.c b/Firmware/messages.c index 53ec20e8..1a87f6b0 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -83,6 +83,7 @@ const char MSG_SELFTEST_MOTOR[] PROGMEM_I1 = ISTR("Motor"); //// const char MSG_SELFTEST_FILAMENT_SENSOR[] PROGMEM_I1 = ISTR("Filament sensor"); ////c=17 const char MSG_SELFTEST_WIRINGERROR[] PROGMEM_I1 = ISTR("Wiring error"); //// const char MSG_SETTINGS[] PROGMEM_I1 = ISTR("Settings"); //// +const char MSG_HW_SETUP[] PROGMEM_I1 = ISTR("HW Setup"); //// const char MSG_SILENT_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [high power]"); //// const char MSG_SILENT_MODE_ON[] PROGMEM_I1 = ISTR("Mode [silent]"); //// const char MSG_STEALTH_MODE_OFF[] PROGMEM_I1 = ISTR("Mode [Normal]"); //// diff --git a/Firmware/messages.h b/Firmware/messages.h index d74412fc..9c1110b9 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -83,6 +83,7 @@ extern const char MSG_SELFTEST_MOTOR[]; extern const char MSG_SELFTEST_FILAMENT_SENSOR[]; extern const char MSG_SELFTEST_WIRINGERROR[]; extern const char MSG_SETTINGS[]; +extern const char MSG_HW_SETUP[]; extern const char MSG_SILENT_MODE_OFF[]; extern const char MSG_SILENT_MODE_ON[]; extern const char MSG_STEALTH_MODE_OFF[]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 35ce0f63..76b4e04d 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -307,7 +307,7 @@ bool wait_for_unclick; #endif bool bMain; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function -bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_checkink_menu()' function +bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function @@ -5489,18 +5489,27 @@ do\ }\ while (0) -//-//static void lcd_checking_menu() -void lcd_checking_menu() +static void lcd_checking_menu(void) { MENU_BEGIN(); -MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch -SETTINGS_NOZZLE; -MENU_ITEM_TEXT_P(STR_SEPARATOR); -MENU_ITEM_TEXT_P(_i("Checks:")); +MENU_ITEM_BACK_P(_T(MSG_HW_SETUP)); SETTINGS_MODE; SETTINGS_MODEL; SETTINGS_VERSION; -SETTINGS_GCODE; +//-// temporarily disabled +//SETTINGS_GCODE; +MENU_END(); +} + +void lcd_hw_setup_menu(void) // can not be "static" +{ +MENU_BEGIN(); +MENU_ITEM_BACK_P(_T(bSettings?MSG_SETTINGS:MSG_BACK)); // i.e. default menu-item / menu-item after checking mismatch +if(!farm_mode) + SETTINGS_NOZZLE; +// ... a sem prijdou 'plechy' +if(!farm_mode) + MENU_ITEM_SUBMENU_P(_i("Checks"), lcd_checking_menu); MENU_END(); } @@ -5528,6 +5537,10 @@ static void lcd_settings_menu() MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1 SETTINGS_SILENT_MODE; + + bSettings=true; // flag ('fake parameter') for 'lcd_hw_setup_menu()' function + MENU_ITEM_SUBMENU_P(_i("HW Setup"), lcd_hw_setup_menu);////MSG_HW_SETUP + SETTINGS_MMU_MODE; MENU_ITEM_SUBMENU_P(_i("Mesh bed leveling"), lcd_mesh_bed_leveling_settings);////MSG_MBL_SETTINGS c=18 r=1 @@ -5555,12 +5568,6 @@ static void lcd_settings_menu() MENU_ITEM_SUBMENU_P(_i("Select language"), lcd_language_menu);////MSG_LANGUAGE_SELECT #endif //(LANG_MODE != 0) - if (!farm_mode) - { - bSettings=true; // flag ('fake parameter') for 'lcd_checking_menu()' function - MENU_ITEM_SUBMENU_P(_i("Print checking"), lcd_checking_menu); - } - SETTINGS_SD; SETTINGS_SOUND; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index a4abd106..1760c3c1 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -137,7 +137,8 @@ void lcd_ignore_click(bool b=true); void lcd_commands(); -extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_checkink_menu()' function +extern bool bSettings; // flag (i.e. 'fake parameter') for 'lcd_hw_setup_menu()' function +void lcd_hw_setup_menu(void); // NOT static due to using inside "util" module ("nozzle_diameter_check()") void change_extr(int extr); diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 490f2897..f8ad87d4 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -330,7 +330,7 @@ void update_current_firmware_version_to_eeprom() //-// -void lcd_checking_menu(void); +#define MSG_PRINT_CHECKING_FAILED_TIMEOUT 30 ClNozzleDiameter oNozzleDiameter=ClNozzleDiameter::_Diameter_400; ClCheckMode oCheckMode=ClCheckMode::_None; @@ -385,7 +385,7 @@ nDiameter_um=eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM); if(nDiameter==nDiameter_um) return; //SERIAL_ECHO_START; -//SERIAL_ECHOLNPGM("Nozzle diameter doesn't match ..."); +//SERIAL_ECHOLNPGM("Printer nozzle diameter differs from the G-code ..."); //SERIAL_ECHOPGM("actual : "); //SERIAL_ECHOLN((float)(nDiameter_um/1000.0)); //SERIAL_ECHOPGM("expected: "); @@ -393,15 +393,19 @@ if(nDiameter==nDiameter_um) switch(oCheckMode) { case ClCheckMode::_Warn: - lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Press the knob to continue.")); +// lcd_show_fullscreen_message_and_wait_P(_i("Printer nozzle diameter differs from the G-code. Continue?")); +lcd_display_message_fullscreen_P(_i("Printer nozzle diameter differs from the G-code. Continue?")); +lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); +//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery +lcd_update_enable(true); // display / status-line recovery break; case ClCheckMode::_Strict: - lcd_show_fullscreen_message_and_wait_P(_i("Nozzle diameter doesn't match! Print is aborted, press the knob.")); + lcd_show_fullscreen_message_and_wait_P(_i("Printer nozzle diameter differs from the G-code. Please check the value in settings. Print cancelled.")); lcd_print_stop(); break; } -bSettings=false; // flag ('fake parameter') for 'lcd_checking_menu()' function -menu_submenu(lcd_checking_menu); +bSettings=false; // flag ('fake parameter') for 'lcd_hw_setup_menu()' function +menu_submenu(lcd_hw_setup_menu); } void printer_model_check(uint16_t nPrinterModel) @@ -411,7 +415,7 @@ if(oCheckModel==ClCheckModel::_None) if(nPrinterModel==nPrinterType) return; //SERIAL_ECHO_START; -//SERIAL_ECHOLNPGM("Printer model doesn't match ..."); +//SERIAL_ECHOLNPGM("Printer model differs from the G-code ..."); //SERIAL_ECHOPGM("actual : "); //SERIAL_ECHOLN(nPrinterType); //SERIAL_ECHOPGM("expected: "); @@ -419,10 +423,14 @@ if(nPrinterModel==nPrinterType) switch(oCheckModel) { case ClCheckModel::_Warn: - lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Press the knob to continue.")); +// lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Continue?")); +lcd_display_message_fullscreen_P(_i("Printer model differs from the G-code. Continue?")); +lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT); +//???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery +lcd_update_enable(true); // display / status-line recovery break; case ClCheckModel::_Strict: - lcd_show_fullscreen_message_and_wait_P(_i("Printer model doesn't match! Print is aborted, press the knob.")); + lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Please check the value in settings. Print cancelled.")); lcd_print_stop(); break; } @@ -454,7 +462,7 @@ if(nCompareValueResult==COMPARE_VALUE_EQUAL) if((nCompareValueResult Date: Tue, 16 Jul 2019 21:11:27 +0300 Subject: [PATCH 24/30] Fix status screen --- Firmware/lcd.cpp | 2 +- Firmware/lcd.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 765a821a..b2f90c6c 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -189,7 +189,7 @@ static void lcd_begin(uint8_t clear) #endif } -static int lcd_putchar(char c, FILE *) +static void lcd_putchar(char c, FILE *) { lcd_write(c); } diff --git a/Firmware/lcd.h b/Firmware/lcd.h index d4d978f2..307e9486 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -11,7 +11,7 @@ extern FILE _lcdout; #define lcdout (&_lcdout) -extern int lcd_putchar(char c, FILE *stream); +extern void lcd_putchar(char c, FILE *stream); extern void lcd_init(void); From 1c44eddf8169fb36a3018247a1aa8107b84d5c8a Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 17 Jul 2019 12:32:27 +0200 Subject: [PATCH 25/30] crash and filament unload sound change --- Firmware/sound.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Firmware/sound.cpp b/Firmware/sound.cpp index 7b965a2d..b01285a5 100644 --- a/Firmware/sound.cpp +++ b/Firmware/sound.cpp @@ -61,17 +61,18 @@ switch(eSoundMode) Sound_SaveMode(); } +//if critical is true then silend and once mode is ignored void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ if (!critical){ if (eSoundMode != e_SOUND_MODE_SILENT){ if(!tone_){ WRITE(BEEPER, HIGH); - delayMicroseconds(ms); + _delay(ms); WRITE(BEEPER, LOW); } else{ _tone(BEEPER, tone_); - delayMicroseconds(ms); + _delay(ms); _noTone(BEEPER); } } @@ -79,13 +80,13 @@ void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ else{ if(!tone_){ WRITE(BEEPER, HIGH); - delayMicroseconds(ms); + _delay(ms); WRITE(BEEPER, LOW); - delayMicroseconds(100); + _delay(ms); } else{ _tone(BEEPER, tone_); - delayMicroseconds(ms); + _delay(ms); _noTone(BEEPER); } } @@ -134,10 +135,10 @@ switch(eSoundMode) static void Sound_DoSound_Blind_Alert(void) { - _tone(BEEPER,100); - delayMicroseconds(50); + _tone(BEEPER,300); + _delay_ms(75); _noTone(BEEPER); - delayMicroseconds(200); + _delay_ms(75); } static void Sound_DoSound_Encoder_Move(void) @@ -169,7 +170,7 @@ for(nI=0;nI<10;nI++) static void Sound_DoSound_Prompt(void) { WRITE(BEEPER,HIGH); -delayMicroseconds(500); +_delay_ms(500); WRITE(BEEPER,LOW); } From b8fec59f216a020c0e28dcdfe06f75d891ea6c68 Mon Sep 17 00:00:00 2001 From: NotaRobotexe Date: Wed, 17 Jul 2019 19:59:31 +0200 Subject: [PATCH 26/30] octoprint fan error fix --- Firmware/Marlin_main.cpp | 11 +++++++++-- Firmware/temperature.cpp | 3 ++- Firmware/ultralcd.cpp | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 35827021..e536df96 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3393,8 +3393,15 @@ void process_commands() if (fan_check_error){ if( fan_check_error == EFCE_DETECTED ){ fan_check_error = EFCE_REPORTED; - lcd_pause_print(); - } // otherwise it has already been reported, so just ignore further processing + + if(is_usb_printing){ + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); + } + else{ + lcd_pause_print(); + } + + } // otherwise it has already been reported, so just ignore further processing return; } #endif diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index f9bb11f8..1ef85549 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -524,6 +524,8 @@ void checkFanSpeed() fan_speed_errors[1] = 0; fanSpeedError(1); //print fan } + + SERIAL_PROTOCOLLNRPGM(MSG_OK); //for octoprint } //! Prints serialMsg to serial port, displays lcdMsg onto the LCD and beeps. @@ -547,7 +549,6 @@ void fanSpeedError(unsigned char _fan) { } else { fan_check_error = EFCE_DETECTED; - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); } } else { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e8790886..c70fe8fc 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1658,6 +1658,7 @@ void lcd_pause_print() { lcd_commands_type = LcdCommands::LongPause; } + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint } From 121e60655af40e2abee8ede37146f00c55682923 Mon Sep 17 00:00:00 2001 From: leptun Date: Thu, 18 Jul 2019 10:14:03 +0300 Subject: [PATCH 27/30] Fix lcd not initing after WDT reset --- Firmware/lcd.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index b2f90c6c..1f4e6e2f 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -196,8 +196,21 @@ static void lcd_putchar(char c, FILE *) void lcd_init(void) { + WRITE(LCD_PINS_ENABLE,LOW); SET_OUTPUT(LCD_PINS_RS); SET_OUTPUT(LCD_PINS_ENABLE); + +#ifdef LCD_8BIT + SET_OUTPUT(LCD_PINS_D0); + SET_OUTPUT(LCD_PINS_D1); + SET_OUTPUT(LCD_PINS_D2); + SET_OUTPUT(LCD_PINS_D3); +#endif + SET_OUTPUT(LCD_PINS_D4); + SET_OUTPUT(LCD_PINS_D5); + SET_OUTPUT(LCD_PINS_D6); + SET_OUTPUT(LCD_PINS_D7); + #ifdef LCD_8BIT lcd_displayfunction |= LCD_8BITMODE; #endif From 03e80ce4a8eac8855050f967ce8b675732cd5741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BChn?= Date: Thu, 18 Jul 2019 16:50:44 +0200 Subject: [PATCH 28/30] PFW-917 Adjust Z value persists across update to v3.8 --- Firmware/eeprom.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Firmware/eeprom.cpp b/Firmware/eeprom.cpp index 1be708d0..f2d89716 100644 --- a/Firmware/eeprom.cpp +++ b/Firmware/eeprom.cpp @@ -71,6 +71,12 @@ void eeprom_init() } if(is_uninitialized) { + // When upgrading from version older version (before multiple sheets were implemented in v3.8.0) + // Sheet 1 uses the previous Live adjust Z (@EEPROM_BABYSTEP_Z) + if(i == 0){ + int last_babystep = eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z); + eeprom_write_word(reinterpret_cast(&(EEPROM_Sheets_base->s[i].z_offset)), last_babystep); + } eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast(i + '1')); eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0'); } From 94e79806bce1c73bae384b6b25ecd64585078bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BChn?= Date: Fri, 19 Jul 2019 13:51:55 +0200 Subject: [PATCH 29/30] Updated doxygen docs to work better with confluence. --- Firmware/Marlin_main.cpp | 936 +++++++++++++++++++++++++++++++-------- Firmware/doxyfile | 2 +- 2 files changed, 763 insertions(+), 175 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 8ac1aaf5..0415b2bf 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3256,14 +3256,19 @@ extern uint8_t st_backlash_x; extern uint8_t st_backlash_y; #endif //BACKLASH_Y +//! \ingroup marlin_main + //! @brief Parse and process commands //! //! look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html //! http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes //! -//! Implemented Codes +//! +//! Implemented Codes //! ------------------- //! +//! * _This list is not updated. Current documentation is maintained inside the process_cmd function._ +//! //!@n PRUSA CODES //!@n P F - Returns FW versions //!@n P R - Returns revision of printer @@ -3386,6 +3391,15 @@ extern uint8_t st_backlash_y; //! //!@n M928 - Start SD logging (M928 filename.g) - ended by M29 //!@n M999 - Restart after being stopped by error +//!

+ +/** @defgroup marlin_main Marlin main */ + +/** \ingroup GCodes */ + +//! _This is a list of currently implemented G Codes in Prusa firmware (dynamically generated from doxygen)_ + + void process_commands() { #ifdef FANCHECK @@ -3444,21 +3458,33 @@ void process_commands() #ifdef TMC2130 else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("CRASH_"), 6) == 0) { - if(code_seen("CRASH_DETECTED")) //! CRASH_DETECTED + + //! ### CRASH_DETECTED - TMC2130 + // --------------------------------- + if(code_seen("CRASH_DETECTED")) { uint8_t mask = 0; if (code_seen('X')) mask |= X_AXIS_MASK; if (code_seen('Y')) mask |= Y_AXIS_MASK; crashdet_detected(mask); } - else if(code_seen("CRASH_RECOVER")) //! CRASH_RECOVER + + //! ### CRASH_RECOVER - TMC2130 + // ---------------------------------- + else if(code_seen("CRASH_RECOVER")) crashdet_recover(); - else if(code_seen("CRASH_CANCEL")) //! CRASH_CANCEL + + //! ### CRASH_CANCEL - TMC2130 + // ---------------------------------- + else if(code_seen("CRASH_CANCEL")) crashdet_cancel(); } else if (strncmp_P(CMDBUFFER_CURRENT_STRING, PSTR("TMC_"), 4) == 0) { - if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0) //! TMC_SET_WAVE_ + + //! ### TMC_SET_WAVE_ + // -------------------- + if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_WAVE_"), 9) == 0) { uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13); axis = (axis == 'E')?3:(axis - 'X'); @@ -3468,7 +3494,10 @@ void process_commands() tmc2130_set_wave(axis, 247, fac); } } - else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0) //! TMC_SET_STEP_ + + //! ### TMC_SET_STEP_ + // ------------------ + else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_STEP_"), 9) == 0) { uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13); axis = (axis == 'E')?3:(axis - 'X'); @@ -3479,7 +3508,10 @@ void process_commands() tmc2130_goto_step(axis, step & (4*res - 1), 2, 1000, res); } } - else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0) //! TMC_SET_CHOP_ + + //! ### TMC_SET_CHOP_ + // ------------------- + else if (strncmp_P(CMDBUFFER_CURRENT_STRING + 4, PSTR("SET_CHOP_"), 9) == 0) { uint8_t axis = *(CMDBUFFER_CURRENT_STRING + 13); axis = (axis == 'E')?3:(axis - 'X'); @@ -3530,19 +3562,50 @@ void process_commands() } #endif //BACKLASH_Y #endif //TMC2130 - else if(code_seen("PRUSA")){ - if (code_seen("Ping")) { //! PRUSA Ping + else if(code_seen("PRUSA")){ + /*! + * + ### PRUSA - Internal command set + + Set of internal PRUSA commands + + PRUSA [ Ping | PRN | FAN | fn | thx | uvlo | fsensor_recover | MMURES | RESET | fv | M28 | SN | Fir | Rev | Lang | Lz | Beat | FR ] + + - `Ping` + - `PRN` - Prints revision of the printer + - `FAN` - Prints fan details + - `fn` - Prints farm no. + - `thx` + - `uvlo` + - `fsensor_recover` - Filament sensor recover - restore print and continue + - `MMURES` - Reset MMU + - `RESET` - (Careful!) + - `fv` - ? + - `M28` + - `SN` + - `Fir` - Prints firmware version + - `Rev`- Prints filament size, elelectronics, nozzle type + - `Lang` - Reset the language + - `Lz` + - `Beat` - Kick farm link timer + - `FR` - Full factory reset + - `nozzle D G1 case 1: // G1 if(Stopped == false) { @@ -3907,19 +3973,30 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) //ClearToSend(); } break; - case 2: // G2 - CW ARC + + //! ### G2 - CW ARC + // ------------------------------ + case 2: if(Stopped == false) { get_arc_coordinates(); prepare_arc_move(true); } break; - case 3: // G3 - CCW ARC + + + //! ### G3 - CCW ARC + // ------------------------------- + case 3: if(Stopped == false) { get_arc_coordinates(); prepare_arc_move(false); } break; - case 4: // G4 dwell + + + //! ### G4 - Dwell + // ------------------------------- + case 4: codenum = 0; if(code_seen('P')) codenum = code_value(); // milliseconds to wait if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait @@ -3934,7 +4011,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; #ifdef FWRETRACT - case 10: // G10 retract + + + //! ### G10 Retract + // ------------------------------ + case 10: #if EXTRUDERS > 1 retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1); // checks for swap retract argument retract(true,retracted_swap[active_extruder]); @@ -3942,7 +4023,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) retract(true); #endif break; - case 11: // G11 retract_recover + + + //! ### G11 - Retract recover + // ----------------------------- + case 11: #if EXTRUDERS > 1 retract(false,retracted_swap[active_extruder]); #else @@ -3950,7 +4035,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) #endif break; #endif //FWRETRACT - case 28: //G28 Home all Axis one at a time + + + //! ### G28 - Home all Axis one at a time + // -------------------------------------------- + case 28: { long home_x_value = 0; long home_y_value = 0; @@ -3977,8 +4066,13 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; } + #ifdef ENABLE_AUTO_BED_LEVELING - case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points. + + + //! ### G29 - Detailed Z-Probe + // -------------------------------- + case 29: { #if Z_MIN_PIN == -1 #error "You must have a Z_MIN endstop in order to enable Auto Bed Leveling feature! Z_MIN_PIN must point to a valid hardware pin." @@ -4121,7 +4215,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; #ifndef Z_PROBE_SLED - case 30: // G30 Single Z Probe + + //! ### G30 - Single Z Probe + // ------------------------------------ + case 30: { st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly @@ -4143,17 +4240,27 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; #else - case 31: // dock the sled + + //! ### G31 - Dock the sled + // --------------------------- + case 31: dock_sled(true); break; - case 32: // undock the sled + + + //! ### G32 - Undock the sled + // ---------------------------- + case 32: dock_sled(false); break; #endif // Z_PROBE_SLED #endif // ENABLE_AUTO_BED_LEVELING #ifdef MESH_BED_LEVELING - case 30: // G30 Single Z Probe + + //! ### G30 - Single Z Probe + // ---------------------------- + case 30: { st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly @@ -4169,7 +4276,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - + //! ### G75 - Print temperature interpolation + // --------------------------------------------- case 75: { for (int i = 40; i <= 110; i++) @@ -4177,7 +4285,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - case 76: //! G76 - PINDA probe temperature calibration + //! ### G76 - PINDA probe temperature calibration + // ------------------------------------------------ + case 76: { #ifdef PINDA_THERMISTOR if (true) @@ -4434,18 +4544,16 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; - - /** - * G80: Mesh-based Z probe, probes a grid and produces a - * mesh to compensate for variable bed height - * + //! ### 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 - * @code{.unparsed} * +----> X-axis * | * | * v Y-axis - * @endcode */ case 80: @@ -4869,8 +4977,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - /** - * G81: Print mesh bed leveling status and bed profile if activated + //! ### G81 - Mesh bed leveling status + // ----------------------------------------- + + /* + * Prints mesh bed leveling status and bed profile if activated */ case 81: if (mbl.active) { @@ -4894,7 +5005,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; #if 0 - /** + /* * G82: Single Z probe at current location * * WARNING! USE WITH CAUTION! If you'll try to probe where is no leveling pad, nasty things can happen! @@ -4910,7 +5021,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) SERIAL_PROTOCOLPGM("\n"); break; - /** + /* * G83: Prusa3D specific: Babystep in Z and store to EEPROM */ case 83: @@ -4935,7 +5046,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - /** + /* * G84: Prusa3D specific: UNDO Babystep Z (move Z axis back) */ case 84: @@ -4943,7 +5054,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) // babystepLoadZ = 0; break; - /** + /* * G85: Prusa3D specific: Pick best babystep */ case 85: @@ -4951,38 +5062,58 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; #endif - /** - * G86: Prusa3D specific: Disable babystep correction after home. - * This G-code will be performed at the start of a calibration script. - */ + /** + * ### G86 - Disable babystep correction after home + * + * This G-code will be performed at the start of a calibration script. + * (Prusa3D specific) + */ case 86: calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST); break; - /** - * G87: Prusa3D specific: Enable babystep correction after home - * This G-code will be performed at the end of a calibration script. - */ + + + /** + * ### G87 - Enable babystep correction after home + * + * + * This G-code will be performed at the end of a calibration script. + * (Prusa3D specific) + */ case 87: calibration_status_store(CALIBRATION_STATUS_CALIBRATED); break; - /** - * G88: Prusa3D specific: Don't know what it is for, it is in V2Calibration.gcode - */ + + /** + * ### G88 - Reserved + * + * Currently has no effect. + */ + + // Prusa3D specific: Don't know what it is for, it is in V2Calibration.gcode + case 88: break; #endif // ENABLE_MESH_BED_LEVELING - - case 90: // G90 + //! ### G90 - Switch off relative mode + // ------------------------------- + case 90: relative_mode = false; break; - case 91: // G91 + + //! ### G91 - Switch on relative mode + // ------------------------------- + case 91: relative_mode = true; break; - case 92: // G92 + + //! ### G92 - Set position + // ----------------------------- + case 92: if(!code_seen(axis_codes[E_AXIS])) st_synchronize(); for(int8_t i=0; i < NUM_AXIS; i++) { @@ -4999,7 +5130,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } break; - case 98: //! G98 (activate farm mode) + + //! ### G98 - Activate farm mode + // ----------------------------------- + case 98: farm_mode = 1; PingTime = _millis(); eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode); @@ -5009,7 +5143,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) fCheckModeInit(); // alternatively invoke printer reset break; - case 99: //! G99 (deactivate farm mode) + //! ### G99 - Deactivate farm mode + // ------------------------------------- + case 99: farm_mode = 0; lcd_printer_connected(); eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode); @@ -5023,6 +5159,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) gcode_in_progress = 0; } // end if(code_seen('G')) + + //! --------------------------------------------------------------------------------- + else if(code_seen('M')) { @@ -5041,6 +5180,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) switch(mcode_in_progress) { + //! ### M0, M1 - Stop the printer + // --------------------------------------------------------------- case 0: // M0 - Unconditional stop - Wait for user button press on LCD case 1: // M1 - Conditional stop - Wait for user button press on LCD { @@ -5088,6 +5229,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) LCD_MESSAGERPGM(_T(WELCOME_MSG)); } break; + + //! ### M17 - Enable axes + // --------------------------------- case 17: LCD_MESSAGERPGM(_i("No move."));////MSG_NO_MOVE enable_x(); @@ -5099,44 +5243,68 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; #ifdef SDSUPPORT - case 20: // M20 - list SD card + + //! ### M20 - SD Card file list + // ----------------------------------- + case 20: SERIAL_PROTOCOLLNRPGM(_N("Begin file list"));////MSG_BEGIN_FILE_LIST card.ls(); SERIAL_PROTOCOLLNRPGM(_N("End file list"));////MSG_END_FILE_LIST break; - case 21: // M21 - init SD card + //! ### M21 - Init SD card + // ------------------------------------ + case 21: card.initsd(); - break; - case 22: //M22 - release SD card + + //! ### M22 - Release SD card + // ----------------------------------- + case 22: card.release(); - break; - case 23: //M23 - Select file + + //! ### M23 - Select file + // ----------------------------------- + case 23: starpos = (strchr(strchr_pointer + 4,'*')); if(starpos!=NULL) *(starpos)='\0'; card.openFile(strchr_pointer + 4,true); break; - case 24: //M24 - Start SD print + + //! ### M24 - Start SD print + // ---------------------------------- + case 24: if (!card.paused) failstats_reset_print(); card.startFileprint(); starttime=_millis(); break; - case 25: //M25 - Pause SD print + + //! ### M25 - Pause SD print + // ---------------------------------- + case 25: card.pauseSDPrint(); break; - case 26: //M26 - Set SD index + + //! ### M26 - Set SD index + // ---------------------------------- + case 26: if(card.cardOK && code_seen('S')) { card.setIndex(code_value_long()); } break; - case 27: //M27 - Get SD status + + //! ### M27 - Get SD status + // ---------------------------------- + case 27: card.getStatus(); break; - case 28: //M28 - Start SD write + + //! ### M28 - Start SD write + // --------------------------------- + case 28: starpos = (strchr(strchr_pointer + 4,'*')); if(starpos != NULL){ char* npos = strchr(CMDBUFFER_CURRENT_STRING, 'N'); @@ -5145,11 +5313,18 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } card.openFile(strchr_pointer+4,false); break; - case 29: //M29 - Stop SD write + + //! ### M29 - Stop SD write + // ------------------------------------- + //! Currently has no effect. + case 29: //processed in write to file routine above //card,saving = false; break; - case 30: //M30 Delete File + + //! ### M30 - Delete file + // ---------------------------------- + case 30: if (card.cardOK){ card.closefile(); starpos = (strchr(strchr_pointer + 4,'*')); @@ -5161,7 +5336,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) card.removeFile(strchr_pointer + 4); } break; - case 32: //M32 - Select file and start SD print + + //! ### M32 - Select file and start SD print + // ------------------------------------ + case 32: { if(card.sdprinting) { st_synchronize(); @@ -5196,7 +5374,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) starttime=_millis(); //procedure calls count as normal print time. } } break; - case 928: //M928 - Start SD write + + //! ### M982 - Start SD write + // --------------------------------- + case 928: starpos = (strchr(strchr_pointer + 5,'*')); if(starpos != NULL){ char* npos = strchr(CMDBUFFER_CURRENT_STRING, 'N'); @@ -5208,6 +5389,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) #endif //SDSUPPORT + //! ### M31 - Report current print time + // -------------------------------------------------- case 31: //M31 take time since the start of the SD print or an M109 command { stoptime=_millis(); @@ -5223,7 +5406,10 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) autotempShutdown(); } break; - case 42: //M42 -Change pin status via gcode + + //! ### M42 - Set pin state + // ----------------------------- + case 42: if (code_seen('S')) { int pin_status = code_value(); @@ -5250,7 +5436,11 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } } break; - case 44: //! M44: Prusa3D: Reset the bed skew and offset calibration. + + + //! ### M44 - Reset the bed skew and offset calibration (Prusa specific) + // -------------------------------------------------------------------- + case 44: // M44: Prusa3D: Reset the bed skew and offset calibration. // Reset the baby step value and the baby step applied flag. calibration_status_store(CALIBRATION_STATUS_ASSEMBLED); @@ -5264,7 +5454,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) world2machine_revert_to_uncorrected(); break; - case 45: //! M45: Prusa3D: bed skew and offset with manual Z up + //! ### M45 - Bed skew and offset with manual Z up (Prusa specific) + // ------------------------------------------------------ + case 45: // M45: Prusa3D: bed skew and offset with manual Z up { int8_t verbosity_level = 0; bool only_Z = code_seen('Z'); @@ -5303,15 +5495,17 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) } */ + //! ### M47 - Show end stops dialog on the display (Prusa specific) + // ---------------------------------------------------- case 47: - //! M47: Prusa3D: Show end stops dialog on the display. + KEEPALIVE_STATE(PAUSED_FOR_USER); lcd_diag_show_end_stops(); KEEPALIVE_STATE(IN_HANDLER); break; #if 0 - case 48: //! M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC. + case 48: // M48: scan the bed induction sensor points, print the sensor trigger coordinates to the serial line for visualization on the PC. { // Disable the default update procedure of the display. We will do a modal dialog. lcd_update_enable(false); @@ -5349,11 +5543,15 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) #ifdef ENABLE_AUTO_BED_LEVELING #ifdef Z_PROBE_REPEATABILITY_TEST - //! M48 Z-Probe repeatability measurement function. + + //! ### M48 - Z-Probe repeatability measurement function. + // ------------------------------------------------------ //! - //! Usage: M48 - //! - //! This function assumes the bed has been homed. Specificaly, that a G28 command + //! _Usage:_ + //! + //! M48 + //! + //! This function assumes the bed has been homed. Specifically, that a G28 command //! as been issued prior to invoking the M48 Z-Probe repeatability measurement function. //! Any information generated by a prior G29 Bed leveling command will be lost and need to be //! regenerated. @@ -5599,6 +5797,13 @@ Sigma_Exit: } #endif // Z_PROBE_REPEATABILITY_TEST #endif // ENABLE_AUTO_BED_LEVELING + + //! ### M73 - Set/get print progress + // ------------------------------------- + //! _Usage:_ + //! + //! M73 P R Q S + //! case 73: //M73 show percent done and time remaining if(code_seen('P')) print_percent_done_normal = code_value(); if(code_seen('R')) print_time_remaining_normal = code_value(); @@ -5612,6 +5817,8 @@ Sigma_Exit: } break; + //! ### M104 - Set hotend temperature + // ----------------------------------------- case 104: // M104 { uint8_t extruder; @@ -5625,13 +5832,22 @@ Sigma_Exit: setWatch(); break; } - case 112: // M112 -Emergency Stop + + //! ### M112 - Emergency stop + // ----------------------------------------- + case 112: kill(_n(""), 3); break; - case 140: // M140 set bed temp + + //! ### M140 - Set bed temperature + // ----------------------------------------- + case 140: if (code_seen('S')) setTargetBed(code_value()); break; - case 105 : // M105 + + //! ### M105 - Report temperatures + // ----------------------------------------- + case 105: { uint8_t extruder; if(setTargetedHotend(105, extruder)){ @@ -5725,8 +5941,11 @@ Sigma_Exit: return; break; } + + //! ### M109 - Wait for extruder temperature + // ------------------------------------------------- case 109: - {// M109 - Wait for extruder heater to reach target. + { uint8_t extruder; if(setTargetedHotend(109, extruder)){ break; @@ -5776,7 +5995,10 @@ Sigma_Exit: previous_millis_cmd = _millis(); } break; - case 190: // M190 - Wait for bed heater to reach target. + + //! ### M190 - Wait for bed temperature + // --------------------------------------- + case 190: #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 LCD_MESSAGERPGM(_T(MSG_BED_HEATING)); heating_status = 3; @@ -5827,7 +6049,10 @@ Sigma_Exit: break; #if defined(FAN_PIN) && FAN_PIN > -1 - case 106: //!M106 Sxxx Fan On S 0 .. 255 + + //! ### M106 - Set fan speed + // ------------------------------------------- + case 106: // M106 Sxxx Fan On S 0 .. 255 if (code_seen('S')){ fanSpeed=constrain(code_value(),0,255); } @@ -5835,13 +6060,19 @@ Sigma_Exit: fanSpeed=255; } break; - case 107: //M107 Fan Off + + //! ### M107 - Fan off + // ------------------------------- + case 107: fanSpeed = 0; break; #endif //FAN_PIN #if defined(PS_ON_PIN) && PS_ON_PIN > -1 - case 80: // M80 - Turn on Power Supply + + //! ### M80 - Turn on the Power Supply + // ------------------------------- + case 80: SET_OUTPUT(PS_ON_PIN); //GND WRITE(PS_ON_PIN, PS_ON_AWAKE); @@ -5859,7 +6090,9 @@ Sigma_Exit: break; #endif - case 81: // M81 - Turn off Power Supply + //! ### M81 - Turn off Power Supply + // -------------------------------------- + case 81: disable_heater(); st_synchronize(); disable_e0(); @@ -5880,12 +6113,24 @@ Sigma_Exit: lcd_update(0); break; + //! ### M82 - Set E axis to absolute mode + // --------------------------------------- case 82: axis_relative_modes[3] = false; break; + + //! ### M83 - Set E axis to relative mode + // --------------------------------------- case 83: axis_relative_modes[3] = true; break; + + //! ### M84, M18 - Disable steppers + //--------------------------------------- + //! This command can be used to set the stepper inactivity timeout (`S`) or to disable steppers (`X`,`Y`,`Z`,`E`) + //! + //! M84 [E] [S] [X] [Y] [Z] + //! case 18: //compatibility case 84: // M84 if(code_seen('S')){ @@ -5921,21 +6166,35 @@ Sigma_Exit: print_time_remaining_init(); snmm_filaments_used = 0; break; + + //! ### M85 - Set max inactive time + // --------------------------------------- case 85: // M85 if(code_seen('S')) { max_inactive_time = code_value() * 1000; } break; #ifdef SAFETYTIMER - case 86: // M86 - set safety timer expiration time in seconds; M86 S0 will disable safety timer - //when safety timer expires heatbed and nozzle target temperatures are set to zero + + //! ### M86 - Set safety timer expiration time + //! + //! _Usage:_ + //! M86 S + //! + //! Sets the safety timer expiration time in seconds. M86 S0 will disable safety timer. + //! When safety timer expires, heatbed and nozzle target temperatures are set to zero. + case 86: if (code_seen('S')) { safetytimer_inactive_time = code_value() * 1000; safetyTimer.start(); } break; #endif - case 92: // M92 + + //! ### M92 Set Axis steps-per-unit + // --------------------------------------- + //! Same syntax as G92 + case 92: for(int8_t i=0; i < NUM_AXIS; i++) { if(code_seen(axis_codes[i])) @@ -5956,11 +6215,17 @@ Sigma_Exit: } } break; - case 110: //! M110 N - reset line pos + + //! ### M110 - Set Line number + // --------------------------------------- + case 110: if (code_seen('N')) gcode_LastN = code_value_long(); break; - case 113: // M113 - Get or set Host Keepalive interval + + //! ### M113 - Get or set host keep-alive interval + // ------------------------------------------ + case 113: if (code_seen('S')) { host_keepalive_interval = (uint8_t)code_value_short(); // NOMORE(host_keepalive_interval, 60); @@ -5971,6 +6236,16 @@ Sigma_Exit: SERIAL_PROTOCOLLN(""); } break; + + //! ### M115 - Firmware info + // -------------------------------------- + //! Print the firmware info and capabilities + //! + //! M115 [V] [U] + //! + //! Without any arguments, prints Prusa firmware version number, machine type, extruder count and UUID. + //! `M115 U` Checks the firmware version provided. If the firmware version provided by the U code is higher than the currently running firmware, + //! pause the print for 30s and ask the user to upgrade the firmware. case 115: // M115 if (code_seen('V')) { // Report the Prusa version number. @@ -5992,22 +6267,43 @@ Sigma_Exit: SERIAL_ECHOLNPGM(MACHINE_UUID); } break; -/* case 117: // M117 display message + + //! ### M114 - Get current position + // ------------------------------------- + case 114: + gcode_M114(); + break; + + + + //! ### M117 - Set LCD Message + // -------------------------------------- + + /* + M117 moved up to get the high priority + + case 117: // M117 display message starpos = (strchr(strchr_pointer + 5,'*')); if(starpos!=NULL) *(starpos)='\0'; lcd_setstatus(strchr_pointer + 5); break;*/ - case 114: // M114 - gcode_M114(); - break; - case 120: //! M120 - Disable endstops + + //! ### M120 - Disable endstops + // ---------------------------------------- + case 120: enable_endstops(false) ; break; - case 121: //! M121 - Enable endstops + + //! ### M121 - Enable endstops + // ---------------------------------------- + case 121: enable_endstops(true) ; break; - case 119: // M119 + + //! ### M119 - Get endstop states + // ---------------------------------------- + case 119: SERIAL_PROTOCOLRPGM(_N("Reporting endstop status"));////MSG_M119_REPORT SERIAL_PROTOCOLLN(""); #if defined(X_MIN_PIN) && X_MIN_PIN > -1 @@ -6066,8 +6362,12 @@ Sigma_Exit: #endif break; //TODO: update for all axis, use for loop + #ifdef BLINKM - case 150: // M150 + + //! ### M150 - Set RGB(W) Color + // ------------------------------------------- + case 150: { byte red; byte grn; @@ -6081,6 +6381,9 @@ Sigma_Exit: } break; #endif //BLINKM + + //! ### M200 - Set filament diameter + // ---------------------------------------- case 200: // M200 D set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters). { @@ -6119,7 +6422,10 @@ Sigma_Exit: calculate_extruder_multipliers(); } break; - case 201: // M201 + + //! ### M201 - Set Print Max Acceleration + // ------------------------------------------- + case 201: for (int8_t i = 0; i < NUM_AXIS; i++) { if (code_seen(axis_codes[i])) @@ -6151,6 +6457,9 @@ Sigma_Exit: } break; #endif + + //! ### M203 - Set Max Feedrate + // --------------------------------------- case 203: // M203 max feedrate mm/sec for (int8_t i = 0; i < NUM_AXIS; i++) { @@ -6174,10 +6483,17 @@ Sigma_Exit: } } break; + + //! ### M204 - Acceleration settings + // ------------------------------------------ + //! Supporting old format: + //! + //! M204 S[normal moves] T[filmanent only moves] + //! + //! and new format: + //! + //! M204 P[printing moves] R[filmanent only moves] T[travel moves] (as of now T is ignored) case 204: - //! M204 acclereration settings. - //!@n Supporting old format: M204 S[normal moves] T[filmanent only moves] - //!@n and new format: M204 P[printing moves] R[filmanent only moves] T[travel moves] (as of now T is ignored) { if(code_seen('S')) { // Legacy acceleration format. This format is used by the legacy Marlin, MK2 or MK3 firmware, @@ -6201,7 +6517,19 @@ Sigma_Exit: } } break; - case 205: //M205 advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk + + //! ### M205 - Set advanced settings + // --------------------------------------------- + //! Set some advanced settings related to movement. + //! + //! M205 [S] [T] [B] [X] [Y] [Z] [E] + /*! + - `S` - Minimum feedrate for print moves (unit/s) + - `T` - Minimum feedrate for travel moves (units/s) + - `B` - Minimum segment time (us) + - `X` - Maximum X jerk (units/s), similarly for other axes + */ + case 205: { if(code_seen('S')) cs.minimumfeedrate = code_value(); if(code_seen('T')) cs.mintravelfeedrate = code_value(); @@ -6214,13 +6542,19 @@ Sigma_Exit: if (cs.max_jerk[Y_AXIS] > DEFAULT_YJERK) cs.max_jerk[Y_AXIS] = DEFAULT_YJERK; } break; - case 206: // M206 additional homing offset + + //! ### M206 - Set additional homing offsets + // ---------------------------------------------- + case 206: for(int8_t i=0; i < 3; i++) { if(code_seen(axis_codes[i])) cs.add_homing[i] = code_value(); } break; #ifdef FWRETRACT + + //! ### M207 - Set firmware retraction + // -------------------------------------------------- case 207: //M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop] { if(code_seen('S')) @@ -6236,6 +6570,9 @@ Sigma_Exit: cs.retract_zlift = code_value() ; } }break; + + //! ### M208 - Set retract recover length + // -------------------------------------------- case 208: // M208 - set retract recover length S[positive mm surplus to the M207 S*] F[feedrate mm/min] { if(code_seen('S')) @@ -6247,6 +6584,9 @@ Sigma_Exit: cs.retract_recover_feedrate = code_value()/60 ; } }break; + + //! ### M209 - Enable/disable automatict retract + // --------------------------------------------- case 209: // M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction. { if(code_seen('S')) @@ -6287,6 +6627,9 @@ Sigma_Exit: }break; #endif // FWRETRACT #if EXTRUDERS > 1 + + // ### M218 - Set hotend offset + // ---------------------------------------- case 218: // M218 - set hotend offset (in mm), T X Y { uint8_t extruder; @@ -6314,6 +6657,8 @@ Sigma_Exit: }break; #endif + //! ### M220 Set feedrate percentage + // ----------------------------------------------- case 220: // M220 S- set speed factor override percentage { if (code_seen('B')) //backup current speed factor @@ -6329,6 +6674,9 @@ Sigma_Exit: } } break; + + //! ### M221 - Set extrude factor override percentage + // ---------------------------------------------------- case 221: // M221 S- set extrude factor override percentage { if(code_seen('S')) @@ -6351,6 +6699,8 @@ Sigma_Exit: } break; + //! ### M226 - Wait for Pin state + // ------------------------------------------ case 226: // M226 P S- Wait until the specified pin reaches the state required { if(code_seen('P')){ @@ -6404,6 +6754,9 @@ Sigma_Exit: break; #if NUM_SERVOS > 0 + + //! ### M280 - Set/Get servo position + // -------------------------------------------- case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds { int servo_index = -1; @@ -6442,6 +6795,9 @@ Sigma_Exit: #endif // NUM_SERVOS > 0 #if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER))) + + //! ### M300 - Play tone + // ----------------------- case 300: // M300 { int beepS = code_seen('S') ? code_value() : 110; @@ -6461,7 +6817,10 @@ Sigma_Exit: #endif // M300 #ifdef PIDTEMP - case 301: // M301 + + //! ### M301 - Set hotend PID + // --------------------------------------- + case 301: { if(code_seen('P')) cs.Kp = code_value(); if(code_seen('I')) cs.Ki = scalePID_i(code_value()); @@ -6489,7 +6848,10 @@ Sigma_Exit: break; #endif //PIDTEMP #ifdef PIDTEMPBED - case 304: // M304 + + //! ### M304 - Set bed PID + // -------------------------------------- + case 304: { if(code_seen('P')) cs.bedKp = code_value(); if(code_seen('I')) cs.bedKi = scalePID_i(code_value()); @@ -6507,6 +6869,9 @@ Sigma_Exit: } break; #endif //PIDTEMP + + //! ### M240 - Trigger camera + // -------------------------------------------- case 240: // M240 Triggers a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/ { #ifdef CHDK @@ -6539,7 +6904,10 @@ Sigma_Exit: } break; #ifdef PREVENT_DANGEROUS_EXTRUDE - case 302: // allow cold extrudes, or set the minimum extrude temperature + + //! ### M302 - Allow cold extrude, or set minimum extrude temperature + // ------------------------------------------------------------------- + case 302: { float temp = .0; if (code_seen('S')) temp=code_value(); @@ -6547,7 +6915,10 @@ Sigma_Exit: } break; #endif - case 303: // M303 PID autotune + + //! ### M303 - PID autotune + // ------------------------------------- + case 303: { float temp = 150.0; int e=0; @@ -6560,17 +6931,22 @@ Sigma_Exit: PID_autotune(temp, e, c); } break; - case 400: // M400 finish all moves + + //! ### M400 - Wait for all moves to finish + // ----------------------------------------- + case 400: { st_synchronize(); } break; - case 403: //! M403 set filament type (material) for particular extruder and send this information to mmu + //! ### M403 - Set filament type (material) for particular extruder and notify the MMU + // ---------------------------------------------- + case 403: { - //! currently three different materials are needed (default, flex and PVA) - //! add storing this information for different load/unload profiles etc. in the future - //!firmware does not wait for "ok" from mmu + // currently three different materials are needed (default, flex and PVA) + // add storing this information for different load/unload profiles etc. in the future + // firmware does not wait for "ok" from mmu if (mmu_enabled) { uint8_t extruder = 255; @@ -6582,27 +6958,41 @@ Sigma_Exit: } break; - case 500: // M500 Store settings in EEPROM + //! ### M500 - Store settings in EEPROM + // ----------------------------------------- + case 500: { Config_StoreSettings(); } break; - case 501: // M501 Read settings from EEPROM + + //! ### M501 - Read settings from EEPROM + // ---------------------------------------- + case 501: { Config_RetrieveSettings(); } break; - case 502: // M502 Revert to default settings + + //! ### M502 - Revert all settings to factory default + // ------------------------------------------------- + case 502: { Config_ResetDefault(); } break; - case 503: // M503 print settings currently in memory + + //! ### M503 - Repport all settings currently in memory + // ------------------------------------------------- + case 503: { Config_PrintSettings(); } break; - case 509: //M509 Force language selection + + //! ### M509 - Force language selection + // ------------------------------------------------ + case 509: { lang_reset(); SERIAL_ECHO_START; @@ -6610,6 +7000,9 @@ Sigma_Exit: } break; #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + + //! ### M540 - Abort print on endstop hit (enable/disable) + // ----------------------------------------------------- case 540: { if(code_seen('S')) abort_on_endstop_hit = code_value() > 0; @@ -6654,6 +7047,9 @@ Sigma_Exit: #endif // CUSTOM_M_CODE_SET_Z_PROBE_OFFSET #ifdef FILAMENTCHANGEENABLE + + //! ### M600 - Initiate Filament change procedure + // -------------------------------------- case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal] { st_synchronize(); @@ -6728,24 +7124,39 @@ Sigma_Exit: } break; #endif //FILAMENTCHANGEENABLE - case 601: //! M601 - Pause print + + //! ### M601 - Pause print + // ------------------------------- + case 601: { cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore lcd_pause_print(); } break; - case 602: { //! M602 - Resume print + //! ### M602 - Resume print + // ------------------------------- + case 602: { lcd_resume_print(); } break; - case 603: { //! M603 - Stop print + //! ### M603 - Stop print + // ------------------------------- + case 603: { lcd_print_stop(); } #ifdef PINDA_THERMISTOR - case 860: // M860 - Wait for PINDA thermistor to reach target temperature. + //! ### M860 - Wait for extruder temperature (PINDA) + // -------------------------------------------------------------- + /*! + Wait for PINDA thermistor to reach target temperature + + M860 [S] + + */ + case 860: { int set_target_pinda = 0; @@ -6789,7 +7200,18 @@ Sigma_Exit: break; } - case 861: // M861 - Set/Read PINDA temperature compensation offsets + //! ### M861 - Set/Get PINDA temperature compensation offsets + // ----------------------------------------------------------- + /*! + + M861 [ ? | ! | Z | S [I] ] + + - `?` - Print current EEPROM offset values + - `!` - Set factory default values + - `Z` - Set all values to 0 (effectively disabling PINDA temperature compensation) + - `S` `I` - Set compensation ustep value S for compensation table index I + */ + case 861: if (code_seen('?')) { // ? - Print out current EEPROM offset values uint8_t cal_status = calibration_status_pinda(); int16_t usteps = 0; @@ -6860,7 +7282,9 @@ Sigma_Exit: break; #endif //PINDA_THERMISTOR - + + //! ### M862 - Print checking + // ---------------------------------------------- case 862: // M862: print checking float nDummy; uint8_t nCommand; @@ -6921,12 +7345,16 @@ Sigma_Exit: break; #ifdef LIN_ADVANCE - case 900: // M900: Set LIN_ADVANCE options. + //! ### M900 - Set Linear advance options + // ---------------------------------------------- + case 900: gcode_M900(); break; #endif - case 907: // M907 Set digital trimpot motor current using axis codes. + //! ### M907 - Set digital trimpot motor current using axis codes + // --------------------------------------------------------------- + case 907: { #ifdef TMC2130 for (int i = 0; i < NUM_AXIS; i++) @@ -6957,7 +7385,10 @@ Sigma_Exit: #endif //TMC2130 } break; - case 908: // M908 Control digital trimpot directly. + + //! ### M908 - Control digital trimpot directly + // --------------------------------------------------------- + case 908: { #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1 uint8_t channel,current; @@ -6970,13 +7401,17 @@ Sigma_Exit: #ifdef TMC2130_SERVICE_CODES_M910_M918 - case 910: //! M910 - TMC2130 init + //! ### M910 - TMC2130 init + // ----------------------------------------------- + case 910: { tmc2130_init(); } break; - case 911: //! M911 - Set TMC2130 holding currents + //! ### M911 - Set TMC2130 holding currents + // ------------------------------------------------- + case 911: { if (code_seen('X')) tmc2130_set_current_h(0, code_value()); if (code_seen('Y')) tmc2130_set_current_h(1, code_value()); @@ -6985,7 +7420,9 @@ Sigma_Exit: } break; - case 912: //! M912 - Set TMC2130 running currents + //! ### M912 - Set TMC2130 running currents + // ----------------------------------------------- + case 912: { if (code_seen('X')) tmc2130_set_current_r(0, code_value()); if (code_seen('Y')) tmc2130_set_current_r(1, code_value()); @@ -6993,13 +7430,18 @@ Sigma_Exit: if (code_seen('E')) tmc2130_set_current_r(3, code_value()); } break; - case 913: //! M913 - Print TMC2130 currents + + //! ### M913 - Print TMC2130 currents + // ----------------------------- + case 913: { tmc2130_print_currents(); } break; - case 914: //! M914 - Set normal mode + //! ### M914 - Set TMC2130 normal mode + // ------------------------------ + case 914: { tmc2130_mode = TMC2130_MODE_NORMAL; update_mode_profile(); @@ -7007,7 +7449,9 @@ Sigma_Exit: } break; - case 915: //! M915 - Set silent mode + //! ### M95 - Set TMC2130 silent mode + // ------------------------------ + case 915: { tmc2130_mode = TMC2130_MODE_SILENT; update_mode_profile(); @@ -7015,7 +7459,9 @@ Sigma_Exit: } break; - case 916: //! M916 - Set sg_thrs + //! ### M916 - Set TMC2130 Stallguard sensitivity threshold + // ------------------------------------------------------- + case 916: { if (code_seen('X')) tmc2130_sg_thr[X_AXIS] = code_value(); if (code_seen('Y')) tmc2130_sg_thr[Y_AXIS] = code_value(); @@ -7026,7 +7472,9 @@ Sigma_Exit: } break; - case 917: //! M917 - Set TMC2130 pwm_ampl + //! ### M917 - Set TMC2130 PWM amplitude offset (pwm_ampl) + // -------------------------------------------------------------- + case 917: { if (code_seen('X')) tmc2130_set_pwm_ampl(0, code_value()); if (code_seen('Y')) tmc2130_set_pwm_ampl(1, code_value()); @@ -7035,7 +7483,9 @@ Sigma_Exit: } break; - case 918: //! M918 - Set TMC2130 pwm_grad + //! ### M918 - Set TMC2130 PWM amplitude gradient (pwm_grad) + // ------------------------------------------------------------- + case 918: { if (code_seen('X')) tmc2130_set_pwm_grad(0, code_value()); if (code_seen('Y')) tmc2130_set_pwm_grad(1, code_value()); @@ -7046,7 +7496,10 @@ Sigma_Exit: #endif //TMC2130_SERVICE_CODES_M910_M918 - case 350: //! M350 - Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. + //! ### M350 - Set microstepping mode + // --------------------------------------------------- + //! Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers. + case 350: { #ifdef TMC2130 if(code_seen('E')) @@ -7083,7 +7536,13 @@ Sigma_Exit: #endif //TMC2130 } break; - case 351: //! M351 - Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. + + //! ### M351 - Toggle Microstep Pins + // ----------------------------------- + //! Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low. + //! + //! M351 [B<0|1>] [E<0|1>] S<1|2> [X<0|1>] [Y<0|1>] [Z<0|1>] + case 351: { #if defined(X_MS1_PIN) && X_MS1_PIN > -1 if(code_seen('S')) switch((int)code_value()) @@ -7101,14 +7560,28 @@ Sigma_Exit: #endif } break; - case 701: //! M701 - load filament + + //! ### M701 - Load filament + // ------------------------- + case 701: { if (mmu_enabled && code_seen('E')) tmp_extruder = code_value(); gcode_M701(); } break; - case 702: //! M702 [U C] - + + //! ### M702 - Unload filament + // ------------------------ + /*! + + M702 [U C] + + - `U` Unload all filaments used in current print + - `C` Unload just current filament + - without any parameters unload all filaments + */ + case 702: { #ifdef SNMM if (code_seen('U')) @@ -7130,7 +7603,9 @@ Sigma_Exit: } break; - case 999: // M999: Restart after being stopped + //! ### M999 - Restart after being stopped + // ------------------------------------ + case 999: Stopped = false; lcd_reset_alert_level(); gcode_LastN = Stopped_gcode_LastN; @@ -7144,6 +7619,10 @@ Sigma_Exit: } } // end if(code_seen('M')) (end of M codes) + + //! ----------------------------------------------------------------------------------------- + //! T Codes + //! //! T - select extruder in case of multi extruder printer //! select filament in case of MMU_V2 //! if extruder is "?", open menu to let the user select extruder/filament @@ -7337,46 +7816,95 @@ Sigma_Exit: } } // end if(code_seen('T')) (end of T codes) + //! ---------------------------------------------------------------------------------------------- + else if (code_seen('D')) // D codes (debug) { switch((int)code_value()) { - case -1: //! D-1 - Endless loop + + //! ### D-1 - Endless loop + // ------------------- + case -1: dcode__1(); break; #ifdef DEBUG_DCODES - case 0: //! D0 - Reset + + //! ### D0 - Reset + // -------------- + case 0: dcode_0(); break; - case 1: //! D1 - Clear EEPROM + + //! ### D1 - Clear EEPROM + // ------------------ + case 1: dcode_1(); break; - case 2: //! D2 - Read/Write RAM + + //! ### D2 - Read/Write RAM + // -------------------- + case 2: dcode_2(); break; #endif //DEBUG_DCODES #ifdef DEBUG_DCODE3 - case 3: //! D3 - Read/Write EEPROM + + //! ### D3 - Read/Write EEPROM + // ----------------------- + case 3: dcode_3(); break; #endif //DEBUG_DCODE3 #ifdef DEBUG_DCODES - case 4: //! D4 - Read/Write PIN + + //! ### D4 - Read/Write PIN + // --------------------- + case 4: dcode_4(); break; #endif //DEBUG_DCODES #ifdef DEBUG_DCODE5 - case 5: // D5 - Read/Write FLASH + + //! ### D5 - Read/Write FLASH + // ------------------------ + case 5: dcode_5(); break; break; #endif //DEBUG_DCODE5 #ifdef DEBUG_DCODES - case 6: // D6 - Read/Write external FLASH + + //! ### D6 - Read/Write external FLASH + // --------------------------------------- + case 6: dcode_6(); break; - case 7: //! D7 - Read/Write Bootloader + + //! ### D7 - Read/Write Bootloader + // ------------------------------- + case 7: dcode_7(); break; - case 8: //! D8 - Read/Write PINDA + + //! ### D8 - Read/Write PINDA + // --------------------------- + case 8: dcode_8(); break; - case 9: //! D9 - Read/Write ADC + + // ### D9 - Read/Write ADC + // ------------------------ + case 9: dcode_9(); break; - case 10: //! D10 - XYZ calibration = OK + + //! ### D10 - XYZ calibration = OK + // ------------------------------ + case 10: dcode_10(); break; #endif //DEBUG_DCODES #ifdef HEATBED_ANALYSIS + + //! ### D80 - Bed check + // --------------------- + /*! + - `E` - dimension x + - `F` - dimention y + - `G` - points_x + - `H` - points_y + - `I` - offset_x + - `J` - offset_y + */ case 80: { float dimension_x = 40; @@ -7401,6 +7929,16 @@ Sigma_Exit: bed_check(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y); }break; + //! ### D81 - Bed analysis + // ----------------------------- + /*! + - `E` - dimension x + - `F` - dimention y + - `G` - points_x + - `H` - points_y + - `I` - offset_x + - `J` - offset_y + */ case 81: { float dimension_x = 40; @@ -7423,7 +7961,10 @@ Sigma_Exit: #endif //HEATBED_ANALYSIS #ifdef DEBUG_DCODES - case 106: //D106 print measured fan speed for different pwm values + + //! ### D106 print measured fan speed for different pwm values + // -------------------------------------------------------------- + case 106: { for (int i = 255; i > 0; i = i - 5) { fanSpeed = i; @@ -7437,12 +7978,52 @@ Sigma_Exit: }break; #ifdef TMC2130 - case 2130: //! D2130 - TMC2130 + //! ### D2130 - TMC2130 Trinamic stepper controller + // --------------------------- + + + /*! + + + D2130[subcommand][value] + + - : + - '0' current off + - '1' current on + - '+' single step + - * value sereval steps + - '-' dtto oposite direction + - '?' read register + - * "mres" + - * "step" + - * "mscnt" + - * "mscuract" + - * "wave" + - '!' set register + - * "mres" + - * "step" + - * "wave" + - '@' home calibrate axis + + Example: + + D2130E?wave ... print extruder microstep linearity compensation curve + + D2130E!wave0 ... disable extruder linearity compensation curve, (sine curve is used) + + D2130E!wave220 ... (sin(x))^1.1 extruder microstep compensation curve used + */ + + + case 2130: dcode_2130(); break; #endif //TMC2130 #if (defined (FILAMENT_SENSOR) && defined(PAT9125)) - case 9125: //! D9125 - FILAMENT_SENSOR + + //! ### D9125 - FILAMENT_SENSOR + // --------------------------------- + case 9125: dcode_9125(); break; #endif //FILAMENT_SENSOR @@ -7461,6 +8042,13 @@ Sigma_Exit: ClearToSend(); } + + + /** @defgroup GCodes G-Code List + */ + +// --------------------------------------------------- + void FlushSerialRequestResend() { //char cmdbuffer[bufindr][100]="Resend:"; diff --git a/Firmware/doxyfile b/Firmware/doxyfile index 9c2d550c..346ce604 100644 --- a/Firmware/doxyfile +++ b/Firmware/doxyfile @@ -2050,7 +2050,7 @@ PERLMOD_MAKEVAR_PREFIX = # C-preprocessor directives found in the sources and include files. # The default value is: YES. -ENABLE_PREPROCESSING = YES +ENABLE_PREPROCESSING = NO # If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names # in the source code. If set to NO, only conditional compilation will be From bd4bfbe58622352f6da7be93b4eb0c8868a0c370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BChn?= Date: Fri, 19 Jul 2019 16:15:12 +0200 Subject: [PATCH 30/30] Added M862 details --- Firmware/Marlin_main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0415b2bf..0e5850b9 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7285,6 +7285,24 @@ Sigma_Exit: //! ### M862 - Print checking // ---------------------------------------------- + /*! + Checks the parameters of the printer and gcode and performs compatibility check + + - M862.1 [ P | Q ] + + - M862.2 [ P | Q ] + + - M862.3 [ P | Q ] + + - M862.4 [ P | Q] + + - M862.5 [ P | Q] + + + When run with P<> argument, the check is performed against the input value. + When run with Q argument, the current value is shown. + + */ case 862: // M862: print checking float nDummy; uint8_t nCommand;