From 330f1576fc0135673ce034dc5f564b5a96691afd Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 18 Jan 2018 16:24:25 +0100 Subject: [PATCH 1/3] Support for debug builds: A build version and repository is displayed on the welcome screen, D-codes, stack overflow check and stepper timer overflow check are enabled in the debug mode. --- Firmware/Configuration.h | 12 +++++- Firmware/Configuration_prusa.h | 8 ++-- Firmware/Marlin_main.cpp | 14 ++++++- Firmware/ultralcd.cpp | 3 ++ .../ultralcd_implementation_hitachi_HD44780.h | 38 +++++++++---------- 5 files changed, 49 insertions(+), 26 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 290624a6..9f806b18 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -2,7 +2,6 @@ #define CONFIGURATION_H #include "boards.h" -#include "Configuration_prusa.h" #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) @@ -10,7 +9,8 @@ // Firmware version #define FW_VERSION "3.1.1-RC5" #define FW_COMMIT_NR 150 -#define FW_DEV_VERSION FW_VERSION_RC +#define FW_DEV_VERSION FW_VERSION_DEBUG +#define FW_REPOSITORY "Prusa3D/MK3" #define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR) #define FW_VERSION_DEBUG 5 @@ -20,6 +20,14 @@ #define FW_VERSION_RC 1 #define FW_VERSION_GOLD 0 +#if FW_DEV_VERSION == FW_VERSION_DEBUG +#define DEBUG_BUILD +#else +#undef DEBUG_BUILD +#endif + +#include "Configuration_prusa.h" + #define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC_LEN 10 // The total size of the EEPROM is diff --git a/Firmware/Configuration_prusa.h b/Firmware/Configuration_prusa.h index 65506367..72dc6d0d 100644 --- a/Firmware/Configuration_prusa.h +++ b/Firmware/Configuration_prusa.h @@ -105,10 +105,9 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define MINTEMP_MINAMBIENT_RAW 978 -//DEBUG +#ifdef DEBUG_BUILD //#define _NO_ASM #define DEBUG_DCODES //D codes -#if 1 #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR //#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial //#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD @@ -132,8 +131,9 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o //#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled) //#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled) #define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line -//#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. -#endif +#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. +#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +#endif /* DEBUG_BUILD */ /*------------------------------------ diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c2a27fbb..94e76298 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -892,7 +892,19 @@ void show_fw_version_warnings() { case(FW_VERSION_ALPHA): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_ALPHA); break; case(FW_VERSION_BETA): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_BETA); break; case(FW_VERSION_RC): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_RC); break; - case(FW_VERSION_DEBUG): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_DEBUG); break; + case(FW_VERSION_DEBUG): +#if 1 + lcd_update_enable(false); + lcd_implementation_clear(); + lcd_print_at_PGM(0, 0, PSTR("Debbugging build !!!")); + lcd_print_at_PGM(0, 1, PSTR("May destroy printer!")); + lcd_print_at_PGM(0, 2, PSTR("ver ")); lcd_printPGM(PSTR(FW_VERSION_FULL)); + lcd_print_at_PGM(0, 3, PSTR(FW_REPOSITORY)); + lcd_wait_for_click(); +#else + lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_DEBUG); +#endif + break; default: lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_UNKNOWN); break; } lcd_update_enable(true); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5f5091b0..3638e52b 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1675,6 +1675,9 @@ static void lcd_support_menu() MENU_ITEM(back, PSTR("Firmware:"), lcd_main_menu); MENU_ITEM(back, PSTR(" " FW_VERSION_FULL), lcd_main_menu); +#if (FW_DEV_VERSION != FW_VERSION_GOLD) && (FW_DEV_VERSION != FW_VERSION_RC) + MENU_ITEM(back, PSTR(" repo " FW_REPOSITORY), lcd_main_menu); +#endif // Ideally this block would be optimized out by the compiler. /* const uint8_t fw_string_len = strlen_P(FW_VERSION_STR_P()); if (fw_string_len < 6) { diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index 4ff323b8..0785b44d 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -729,20 +729,7 @@ static void lcd_implementation_status_screen() lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); lcd_printPGM(PSTR(" ")); -#if 1 - //Print Feedrate - lcd.setCursor(LCD_WIDTH - 8-2, 1); - lcd_printPGM(PSTR(" ")); - lcd.print(LCD_STR_FEEDRATE[0]); - lcd.print(itostr3(feedmultiply)); - lcd_printPGM(PSTR("% ")); - - //lcd.setCursor(8, 0); - //lcd.print(itostr3(fan_speed[0])); - //lcd.setCursor(8, 1); - //lcd.print(itostr3(fan_speed[1])); - -#else +#ifdef PLANNER_DIAGNOSTICS //Print Feedrate lcd.setCursor(LCD_WIDTH - 8-2, 1); lcd.print(LCD_STR_FEEDRATE[0]); @@ -751,15 +738,23 @@ static void lcd_implementation_status_screen() { uint8_t queue = planner_queue_min(); if (queue < (BLOCK_BUFFER_SIZE >> 1)) { - lcd.print('!'); + lcd.write('!'); } else { - lcd.print((char)(queue / 10) + '0'); + lcd.write((char)(queue / 10) + '0'); queue %= 10; } - lcd.print((char)queue + '0'); + lcd.write((char)queue + '0'); planner_queue_min_reset(); } -#endif +#else /* PLANNER_DIAGNOSTICS */ + //Print Feedrate + lcd.setCursor(LCD_WIDTH - 8-2, 1); + lcd_printPGM(PSTR(" ")); + lcd.print(LCD_STR_FEEDRATE[0]); + lcd.print(itostr3(feedmultiply)); + lcd_printPGM(PSTR("% ")); +#endif /* PLANNER_DIAGNOSTICS */ + bool print_sd_status = true; #ifdef PINDA_THERMISTOR @@ -872,7 +867,12 @@ if (print_sd_status) } // If printing from SD, show what we are printing - if ((IS_SD_PRINTING) && !custom_message) + if ((IS_SD_PRINTING) && !custom_message +#ifdef DEBUG_BUILD + && lcd_status_message[0] == 0 +#endif /* DEBUG_BUILD */ + ) + { if(strlen(card.longFilename) > LCD_WIDTH) { From 7edce0b89081c84c07fb0d13bf1030fe68f83f00 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 18 Jan 2018 16:43:40 +0100 Subject: [PATCH 2/3] Only show the debug menu in the DEBUG_BUILD. --- Firmware/ultralcd.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 3638e52b..ff0cc337 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1563,6 +1563,7 @@ static void lcd_menu_fails_stats() } +#ifdef DEBUG_BUILD extern uint16_t SP_min; extern char* __malloc_heap_start; extern char* __malloc_heap_end; @@ -1577,6 +1578,7 @@ static void lcd_menu_debug() lcd_return_to_status(); } } +#endif /* DEBUG_BUILD */ static void lcd_menu_temperatures() { @@ -1713,8 +1715,11 @@ static void lcd_support_menu() MENU_ITEM(submenu, MSG_MENU_TEMPERATURES, lcd_menu_temperatures); MENU_ITEM(submenu, MSG_MENU_VOLTAGES, lcd_menu_voltages); - + +#ifdef DEBUG_BUILD MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug); +#endif /* DEBUG_BUILD */ + #endif //MK1BP END_MENU(); } From 69f97e0ec32633bf58e48d46668b5854e280aff1 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Mon, 22 Jan 2018 17:41:05 +0100 Subject: [PATCH 3/3] Separated the "Unknown" build from the "Development" build. Documented purpose of the various build types. --- Firmware/Configuration.h | 28 +++++++++++++++++++++------- Firmware/Marlin_main.cpp | 16 ++++++++-------- Firmware/language_all.cpp | 11 ++--------- Firmware/language_all.h | 2 -- Firmware/language_cz.h | 3 +-- Firmware/language_en.h | 3 +-- 6 files changed, 33 insertions(+), 30 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 9f806b18..81c8a602 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -9,16 +9,30 @@ // Firmware version #define FW_VERSION "3.1.1-RC5" #define FW_COMMIT_NR 150 -#define FW_DEV_VERSION FW_VERSION_DEBUG +// 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 #define FW_REPOSITORY "Prusa3D/MK3" #define FW_VERSION_FULL FW_VERSION "-" STR(FW_COMMIT_NR) -#define FW_VERSION_DEBUG 5 -#define FW_VERSION_UNKNOWN 4 -#define FW_VERSION_ALPHA 3 -#define FW_VERSION_BETA 2 -#define FW_VERSION_RC 1 -#define FW_VERSION_GOLD 0 +// Debug version has debugging enabled (the symbol DEBUG_BUILD is set). +// The debug build may be a bit slower than the non-debug build, therefore the debug build should +// not be shipped to a customer. +#define FW_VERSION_DEBUG 6 +// This is a development build. A development build is either built from an unofficial git repository, +// or from an unofficial branch, or it does not have a label set. Only the build server should set this build type. +#define FW_VERSION_DEVEL 5 +// This is an alpha release. Only the build server should set this build type. +#define FW_VERSION_ALPHA 4 +// This is a beta release. Only the build server should set this build type. +#define FW_VERSION_BETA 3 +// This is a release candidate build. Only the build server should set this build type. +#define FW_VERSION_RC 2 +// This is a final release. Only the build server should set this build type. +#define FW_VERSION_GOLD 1 +// This is an unofficial build. The firmware should only be checked into github with this symbol, +// the build server shall never produce builds with this build type. +#define FW_VERSION_UNKNOWN 0 #if FW_DEV_VERSION == FW_VERSION_DEBUG #define DEBUG_BUILD diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 94e76298..eee08b18 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -889,21 +889,21 @@ void factory_reset() void show_fw_version_warnings() { if (FW_DEV_VERSION == FW_VERSION_GOLD || FW_DEV_VERSION == FW_VERSION_RC) return; switch (FW_DEV_VERSION) { - case(FW_VERSION_ALPHA): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_ALPHA); break; - case(FW_VERSION_BETA): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_BETA); break; - case(FW_VERSION_RC): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_RC); break; - case(FW_VERSION_DEBUG): -#if 1 + case(FW_VERSION_ALPHA): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_ALPHA); break; + case(FW_VERSION_BETA): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_BETA); break; + case(FW_VERSION_DEVEL): + case(FW_VERSION_DEBUG): lcd_update_enable(false); lcd_implementation_clear(); + #if FW_DEV_VERSION == FW_VERSION_DEVEL + lcd_print_at_PGM(0, 0, PSTR("Development build !!")); + #else lcd_print_at_PGM(0, 0, PSTR("Debbugging build !!!")); + #endif lcd_print_at_PGM(0, 1, PSTR("May destroy printer!")); lcd_print_at_PGM(0, 2, PSTR("ver ")); lcd_printPGM(PSTR(FW_VERSION_FULL)); lcd_print_at_PGM(0, 3, PSTR(FW_REPOSITORY)); lcd_wait_for_click(); -#else - lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_DEBUG); -#endif break; default: lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_UNKNOWN); break; } diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 9ccc1a25..eaba17fe 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -845,13 +845,6 @@ const char * const MSG_FW_VERSION_BETA_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_FW_VERSION_BETA_CZ }; -const char MSG_FW_VERSION_DEBUG_EN[] PROGMEM = "This is development firmware version which contains additional debugging features. Using this version may cause printer damage."; -const char MSG_FW_VERSION_DEBUG_CZ[] PROGMEM = "Toto je vyvojova verze firmwaru obsahujici funkce pro debugging. Pouziti teto verze muze poskodit Vasi tiskarnu."; -const char * const MSG_FW_VERSION_DEBUG_LANG_TABLE[LANG_NUM] PROGMEM = { - MSG_FW_VERSION_DEBUG_EN, - MSG_FW_VERSION_DEBUG_CZ -}; - const char MSG_FW_VERSION_RC_EN[] PROGMEM = "This firmware version is release candidate. Some of the features may not work properly."; const char MSG_FW_VERSION_RC_CZ[] PROGMEM = "Tato verze firmware je release candidate. Nektere z funkci nemusi pracovat spolehlive."; const char * const MSG_FW_VERSION_RC_LANG_TABLE[LANG_NUM] PROGMEM = { @@ -859,8 +852,8 @@ const char * const MSG_FW_VERSION_RC_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_FW_VERSION_RC_CZ }; -const char MSG_FW_VERSION_UNKNOWN_EN[] PROGMEM = "WARNING: Unknown firmware version"; -const char MSG_FW_VERSION_UNKNOWN_CZ[] PROGMEM = "VAROVANI: Neznama verze firmware"; +const char MSG_FW_VERSION_UNKNOWN_EN[] PROGMEM = "WARNING: This is an unofficial, unsupported build. Use at your own risk!"; +const char MSG_FW_VERSION_UNKNOWN_CZ[] PROGMEM = "VAROVANI: Neznama, nepodporovana verze firmware. Pouziti na vlastni nebezpeci!"; const char * const MSG_FW_VERSION_UNKNOWN_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_FW_VERSION_UNKNOWN_EN, MSG_FW_VERSION_UNKNOWN_CZ diff --git a/Firmware/language_all.h b/Firmware/language_all.h index 22d35f49..bc535679 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -290,8 +290,6 @@ extern const char* const MSG_FW_VERSION_ALPHA_LANG_TABLE[LANG_NUM]; #define MSG_FW_VERSION_ALPHA LANG_TABLE_SELECT(MSG_FW_VERSION_ALPHA_LANG_TABLE) extern const char* const MSG_FW_VERSION_BETA_LANG_TABLE[LANG_NUM]; #define MSG_FW_VERSION_BETA LANG_TABLE_SELECT(MSG_FW_VERSION_BETA_LANG_TABLE) -extern const char* const MSG_FW_VERSION_DEBUG_LANG_TABLE[LANG_NUM]; -#define MSG_FW_VERSION_DEBUG LANG_TABLE_SELECT(MSG_FW_VERSION_DEBUG_LANG_TABLE) extern const char* const MSG_FW_VERSION_RC_LANG_TABLE[LANG_NUM]; #define MSG_FW_VERSION_RC LANG_TABLE_SELECT(MSG_FW_VERSION_RC_LANG_TABLE) extern const char* const MSG_FW_VERSION_UNKNOWN_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_cz.h b/Firmware/language_cz.h index 6a8dead2..75c09d40 100644 --- a/Firmware/language_cz.h +++ b/Firmware/language_cz.h @@ -401,8 +401,7 @@ #define MSG_FSENS_NOT_RESPONDING "CHYBA: Filament senzor nereaguje, zkontrolujte zapojeni." -#define MSG_FW_VERSION_UNKNOWN "VAROVANI: Neznama verze firmware" +#define MSG_FW_VERSION_UNKNOWN "VAROVANI: Neznama, nepodporovana verze firmware. Pouziti na vlastni nebezpeci!" #define MSG_FW_VERSION_ALPHA "Pouzivate alpha verzi firmwaru. Jedna se o vyvojovou verzi. Pouzivani teto verze firmware neni doporuceno a muze zpusobit poskozeni tiskarny." #define MSG_FW_VERSION_BETA "Pouzivate beta verzi firmwaru. Jedna se o vyvojovou verzi. Pouzivani teto verze firmware neni doporuceno a muze zpusobit poskozeni tiskarny." #define MSG_FW_VERSION_RC "Tato verze firmware je release candidate. Nektere z funkci nemusi pracovat spolehlive." -#define MSG_FW_VERSION_DEBUG "Toto je vyvojova verze firmwaru obsahujici funkce pro debugging. Pouziti teto verze muze poskodit Vasi tiskarnu." diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 81e3bca6..059889a6 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -407,8 +407,7 @@ #define(length=20, lines=4) MSG_AUTOLOADING_ONLY_IF_FSENS_ON "Autoloading filament available only when filament sensor is turned on..." #define(length=20, lines=4) MSG_FSENS_NOT_RESPONDING "ERROR: Filament sensor is not responding, please check connection." -#define(length=20, lines=8) MSG_FW_VERSION_UNKNOWN "WARNING: Unknown firmware version" +#define(length=20, lines=8) MSG_FW_VERSION_UNKNOWN "WARNING: This is an unofficial, unsupported build. Use at your own risk!" #define(length=20, lines=8) MSG_FW_VERSION_ALPHA "You are using firmware alpha version. This is development version. Using this version is not recommended and may cause printer damage." #define(length=20, lines=8) MSG_FW_VERSION_BETA "You are using firmware beta version. This is development version. Using this version is not recommended and may cause printer damage." #define(length=20, lines=8) MSG_FW_VERSION_RC "This firmware version is release candidate. Some of the features may not work properly." -#define(length=20, lines=8) MSG_FW_VERSION_DEBUG "This is development firmware version which contains additional debugging features. Using this version may cause printer damage." \ No newline at end of file