Firmware2/Marlin/src/lcd/menu/menu_info.cpp

307 lines
11 KiB
C++
Raw Normal View History

2018-10-28 01:52:20 +02:00
/**
* Marlin 3D Printer Firmware
2020-02-03 15:00:57 +01:00
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
2018-10-28 01:52:20 +02:00
*
* Based on Sprinter and grbl.
2019-06-28 06:57:50 +02:00
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
2018-10-28 01:52:20 +02:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2020-07-23 05:20:14 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-10-28 01:52:20 +02:00
*
*/
//
// Info Menu
//
#include "../../inc/MarlinConfigPre.h"
2020-04-24 04:42:38 +02:00
#if BOTH(HAS_LCD_MENU, LCD_INFO_MENU)
2018-10-28 01:52:20 +02:00
2020-08-21 12:21:34 +02:00
#include "menu_item.h"
2019-06-15 23:57:20 +02:00
#if HAS_GAMES
#include "game/game.h"
#endif
2020-09-12 02:53:06 +02:00
#define VALUE_ITEM(MSG, VALUE, STYL) do{ char msg[21]; strcpy_P(msg, PSTR(": ")); strcpy(msg + 2, VALUE); STATIC_ITEM(MSG, STYL, msg); }while(0)
#define VALUE_ITEM_P(MSG, PVALUE, STYL) do{ char msg[21]; strcpy_P(msg, PSTR(": ")); strcpy_P(msg + 2, PSTR(PVALUE)); STATIC_ITEM(MSG, STYL, msg); }while(0)
2018-10-28 01:52:20 +02:00
#if ENABLED(PRINTCOUNTER)
#include "../../module/printcounter.h"
//
// About Printer > Printer Stats
//
void menu_info_stats() {
if (ui.use_click()) return ui.go_back();
2018-10-28 01:52:20 +02:00
printStatistics stats = print_job_timer.getStats();
2020-04-28 04:03:55 +02:00
char buffer[21];
2020-04-26 00:53:06 +02:00
START_SCREEN(); // 12345678901234567890
2020-09-12 02:53:06 +02:00
VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT); // Print Count: 999
VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT); // Completed : 666
2018-10-28 01:52:20 +02:00
2020-04-26 00:53:06 +02:00
STATIC_ITEM(MSG_INFO_PRINT_TIME, SS_LEFT); // Total print Time:
2020-08-23 07:12:03 +02:00
STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.printTime).toString(buffer)); // > 99y 364d 23h 59m 59s
2018-10-28 01:52:20 +02:00
2020-04-26 00:53:06 +02:00
STATIC_ITEM(MSG_INFO_PRINT_LONGEST, SS_LEFT); // Longest job time:
2020-08-23 07:12:03 +02:00
STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s
2018-10-28 01:52:20 +02:00
2020-04-26 00:53:06 +02:00
STATIC_ITEM(MSG_INFO_PRINT_FILAMENT, SS_LEFT); // Extruded total:
sprintf_P(buffer, PSTR("%ld.%im")
, long(stats.filamentUsed / 1000)
, int16_t(stats.filamentUsed / 100) % 10
);
STATIC_ITEM_P(PSTR("> "), SS_LEFT, buffer); // > 125m
2019-10-10 02:46:10 +02:00
#if SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0
strcpy_P(buffer, GET_TEXT(MSG_SERVICE_IN));
#endif
2019-02-12 22:58:56 +01:00
#if SERVICE_INTERVAL_1 > 0
2020-08-23 07:12:03 +02:00
STATIC_ITEM_P(PSTR(SERVICE_NAME_1 " "), SS_LEFT, buffer); // Service X in:
STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.nextService1).toString(buffer)); // > 7d 12h 11m 10s
2019-02-12 22:58:56 +01:00
#endif
2019-02-12 22:58:56 +01:00
#if SERVICE_INTERVAL_2 > 0
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR(SERVICE_NAME_2 " "), SS_LEFT, buffer);
STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.nextService2).toString(buffer));
2019-02-12 22:58:56 +01:00
#endif
2019-02-12 22:58:56 +01:00
#if SERVICE_INTERVAL_3 > 0
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR(SERVICE_NAME_3 " "), SS_LEFT, buffer);
STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.nextService3).toString(buffer));
2019-02-12 22:58:56 +01:00
#endif
2018-10-28 01:52:20 +02:00
END_SCREEN();
}
#endif
//
// About Printer > Thermistors
//
void menu_info_thermistors() {
if (ui.use_click()) return ui.go_back();
2018-10-28 01:52:20 +02:00
START_SCREEN();
#if EXTRUDERS
#define THERMISTOR_ID TEMP_SENSOR_0
#include "../thermistornames.h"
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR(LCD_STR_E0 ": " THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_0_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_0_MAXTEMP), SS_LEFT);
#endif
2018-10-28 01:52:20 +02:00
#if TEMP_SENSOR_1 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_1
#include "../thermistornames.h"
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR(LCD_STR_E1 ": " THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_1_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_1_MAXTEMP), SS_LEFT);
2018-10-28 01:52:20 +02:00
#endif
#if TEMP_SENSOR_2 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_2
#include "../thermistornames.h"
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR(LCD_STR_E2 ": " THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_2_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_2_MAXTEMP), SS_LEFT);
2018-10-28 01:52:20 +02:00
#endif
#if TEMP_SENSOR_3 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_3
#include "../thermistornames.h"
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR(LCD_STR_E3 ": " THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_3_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_3_MAXTEMP), SS_LEFT);
2018-10-28 01:52:20 +02:00
#endif
#if TEMP_SENSOR_4 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_4
#include "../thermistornames.h"
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR(LCD_STR_E4 ": " THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_4_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_4_MAXTEMP), SS_LEFT);
2018-10-28 01:52:20 +02:00
#endif
2019-03-07 08:00:44 +01:00
#if TEMP_SENSOR_5 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_5
#include "../thermistornames.h"
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR(LCD_STR_E5 ": " THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_5_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_5_MAXTEMP), SS_LEFT);
2019-03-07 08:00:44 +01:00
#endif
#if TEMP_SENSOR_6 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_6
#include "../thermistornames.h"
STATIC_ITEM_P(PSTR(LCD_STR_E6 ": " THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_6_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_6_MAXTEMP), SS_LEFT);
#endif
#if TEMP_SENSOR_7 != 0
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_7
#include "../thermistornames.h"
STATIC_ITEM_P(PSTR(LCD_STR_E7 ": " THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_7_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_7_MAXTEMP), SS_LEFT);
#endif
#if EXTRUDERS
2020-04-26 00:53:06 +02:00
STATIC_ITEM(TERN(WATCH_HOTENDS, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
#endif
2018-10-28 01:52:20 +02:00
#if HAS_HEATED_BED
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_BED
#include "../thermistornames.h"
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR("BED:" THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_LEFT);
2020-04-26 00:53:06 +02:00
STATIC_ITEM(TERN(WATCH_BED, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
2018-10-28 01:52:20 +02:00
#endif
#if HAS_HEATED_CHAMBER
#undef THERMISTOR_ID
#define THERMISTOR_ID TEMP_SENSOR_CHAMBER
#include "../thermistornames.h"
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR("CHAM:" THERMISTOR_NAME), SS_INVERT);
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_LEFT);
PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_LEFT);
2020-04-26 00:53:06 +02:00
STATIC_ITEM(TERN(WATCH_CHAMBER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT);
#endif
2018-10-28 01:52:20 +02:00
END_SCREEN();
}
//
// About Printer > Board Info
//
void menu_info_board() {
if (ui.use_click()) return ui.go_back();
2018-10-28 01:52:20 +02:00
START_SCREEN();
2020-08-09 01:21:44 +02:00
STATIC_ITEM_P(PSTR(BOARD_INFO_NAME), SS_DEFAULT|SS_INVERT); // MyPrinterController
2019-08-26 01:57:32 +02:00
#ifdef BOARD_WEBSITE_URL
2019-10-10 02:46:10 +02:00
STATIC_ITEM_P(PSTR(BOARD_WEBSITE_URL), SS_LEFT); // www.my3dprinter.com
2019-08-26 01:57:32 +02:00
#endif
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_BAUDRATE, STRINGIFY(BAUDRATE), SS_CENTER); // Baud: 250000
PSTRING_ITEM(MSG_INFO_PROTOCOL, PROTOCOL_VERSION, SS_CENTER); // Protocol: 1.0
PSTRING_ITEM(MSG_INFO_PSU, PSU_NAME, SS_CENTER);
2018-10-28 01:52:20 +02:00
END_SCREEN();
}
//
// About Printer > Printer Info
//
2019-08-26 02:05:03 +02:00
#if ENABLED(LCD_PRINTER_INFO_IS_BOOTSCREEN)
void menu_show_marlin_bootscreen() {
if (ui.use_click()) { ui.goto_previous_screen_no_defer(); }
ui.draw_marlin_bootscreen();
}
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
void menu_show_custom_bootscreen() {
if (ui.use_click()) { ui.goto_screen(menu_show_marlin_bootscreen); }
ui.draw_custom_bootscreen();
}
#endif
#else
void menu_info_printer() {
if (ui.use_click()) return ui.go_back();
START_SCREEN();
2020-08-09 01:21:44 +02:00
STATIC_ITEM(MSG_MARLIN, SS_DEFAULT|SS_INVERT); // Marlin
2019-10-10 02:46:10 +02:00
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(PSTR(MACHINE_NAME)); // My3DPrinter
STATIC_ITEM_P(PSTR(WEBSITE_URL)); // www.my3dprinter.com
2020-08-23 07:12:03 +02:00
PSTRING_ITEM(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2
#if HAS_LEVELING
STATIC_ITEM(
TERN_(AUTO_BED_LEVELING_3POINT, MSG_3POINT_LEVELING) // 3-Point Leveling
TERN_(AUTO_BED_LEVELING_LINEAR, MSG_LINEAR_LEVELING) // Linear Leveling
TERN_(AUTO_BED_LEVELING_BILINEAR, MSG_BILINEAR_LEVELING) // Bi-linear Leveling
TERN_(AUTO_BED_LEVELING_UBL, MSG_UBL_LEVELING) // Unified Bed Leveling
TERN_(MESH_BED_LEVELING, MSG_MESH_LEVELING) // Mesh Leveling
);
#endif
END_SCREEN();
}
2019-08-26 02:05:03 +02:00
#endif
2018-10-28 01:52:20 +02:00
//
// "About Printer" submenu
//
void menu_info() {
START_MENU();
2019-10-03 12:38:30 +02:00
BACK_ITEM(MSG_MAIN);
#if ENABLED(LCD_PRINTER_INFO_IS_BOOTSCREEN)
2020-04-26 00:53:06 +02:00
SUBMENU(MSG_INFO_PRINTER_MENU, TERN(SHOW_CUSTOM_BOOTSCREEN, menu_show_custom_bootscreen, menu_show_marlin_bootscreen));
#else
2019-10-03 12:38:30 +02:00
SUBMENU(MSG_INFO_PRINTER_MENU, menu_info_printer); // Printer Info >
SUBMENU(MSG_INFO_BOARD_MENU, menu_info_board); // Board Info >
#if EXTRUDERS
2019-10-03 12:38:30 +02:00
SUBMENU(MSG_INFO_THERMISTOR_MENU, menu_info_thermistors); // Thermistors >
#endif
#endif
2018-10-28 01:52:20 +02:00
#if ENABLED(PRINTCOUNTER)
2019-10-03 12:38:30 +02:00
SUBMENU(MSG_INFO_STATS_MENU, menu_info_stats); // Printer Stats >
2018-10-28 01:52:20 +02:00
#endif
2019-06-15 23:57:20 +02:00
#if HAS_GAMES
2020-04-28 06:52:11 +02:00
{
#if ENABLED(GAMES_EASTER_EGG)
2020-04-28 06:52:11 +02:00
SKIP_ITEM(); SKIP_ITEM(); SKIP_ITEM();
#endif
2020-04-28 06:52:11 +02:00
2019-12-31 23:06:16 +01:00
// Game sub-menu or the individual game
2020-04-28 06:52:11 +02:00
SUBMENU(
#if HAS_GAME_MENU
MSG_GAMES, menu_game
#elif ENABLED(MARLIN_BRICKOUT)
MSG_BRICKOUT, brickout.enter_game
#elif ENABLED(MARLIN_INVADERS)
MSG_INVADERS, invaders.enter_game
#elif ENABLED(MARLIN_SNAKE)
MSG_SNAKE, snake.enter_game
#elif ENABLED(MARLIN_MAZE)
MSG_MAZE, maze.enter_game
#endif
);
}
2019-06-15 23:57:20 +02:00
#endif
2018-10-28 01:52:20 +02:00
END_MENU();
}
#endif // HAS_LCD_MENU && LCD_INFO_MENU