Merge pull request #419 from bubnikv/MK3_debug

Support for debug builds:
This commit is contained in:
PavelSindler 2018-01-22 18:58:02 +01:00 committed by GitHub
commit bde1996250
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 51 deletions

View file

@ -2,7 +2,6 @@
#define CONFIGURATION_H #define CONFIGURATION_H
#include "boards.h" #include "boards.h"
#include "Configuration_prusa.h"
#define STR_HELPER(x) #x #define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x) #define STR(x) STR_HELPER(x)
@ -10,15 +9,38 @@
// Firmware version // Firmware version
#define FW_VERSION "3.1.1-RC5" #define FW_VERSION "3.1.1-RC5"
#define FW_COMMIT_NR 150 #define FW_COMMIT_NR 150
#define FW_DEV_VERSION FW_VERSION_RC // 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_FULL FW_VERSION "-" STR(FW_COMMIT_NR)
#define FW_VERSION_DEBUG 5 // Debug version has debugging enabled (the symbol DEBUG_BUILD is set).
#define FW_VERSION_UNKNOWN 4 // The debug build may be a bit slower than the non-debug build, therefore the debug build should
#define FW_VERSION_ALPHA 3 // not be shipped to a customer.
#define FW_VERSION_BETA 2 #define FW_VERSION_DEBUG 6
#define FW_VERSION_RC 1 // This is a development build. A development build is either built from an unofficial git repository,
#define FW_VERSION_GOLD 0 // 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
#else
#undef DEBUG_BUILD
#endif
#include "Configuration_prusa.h"
#define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC "PRUSA3DFW"
#define FW_PRUSA3D_MAGIC_LEN 10 #define FW_PRUSA3D_MAGIC_LEN 10

View file

