Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add author to M115, combine strings #19326

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions Marlin/src/MarlinCore.cpp
Expand Up @@ -233,6 +233,14 @@ PGMSTR(X_LBL, "X:"); PGMSTR(Y_LBL, "Y:"); PGMSTR(Z_LBL, "Z:"); PGMST
PGMSTR(SP_A_STR, " A"); PGMSTR(SP_B_STR, " B"); PGMSTR(SP_C_STR, " C");
PGMSTR(SP_X_STR, " X"); PGMSTR(SP_Y_STR, " Y"); PGMSTR(SP_Z_STR, " Z"); PGMSTR(SP_E_STR, " E");
PGMSTR(SP_X_LBL, " X:"); PGMSTR(SP_Y_LBL, " Y:"); PGMSTR(SP_Z_LBL, " Z:"); PGMSTR(SP_E_LBL, " E:");
#ifdef STRING_DISTRIBUTION_DATE
PGMSTR(string_distribution_date, STRING_DISTRIBUTION_DATE);
#endif
#ifdef STRING_CONFIG_H_AUTHOR
PGMSTR(string_config_h_author, STRING_CONFIG_H_AUTHOR);
#endif
PGMSTR(marlin_website_url, MARLIN_WEBSITE_URL);
PGMSTR(short_build_version, SHORT_BUILD_VERSION);

MarlinState marlin_state = MF_INITIALIZING;

Expand Down Expand Up @@ -975,13 +983,15 @@ void setup() {

serialprintPGM(GET_TEXT(MSG_MARLIN));
SERIAL_CHAR(' ');
SERIAL_ECHOLNPGM(SHORT_BUILD_VERSION);
serialprintPGM(short_build_version);
SERIAL_EOL();
SERIAL_EOL();
#if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR)
SERIAL_ECHO_MSG(
" Last Updated: " STRING_DISTRIBUTION_DATE
" | Author: " STRING_CONFIG_H_AUTHOR
);
SERIAL_ECHOPGM(" Last Updated: ");
serialprintPGM(string_distribution_date);
SERIAL_ECHOPGM(" | Author: ");
serialprintPGM(string_config_h_author);
SERIAL_EOL();
#endif
SERIAL_ECHO_MSG("Compiled: " __DATE__);
SERIAL_ECHO_MSG(STR_FREE_MEMORY, freeMemory(), STR_PLANNER_BUFFER_BYTES, (int)sizeof(block_t) * (BLOCK_BUFFER_SIZE));
Expand Down
9 changes: 8 additions & 1 deletion Marlin/src/MarlinCore.h
Expand Up @@ -122,4 +122,11 @@ void protected_pin_err();
extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
SP_A_STR[], SP_B_STR[], SP_C_STR[],
SP_P_STR[], SP_T_STR[], SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[],
X_LBL[], Y_LBL[], Z_LBL[], E_LBL[], SP_X_LBL[], SP_Y_LBL[], SP_Z_LBL[], SP_E_LBL[];
X_LBL[], Y_LBL[], Z_LBL[], E_LBL[], SP_X_LBL[], SP_Y_LBL[], SP_Z_LBL[], SP_E_LBL[],
#ifdef STRING_DISTRIBUTION_DATE
string_distribution_date[],
#endif
#ifdef STRING_CONFIG_H_AUTHOR
string_config_h_author[],
#endif
marlin_website_url[], short_build_version[];
9 changes: 8 additions & 1 deletion Marlin/src/gcode/host/M115.cpp
Expand Up @@ -36,13 +36,15 @@
}
#endif

extern const char string_config_h_author[];

