From 5611852e1b9ec51d6110ae7d6deb557bfe5a7560 Mon Sep 17 00:00:00 2001 From: Ted Hess Date: Thu, 29 Jun 2017 14:12:35 -0400 Subject: [PATCH 1/5] Fix/implement M110 command. Allow colons in command - don't treat as EOL. --- Firmware/Marlin_main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 30035559d..3a33aeedd 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1379,7 +1379,6 @@ void get_command() continue; if(serial_char == '\n' || serial_char == '\r' || - (serial_char == ':' && comment_mode == false) || serial_count >= (MAX_CMD_SIZE - 1) ) { if(!serial_count) { //if empty line @@ -1388,7 +1387,6 @@ void get_command() } cmdbuffer[bufindw+serial_count+1] = 0; //terminate string if(!comment_mode){ - comment_mode = false; //for new command if ((strchr_pointer = strstr(cmdbuffer+bufindw+1, "PRUSA")) == NULL && (strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) { if ((strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) { @@ -4336,6 +4334,12 @@ Sigma_Exit: } } break; + case 110: // M110 - reset line pos + if (code_seen('N')) + gcode_LastN = code_value_long(); + else + gcode_LastN = 0; + break; case 115: // M115 if (code_seen('V')) { // Report the Prusa version number. From c3fb6e43fd1f354dad1fcac16f676cb3cae16510 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 21 Jul 2017 16:51:36 +0200 Subject: [PATCH 2/5] fan kickstart enabled --- Firmware/Configuration_adv.h | 2 +- Firmware/Marlin_main.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/Configuration_adv.h b/Firmware/Configuration_adv.h index 54e74ba0a..52e2fcc69 100644 --- a/Firmware/Configuration_adv.h +++ b/Firmware/Configuration_adv.h @@ -68,7 +68,7 @@ // When first starting the main fan, run it at full speed for the // given number of milliseconds. This gets the fan spinning reliably // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) -//#define FAN_KICKSTART_TIME 100 +#define FAN_KICKSTART_TIME 1000 diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0d7d5c6e2..af91a5b65 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1385,7 +1385,7 @@ void get_command() continue; if(serial_char == '\n' || serial_char == '\r' || - (serial_char == ':' && comment_mode == false) || + (serial_char == ':' && comment_mode == false) || serial_count >= (MAX_CMD_SIZE - 1) ) { if(!serial_count) { //if empty line @@ -1394,7 +1394,7 @@ void get_command() } cmdbuffer[bufindw+serial_count+1] = 0; //terminate string if(!comment_mode){ - comment_mode = false; //for new command + comment_mode = false; //for new command if ((strchr_pointer = strstr(cmdbuffer+bufindw+1, "PRUSA")) == NULL && (strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) { if ((strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) { From 6bbbf3f88ee365b39090f9557bb66ca4272cfb11 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 21 Jul 2017 17:39:36 +0200 Subject: [PATCH 3/5] removed redundant code --- Firmware/Marlin_main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 548001dd3..4ded6e3d6 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1394,8 +1394,7 @@ void get_command() } cmdbuffer[bufindw+serial_count+1] = 0; //terminate string if(!comment_mode){ - comment_mode = false; //for new command - if ((strchr_pointer = strstr(cmdbuffer+bufindw+1, "PRUSA")) == NULL && (strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) { + if ((strchr_pointer = strstr(cmdbuffer+bufindw+1, "PRUSA")) == NULL && (strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) { if ((strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) { // Line number met. When sending a G-code over a serial line, each line may be stamped with its index, From 2a7c4f0926141ebcb6425fd50974e2636aeedf0e Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 21 Jul 2017 20:17:00 +0200 Subject: [PATCH 4/5] Farm mode: when print finishes, ask which filament was used for print; statistics modified --- Firmware/ultralcd.cpp | 101 +++++++++++++++++++++++++++++++++++++++--- Firmware/ultralcd.h | 3 +- 2 files changed, 96 insertions(+), 8 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c731651c5..ec4e9c092 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2042,7 +2042,7 @@ void lcd_diag_show_end_stops() -void prusa_statistics(int _message) { +void prusa_statistics(int _message, uint8_t _fil_nr) { switch (_message) @@ -2111,14 +2111,18 @@ void prusa_statistics(int _message) { break; case 4: // print succesfull - SERIAL_ECHOLN("{[RES:1]"); + SERIAL_ECHO("{[RES:1][FIL:"); + MYSERIAL.print(int(_fil_nr)); + SERIAL_ECHO("]"); prusa_stat_printerstatus(status_number); prusa_stat_farm_number(); SERIAL_ECHOLN("}"); farm_timer = 2; break; case 5: // print not succesfull - SERIAL_ECHOLN("{[RES:0]"); + SERIAL_ECHO("{[RES:0][FIL:"); + MYSERIAL.print(int(_fil_nr)); + SERIAL_ECHO("]"); prusa_stat_printerstatus(status_number); prusa_stat_farm_number(); SERIAL_ECHOLN("}"); @@ -3603,8 +3607,91 @@ static void lcd_farm_no() } + +unsigned char lcd_choose_color() { + //function returns index of currently chosen item + //following part can be modified from 2 to 255 items: + //----------------------------------------------------- + unsigned char items_no = 2; + const char *item[items_no]; + item[0] = "Black"; + item[1] = "Orange"; + //----------------------------------------------------- + unsigned char active_rows; + static int first = 0; + int enc_dif = 0; + unsigned char cursor_pos = 1; + enc_dif = encoderDiff; + lcd_implementation_clear(); + lcd.setCursor(0, 1); + lcd.print(">"); + + active_rows = items_no < 3 ? items_no : 3; + + while (1) { + lcd_print_at_PGM(0, 0, PSTR("Choose color:")); + for (int i = 0; i < active_rows; i++) { + lcd.setCursor(1, i+1); + lcd.print(item[first + i]); + } + + manage_heater(); + manage_inactivity(true); + + if (abs((enc_dif - encoderDiff)) > 4) { + + if ((abs(enc_dif - encoderDiff)) > 1) { + if (enc_dif > encoderDiff) { + cursor_pos--; + } + + if (enc_dif < encoderDiff) { + cursor_pos++; + } + + if (cursor_pos > active_rows) { + cursor_pos = active_rows; + if (first < items_no - active_rows) { + first++; + lcd_implementation_clear(); + } + } + + if (cursor_pos < 1) { + cursor_pos = 1; + if (first > 0) { + first--; + lcd_implementation_clear(); + } + } + lcd.setCursor(0, 1); + lcd.print(" "); + lcd.setCursor(0, 2); + lcd.print(" "); + lcd.setCursor(0, 3); + lcd.print(" "); + lcd.setCursor(0, cursor_pos); + lcd.print(">"); + enc_dif = encoderDiff; + delay(100); + } + + } + + if (lcd_clicked()) { + while (lcd_clicked()); + delay(10); + while (lcd_clicked()); + return(cursor_pos + first - 1); + } + + } + +} + void lcd_confirm_print() { + uint8_t filament_type; int enc_dif = 0; int cursor_pos = 1; int _ret = 0; @@ -3653,14 +3740,14 @@ void lcd_confirm_print() if (cursor_pos == 1) { _ret = 1; - prusa_statistics(20); - prusa_statistics(4); + filament_type = lcd_choose_color(); + prusa_statistics(4, filament_type); } if (cursor_pos == 2) { _ret = 2; - prusa_statistics(20); - prusa_statistics(5); + filament_type = lcd_choose_color(); + prusa_statistics(5, filament_type); } } diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index a9a1cbf05..2a8fb89e0 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -26,8 +26,9 @@ void lcd_loading_color(); void lcd_force_language_selection(); void lcd_sdcard_stop(); - void prusa_statistics(int _message); + void prusa_statistics(int _message, uint8_t _col_nr = 0); void lcd_confirm_print(); + unsigned char lcd_choose_color(); void lcd_mylang(); bool lcd_detected(void); From fe44e60e5f43c40cadad3b1bb749358a478d6b83 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Fri, 21 Jul 2017 20:26:16 +0200 Subject: [PATCH 5/5] version changed --- Firmware/Configuration.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index d20e4bb3d..56058b0f9 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -5,7 +5,7 @@ #include "Configuration_prusa.h" // Firmware version -#define FW_version "3.0.12-1" +#define FW_version "3.0.12-2" #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10