@ -105,10 +105,9 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define MINTEMP_MINAMBIENT_RAW 978 #define MINTEMP_MINAMBIENT_RAW 978
//DEBUG #ifdef DEBUG_BUILD
//#define _NO_ASM //#define _NO_ASM
#define DEBUG_DCODES //D codes #define DEBUG_DCODES //D codes
#if 1
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR #define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial //#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD //#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_FANCHECK //disable fan check (no ISR INT7, check disabled)
//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor 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_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. #define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message.
#endif #define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display.
#endif /* DEBUG_BUILD */
/*------------------------------------ /*------------------------------------

View file

@ -889,10 +889,22 @@ void factory_reset()
void show_fw_version_warnings() { void show_fw_version_warnings() {
if (FW_DEV_VERSION == FW_VERSION_GOLD || FW_DEV_VERSION == FW_VERSION_RC) return; if (FW_DEV_VERSION == FW_VERSION_GOLD || FW_DEV_VERSION == FW_VERSION_RC) return;
switch (FW_DEV_VERSION) { switch (FW_DEV_VERSION) {
case(FW_VERSION_ALPHA): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_ALPHA); break; 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_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_DEVEL):
case(FW_VERSION_DEBUG): lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_DEBUG); break; 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();
break;
default: lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_UNKNOWN); break; default: lcd_show_fullscreen_message_and_wait_P(MSG_FW_VERSION_UNKNOWN); break;
} }
lcd_update_enable(true); lcd_update_enable(true);

View file

@ -845,13 +845,6 @@ const char * const MSG_FW_VERSION_BETA_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_FW_VERSION_BETA_CZ 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_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 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 = { 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 MSG_FW_VERSION_RC_CZ
}; };
const char MSG_FW_VERSION_UNKNOWN_EN[] PROGMEM = "WARNING: Unknown firmware version"; 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 verze firmware"; 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 = { const char * const MSG_FW_VERSION_UNKNOWN_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_FW_VERSION_UNKNOWN_EN, MSG_FW_VERSION_UNKNOWN_EN,
MSG_FW_VERSION_UNKNOWN_CZ MSG_FW_VERSION_UNKNOWN_CZ

View file

@ -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) #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]; 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) #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]; 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) #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]; extern const char* const MSG_FW_VERSION_UNKNOWN_LANG_TABLE[LANG_NUM];

View file

@ -401,8 +401,7 @@
#define MSG_FSENS_NOT_RESPONDING "CHYBA: Filament senzor nereaguje, zkontrolujte zapojeni." #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_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_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_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."

View file

@ -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_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=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_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_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_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."

View file

@ -1563,6 +1563,7 @@ static void lcd_menu_fails_stats()
} }
#ifdef DEBUG_BUILD
extern uint16_t SP_min; extern uint16_t SP_min;
extern char* __malloc_heap_start; extern char* __malloc_heap_start;
extern char* __malloc_heap_end; extern char* __malloc_heap_end;
@ -1577,6 +1578,7 @@ static void lcd_menu_debug()
lcd_return_to_status(); lcd_return_to_status();
} }
} }
#endif /* DEBUG_BUILD */
static void lcd_menu_temperatures() static void lcd_menu_temperatures()
{ {
@ -1675,6 +1677,9 @@ static void lcd_support_menu()
MENU_ITEM(back, PSTR("Firmware:"), lcd_main_menu); MENU_ITEM(back, PSTR("Firmware:"), lcd_main_menu);
MENU_ITEM(back, PSTR(" " FW_VERSION_FULL), 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. // Ideally this block would be optimized out by the compiler.
/* const uint8_t fw_string_len = strlen_P(FW_VERSION_STR_P()); /* const uint8_t fw_string_len = strlen_P(FW_VERSION_STR_P());
if (fw_string_len < 6) { if (fw_string_len < 6) {
@ -1710,8 +1715,11 @@ static void lcd_support_menu()
MENU_ITEM(submenu, MSG_MENU_TEMPERATURES, lcd_menu_temperatures); MENU_ITEM(submenu, MSG_MENU_TEMPERATURES, lcd_menu_temperatures);
MENU_ITEM(submenu, MSG_MENU_VOLTAGES, lcd_menu_voltages); MENU_ITEM(submenu, MSG_MENU_VOLTAGES, lcd_menu_voltages);
#ifdef DEBUG_BUILD
MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug); MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug);
#endif /* DEBUG_BUILD */
#endif //MK1BP #endif //MK1BP
END_MENU(); END_MENU();
} }

View file

@ -729,20 +729,7 @@ static void lcd_implementation_status_screen()
lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
lcd_printPGM(PSTR(" ")); lcd_printPGM(PSTR(" "));
#if 1 #ifdef 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("% "));
//lcd.setCursor(8, 0);
//lcd.print(itostr3(fan_speed[0]));
//lcd.setCursor(8, 1);
//lcd.print(itostr3(fan_speed[1]));
#else
//Print Feedrate //Print Feedrate
lcd.setCursor(LCD_WIDTH - 8-2, 1); lcd.setCursor(LCD_WIDTH - 8-2, 1);
lcd.print(LCD_STR_FEEDRATE[0]); lcd.print(LCD_STR_FEEDRATE[0]);
@ -751,15 +738,23 @@ static void lcd_implementation_status_screen()
{ {
uint8_t queue = planner_queue_min(); uint8_t queue = planner_queue_min();
if (queue < (BLOCK_BUFFER_SIZE >> 1)) { if (queue < (BLOCK_BUFFER_SIZE >> 1)) {
lcd.print('!'); lcd.write('!');
} else { } else {
lcd.print((char)(queue / 10) + '0'); lcd.write((char)(queue / 10) + '0');
queue %= 10; queue %= 10;
} }
lcd.print((char)queue + '0'); lcd.write((char)queue + '0');
planner_queue_min_reset(); 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; bool print_sd_status = true;
#ifdef PINDA_THERMISTOR #ifdef PINDA_THERMISTOR
@ -872,7 +867,12 @@ if (print_sd_status)
} }
// If printing from SD, show what we are printing // 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) if(strlen(card.longFilename) > LCD_WIDTH)
{ {