/**
* M115: Capabilities string and extended capabilities report
* If a capability is not reported, hosts should assume
* the capability is not present.
*/
void GcodeSuite::M115() {
SERIAL_ECHOLNPGM(
SERIAL_ECHOPGM(
"FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " (" __DATE__ " " __TIME__ ") "
"SOURCE_CODE_URL:" SOURCE_CODE_URL " "
"PROTOCOL_VERSION:" PROTOCOL_VERSION " "
Expand All @@ -52,6 +54,11 @@ void GcodeSuite::M115() {
"UUID:" MACHINE_UUID
#endif
);
#ifdef STRING_CONFIG_H_AUTHOR
SERIAL_ECHOPGM("CONFIG_BY:");
serialprintPGM(string_config_h_author);
#endif
SERIAL_EOL();

#if ENABLED(EXTENDED_CAPABILITIES_REPORT)

Expand Down
44 changes: 24 additions & 20 deletions Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
Expand Up @@ -432,38 +432,42 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
}
}

static void logo_lines(PGM_P const extra) {
int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
lcd_put_u8str_P(indent, 1, PSTR("|Marlin|")); lcd_put_u8str_P(extra);
lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
}
extern const char short_build_version[];

void MarlinUI::show_bootscreen() {
set_custom_characters(CHARSET_BOOT);
lcd.clear();

#define LCD_EXTRA_SPACE (LCD_WIDTH-8)

#define CENTER_OR_SCROLL(STRING,DELAY) \
lcd_erase_line(3); \
if (utf8_strlen(STRING) <= LCD_WIDTH) { \
lcd_put_u8str_P((LCD_WIDTH - utf8_strlen_P(PSTR(STRING))) / 2, 3, PSTR(STRING)); \
safe_delay(DELAY); \
} \
else { \
lcd_scroll(0, 3, PSTR(STRING), LCD_WIDTH, DELAY); \
auto logo_lines = [](PGM_P const extra) {
int16_t indent = (LCD_WIDTH - 8 - (utf8_strlen_P(extra) + 1)) / 2;
lcd_put_wchar(indent, 0, '\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
lcd_put_u8str_P(indent, 1, PSTR("|Marlin|")); lcd_put_wchar(' '); lcd_put_u8str_P(extra);
lcd_put_wchar(indent, 2, '\x02'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x03');
};

auto center_or_scroll = [](PGM_P const pstr, const uint16_t delay) {
lcd_erase_line(3);
const size_t len = utf8_strlen_P(pstr);
if (len <= LCD_WIDTH) {
lcd_put_u8str_P((LCD_WIDTH - len) / 2, 3, pstr);
safe_delay(delay);
}
else {
lcd_scroll(0, 3, pstr, LCD_WIDTH, delay);
}
};

//
// Show the Marlin logo with splash line 1
//
if (LCD_EXTRA_SPACE >= utf8_strlen(SHORT_BUILD_VERSION) + 1) {
if (LCD_EXTRA_SPACE > utf8_strlen_P(short_build_version)) {
//
// Show the Marlin logo, splash line1, and splash line 2
//
logo_lines(PSTR(" " SHORT_BUILD_VERSION));
CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 2000);
logo_lines(short_build_version);
center_or_scroll(marlin_website_url, 2000);
}
else {
//
Expand All @@ -472,10 +476,10 @@ void MarlinUI::clear_lcd() { lcd.clear(); }
//
extern const char NUL_STR[];
logo_lines(NUL_STR);
CENTER_OR_SCROLL(SHORT_BUILD_VERSION, 1500);
CENTER_OR_SCROLL(MARLIN_WEBSITE_URL, 1500);
center_or_scroll(short_build_version, 1500);
center_or_scroll(marlin_website_url, 1500);
#ifdef STRING_SPLASH_LINE3
CENTER_OR_SCROLL(STRING_SPLASH_LINE3, 1500);
center_or_scroll(PSTR(STRING_SPLASH_LINE3), 1500);
#endif
}

Expand Down
6 changes: 4 additions & 2 deletions Marlin/src/lcd/dogm/ultralcd_DOGM.cpp
Expand Up @@ -163,6 +163,8 @@ bool MarlinUI::detected() { return true; }
// Two-part needed to display all info
constexpr bool two_part = ((LCD_PIXEL_HEIGHT) - (START_BMPHEIGHT)) < ((MENU_FONT_ASCENT) * 2);

extern const char short_build_version[], marlin_website_url[];

// Draw the static Marlin bootscreen from a u8g loop
// or the animated boot screen within its own u8g loop
void MarlinUI::draw_marlin_bootscreen(const bool line2/*=false*/) {
Expand Down Expand Up @@ -199,8 +201,8 @@ bool MarlinUI::detected() { return true; }
auto _draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
u8g.drawBitmapP(offx, offy, START_BMP_BYTEWIDTH, START_BMPHEIGHT, bitmap);
set_font(FONT_MENU);
if (!two_part || !line2) lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), PSTR(SHORT_BUILD_VERSION));
if (!two_part || line2) lcd_put_u8str_P(txt_offx_2, txt_base, PSTR(MARLIN_WEBSITE_URL));
if (!two_part || !line2) lcd_put_u8str_P(txt_offx_1, txt_base - (MENU_FONT_HEIGHT), short_build_version);
if (!two_part || line2) lcd_put_u8str_P(txt_offx_2, txt_base, marlin_website_url);
};

auto draw_bootscreen_bmp = [&](const uint8_t *bitmap) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/dwin/e3v2/dwin.cpp
Expand Up @@ -1737,7 +1737,7 @@ inline void Draw_Info_Menu() {
Clear_Main_Window();

DWIN_Draw_String(false, false, font8x16, White, Background_black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, (char*)MACHINE_SIZE);
DWIN_Draw_String(false, false, font8x16, White, Background_black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, (char*)SHORT_BUILD_VERSION);
DWIN_Draw_String(false, false, font8x16, White, Background_black, (DWIN_WIDTH - strlen_P(short_build_version) * MENU_CHR_W) / 2, 195, (const __FlashStringHelper *)short_build_version);

if (HMI_flag.language_chinese) {
DWIN_Frame_AreaCopy(1, 30, 17, 271 - 214, 479 - 450, 14, 8);
Expand Down
9 changes: 5 additions & 4 deletions Marlin/src/lcd/extui/anycubic_chiron_lcd.cpp
Expand Up @@ -48,6 +48,8 @@
#error ANYCUBIC CHIRON LCD does not currently support POWER_LOSS_RECOVERY
#endif

extern const char short_build_version[];

static bool is_auto_leveling = false;
static bool is_printing_from_sd = false;
static bool is_out_of_filament = false;
Expand Down Expand Up @@ -143,9 +145,7 @@ namespace ExtUI {
static char selectedFileShortName[8+1+3+1];

if (rx[0] != 'A') {
SERIAL_ECHOPGM("Unexpected RX: ");
SERIAL_ECHOLN(rx);

SERIAL_ECHOLNPAIR("Unexpected RX: ", rx);
return;
}

Expand Down Expand Up @@ -397,7 +397,8 @@ namespace ExtUI {
//case 32: // ?
// break;
case 33: // Get Version Info
SENDLINE_PGM("J33 " SHORT_BUILD_VERSION);
SEND_PGM("J33 ");
sendLine_P(short_build_version);
break;
case 34: // Set Bed Autolevel Grid
{
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/lib/dgus/fysetc/DGUSDisplayDef.cpp
Expand Up @@ -314,7 +314,7 @@ const struct VPMapping VPMap[] PROGMEM = {
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
};

const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
extern const char short_build_version[];

// Helper to define a DGUS_VP_Variable for common use cases.
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=sizeof(VPADRVAR), \
Expand Down Expand Up @@ -361,7 +361,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, &ScreenHandler.HandleFirstLayerCal, nullptr),
#endif

{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)short_build_version, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplay },

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/lib/dgus/hiprecy/DGUSDisplayDef.cpp
Expand Up @@ -317,7 +317,7 @@ const struct VPMapping VPMap[] PROGMEM = {
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
};

const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
extern const char short_build_version[];

// Helper to define a DGUS_VP_Variable for common use cases.
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=sizeof(VPADRVAR), \
Expand Down Expand Up @@ -364,7 +364,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
VPHELPER(VP_Z_FIRST_LAYER_CAL, nullptr, &ScreenHandler.HandleFirstLayerCal, nullptr),
#endif

{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)short_build_version, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplay },

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/lib/dgus/origin/DGUSDisplayDef.cpp
Expand Up @@ -144,7 +144,7 @@ const struct VPMapping VPMap[] PROGMEM = {
{ 0 , nullptr } // List is terminated with an nullptr as table entry.
};

const char MarlinVersion[] PROGMEM = SHORT_BUILD_VERSION;
extern const char short_build_version[];

// Helper to define a DGUS_VP_Variable for common use cases.
#define VPHELPER(VPADR, VPADRVAR, RXFPTR, TXFPTR ) { .VP=VPADR, .memadr=VPADRVAR, .size=sizeof(VPADRVAR), \
Expand Down Expand Up @@ -186,7 +186,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#endif
VPHELPER(VP_SETTINGS, nullptr, &ScreenHandler.HandleSettings, nullptr),

{ .VP = VP_MARLIN_VERSION, .memadr = (void*)MarlinVersion, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
{ .VP = VP_MARLIN_VERSION, .memadr = (void*)short_build_version, .size = VP_MARLIN_VERSION_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplayPGM },
// M117 LCD String (We don't need the string in memory but "just" push it to the display on demand, hence the nullptr
{ .VP = VP_M117, .memadr = nullptr, .size = VP_M117_LEN, .set_by_display_handler = nullptr, .send_to_display_handler =&ScreenHandler.DGUSLCD_SendStringToDisplay },

Expand Down
6 changes: 4 additions & 2 deletions Marlin/src/lcd/menu/menu_info.cpp
Expand Up @@ -234,12 +234,14 @@ void menu_info_board() {

#else

extern const char short_build_version[], string_distribution_date[];

void menu_info_printer() {
if (ui.use_click()) return ui.go_back();
START_SCREEN();
STATIC_ITEM(MSG_MARLIN, SS_DEFAULT|SS_INVERT); // Marlin
STATIC_ITEM_P(PSTR(SHORT_BUILD_VERSION)); // x.x.x-Branch
STATIC_ITEM_P(PSTR(STRING_DISTRIBUTION_DATE)); // YYYY-MM-DD HH:MM
STATIC_ITEM_P(short_build_version); // x.x.x-Branch
STATIC_ITEM_P(string_distribution_date); // YYYY-MM-DD HH:MM
STATIC_ITEM_P(PSTR(MACHINE_NAME)); // My3DPrinter
STATIC_ITEM_P(PSTR(WEBSITE_URL)); // www.my3dprinter.com
PSTRING_ITEM(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2
Expand Down
4 changes: 1 addition & 3 deletions Marlin/src/pins/stm32f4/pins_STEVAL_3DP001V1.h
Expand Up @@ -44,9 +44,7 @@
#error "Oops! Select an STM32F4 board in 'Tools > Board.'"
#endif

#ifndef MACHINE_NAME
#define MACHINE_NAME "STEVAL-3DP001V1"
#endif
#define DEFAULT_MACHINE_NAME "STEVAL-3DP001V1"

//
// Limit Switches
Expand Down