2018-02-14 22:43:54 +01:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 15:00:57 +01:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2018-02-14 22:43:54 +01:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 06:57:50 +02:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2018-02-14 22:43:54 +01: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-02-14 22:43:54 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-10-28 04:06:25 +01:00
|
|
|
//
|
|
|
|
// status_screen_DOGM.cpp
|
|
|
|
// Standard Status Screen for Graphical Display
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "../../inc/MarlinConfigPre.h"
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2020-09-28 08:13:27 +02:00
|
|
|
#if HAS_MARLINUI_U8GLIB && DISABLED(LIGHTWEIGHT_UI)
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2018-10-28 04:06:25 +01:00
|
|
|
#include "dogm_Statusscreen.h"
|
2020-10-17 02:36:25 +02:00
|
|
|
#include "marlinui_DOGM.h"
|
|
|
|
#include "../marlinui.h"
|
2018-10-28 04:06:25 +01:00
|
|
|
#include "../lcdprint.h"
|
2019-06-11 12:58:43 +02:00
|
|
|
#include "../../libs/numtostr.h"
|
2018-11-13 08:47:45 +01:00
|
|
|
|
2018-10-24 09:27:19 +02:00
|
|
|
#include "../../module/motion.h"
|
2018-10-28 04:06:25 +01:00
|
|
|
#include "../../module/temperature.h"
|
|
|
|
|
2020-11-24 06:02:54 +01:00
|
|
|
#include "../../gcode/parser.h" // for units (and volumetric)
|
|
|
|
|
2021-01-25 08:48:31 +01:00
|
|
|
#if ENABLED(LCD_SHOW_E_TOTAL)
|
2021-05-08 11:35:35 +02:00
|
|
|
#include "../../MarlinCore.h" // for printingIsActive()
|
2021-01-25 08:48:31 +01:00
|
|
|
#endif
|
|
|
|
|
2018-11-19 02:58:02 +01:00
|
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
|
|
|
#include "../../feature/filwidth.h"
|
|
|
|
#include "../../module/planner.h"
|
|
|
|
#endif
|
|
|
|
|
2022-01-17 06:34:50 +01:00
|
|
|
#if HAS_LEVELING
|
|
|
|
#include "../../module/planner.h"
|
|
|
|
#endif
|
|
|
|
|
2019-12-02 04:20:15 +01:00
|
|
|
#if HAS_CUTTER
|
|
|
|
#include "../../feature/spindle_laser.h"
|
|
|
|
#endif
|
|
|
|
|
2021-04-02 02:29:49 +02:00
|
|
|
#if EITHER(HAS_COOLER, LASER_COOLANT_FLOW_METER)
|
2021-03-29 08:41:56 +02:00
|
|
|
#include "../../feature/cooler.h"
|
|
|
|
#endif
|
|
|
|
|
2022-01-12 16:47:22 +01:00
|
|
|
#if DO_DRAW_AMMETER
|
2021-07-19 03:11:24 +02:00
|
|
|
#include "../../feature/ammeter.h"
|
|
|
|
#endif
|
|
|
|
|
2020-06-18 22:23:03 +02:00
|
|
|
#if HAS_POWER_MONITOR
|
|
|
|
#include "../../feature/power_monitor.h"
|
|
|
|
#endif
|
|
|
|
|
2018-10-28 04:06:25 +01:00
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
#include "../../sd/cardreader.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_PRINT_PROGRESS
|
|
|
|
#include "../../module/printcounter.h"
|
|
|
|
#endif
|
2018-10-24 09:27:19 +02:00
|
|
|
|
2020-04-22 23:35:03 +02:00
|
|
|
#if HAS_DUAL_MIXING
|
2019-02-10 11:54:23 +01:00
|
|
|
#include "../../feature/mixing.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define X_LABEL_POS 3
|
|
|
|
#define X_VALUE_POS 11
|
|
|
|
#define XYZ_SPACING 37
|
2020-11-24 06:02:54 +01:00
|
|
|
|
|
|
|
#define X_LABEL_POS_IN (X_LABEL_POS - 2)
|
|
|
|
#define X_VALUE_POS_IN (X_VALUE_POS - 5)
|
|
|
|
#define XYZ_SPACING_IN (XYZ_SPACING + 9)
|
|
|
|
|
2018-11-29 02:46:13 +01:00
|
|
|
#define XYZ_BASELINE (30 + INFO_FONT_ASCENT)
|
|
|
|
#define EXTRAS_BASELINE (40 + INFO_FONT_ASCENT)
|
|
|
|
#define STATUS_BASELINE (LCD_PIXEL_HEIGHT - INFO_FONT_DESCENT)
|
|
|
|
|
2019-12-02 04:20:15 +01:00
|
|
|
#if ANIM_HBCC
|
|
|
|
enum HeatBits : uint8_t {
|
2021-03-29 08:41:56 +02:00
|
|
|
DRAWBIT_HOTEND,
|
|
|
|
DRAWBIT_BED = HOTENDS,
|
|
|
|
DRAWBIT_CHAMBER,
|
|
|
|
DRAWBIT_CUTTER
|
2019-12-02 04:20:15 +01:00
|
|
|
};
|
2021-03-29 08:41:56 +02:00
|
|
|
IF<(DRAWBIT_CUTTER > 7), uint16_t, uint8_t>::type draw_bits;
|
2018-11-28 04:15:52 +01:00
|
|
|
#endif
|
2019-10-09 04:46:23 +02:00
|
|
|
|
2018-11-28 04:15:52 +01:00
|
|
|
#if ANIM_HOTEND
|
2021-03-29 08:41:56 +02:00
|
|
|
#define HOTEND_ALT(N) TEST(draw_bits, DRAWBIT_HOTEND + N)
|
2018-11-28 04:15:52 +01:00
|
|
|
#else
|
|
|
|
#define HOTEND_ALT(N) false
|
|
|
|
#endif
|
|
|
|
#if ANIM_BED
|
2021-03-29 08:41:56 +02:00
|
|
|
#define BED_ALT() TEST(draw_bits, DRAWBIT_BED)
|
2018-11-20 14:36:37 +01:00
|
|
|
#else
|
2018-11-28 04:15:52 +01:00
|
|
|
#define BED_ALT() false
|
2018-02-14 22:43:54 +01:00
|
|
|
#endif
|
2019-05-31 01:31:50 +02:00
|
|
|
#if ANIM_CHAMBER
|
2021-03-29 08:41:56 +02:00
|
|
|
#define CHAMBER_ALT() TEST(draw_bits, DRAWBIT_CHAMBER)
|
2019-05-31 01:31:50 +02:00
|
|
|
#else
|
|
|
|
#define CHAMBER_ALT() false
|
|
|
|
#endif
|
2019-12-02 04:20:15 +01:00
|
|
|
#if ANIM_CUTTER
|
2021-03-29 08:41:56 +02:00
|
|
|
#define CUTTER_ALT(N) TEST(draw_bits, DRAWBIT_CUTTER)
|
2019-12-02 04:20:15 +01:00
|
|
|
#else
|
|
|
|
#define CUTTER_ALT() false
|
|
|
|
#endif
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-12-02 04:20:15 +01:00
|
|
|
#if DO_DRAW_HOTENDS
|
2019-09-10 09:20:49 +02:00
|
|
|
#define MAX_HOTEND_DRAW _MIN(HOTENDS, ((LCD_PIXEL_WIDTH - (STATUS_LOGO_BYTEWIDTH + STATUS_FAN_BYTEWIDTH) * 8) / (STATUS_HEATERS_XSPACE)))
|
2020-11-06 01:15:29 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if EITHER(DO_DRAW_BED, DO_DRAW_HOTENDS)
|
2019-12-02 04:20:15 +01:00
|
|
|
#define STATUS_HEATERS_BOT (STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1)
|
2019-09-10 09:20:49 +02:00
|
|
|
#endif
|
|
|
|
|
2020-06-18 22:23:03 +02:00
|
|
|
#if HAS_POWER_MONITOR
|
|
|
|
|
|
|
|
void display_power_monitor(const uint8_t x, const uint8_t y) {
|
|
|
|
|
|
|
|
lcd_moveto(x, y);
|
|
|
|
|
2020-07-07 01:53:26 +02:00
|
|
|
#if HAS_POWER_MONITOR_WATTS
|
|
|
|
const bool wflag = power_monitor.power_display_enabled();
|
|
|
|
#endif
|
2020-06-18 22:23:03 +02:00
|
|
|
#if ENABLED(POWER_MONITOR_CURRENT)
|
|
|
|
const bool iflag = power_monitor.current_display_enabled();
|
|
|
|
#endif
|
2021-04-13 22:17:52 +02:00
|
|
|
#if ENABLED(POWER_MONITOR_VOLTAGE)
|
2020-06-18 22:23:03 +02:00
|
|
|
const bool vflag = power_monitor.voltage_display_enabled();
|
|
|
|
#endif
|
|
|
|
|
2020-07-07 01:53:26 +02:00
|
|
|
#if HAS_POWER_MONITOR_WATTS
|
|
|
|
// Cycle between current, voltage, and power
|
2020-06-18 22:23:03 +02:00
|
|
|
if (ELAPSED(millis(), power_monitor.display_item_ms)) {
|
|
|
|
power_monitor.display_item_ms = millis() + 1000UL;
|
|
|
|
++power_monitor.display_item;
|
|
|
|
}
|
2020-07-07 01:53:26 +02:00
|
|
|
#elif ENABLED(POWER_MONITOR_CURRENT)
|
|
|
|
power_monitor.display_item = 0;
|
2021-04-13 22:17:52 +02:00
|
|
|
#elif ENABLED(POWER_MONITOR_VOLTAGE)
|
2020-07-07 01:53:26 +02:00
|
|
|
power_monitor.display_item = 1;
|
2020-06-18 22:23:03 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// ensure we have the right one selected for display
|
|
|
|
for (uint8_t i = 0; i < 3; i++) {
|
|
|
|
#if ENABLED(POWER_MONITOR_CURRENT)
|
|
|
|
if (power_monitor.display_item == 0 && !iflag) ++power_monitor.display_item;
|
|
|
|
#endif
|
2021-04-13 22:17:52 +02:00
|
|
|
#if ENABLED(POWER_MONITOR_VOLTAGE)
|
2020-06-18 22:23:03 +02:00
|
|
|
if (power_monitor.display_item == 1 && !vflag) ++power_monitor.display_item;
|
|
|
|
#endif
|
2020-07-07 01:53:26 +02:00
|
|
|
#if HAS_POWER_MONITOR_WATTS
|
2020-06-18 22:23:03 +02:00
|
|
|
if (power_monitor.display_item == 2 && !wflag) ++power_monitor.display_item;
|
|
|
|
#endif
|
|
|
|
if (power_monitor.display_item >= 3) power_monitor.display_item = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (power_monitor.display_item) {
|
|
|
|
#if ENABLED(POWER_MONITOR_CURRENT) // Current
|
|
|
|
case 0: if (iflag) power_monitor.draw_current(); break;
|
|
|
|
#endif
|
2021-04-13 22:17:52 +02:00
|
|
|
#if ENABLED(POWER_MONITOR_VOLTAGE) // Voltage
|
2020-06-18 22:23:03 +02:00
|
|
|
case 1: if (vflag) power_monitor.draw_voltage(); break;
|
|
|
|
#endif
|
|
|
|
#if HAS_POWER_MONITOR_WATTS // Power
|
|
|
|
case 2: if (wflag) power_monitor.draw_power(); break;
|
|
|
|
#endif
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-10-11 04:03:33 +02:00
|
|
|
#define PROGRESS_BAR_X 54
|
2020-05-22 22:41:32 +02:00
|
|
|
#define PROGRESS_BAR_Y (EXTRAS_BASELINE + 1)
|
2019-10-11 04:03:33 +02:00
|
|
|
#define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X)
|
|
|
|
|
2021-03-24 10:11:43 +01:00
|
|
|
FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
|
2021-04-30 10:21:59 +02:00
|
|
|
if (temp < 0)
|
2021-09-26 06:52:41 +02:00
|
|
|
lcd_put_u8str(tx - 3 * (INFO_FONT_WIDTH) / 2 + 1, ty, F("err"));
|
2021-04-30 10:21:59 +02:00
|
|
|
else {
|
|
|
|
const char *str = i16tostr3rj(temp);
|
|
|
|
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
|
|
|
|
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
|
|
|
|
lcd_put_wchar(LCD_STR_DEGREE[0]);
|
|
|
|
}
|
2019-07-11 21:51:12 +02:00
|
|
|
}
|
|
|
|
|
2021-03-29 08:41:56 +02:00
|
|
|
#if DO_DRAW_FLOWMETER
|
|
|
|
FORCE_INLINE void _draw_centered_flowrate(const float flow, const uint8_t tx, const uint8_t ty) {
|
|
|
|
const char *str = ftostr11ns(flow);
|
|
|
|
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
|
|
|
|
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
|
|
|
|
lcd_put_u8str("L");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-06-07 21:15:09 +02:00
|
|
|
#if DO_DRAW_AMMETER
|
|
|
|
FORCE_INLINE void _draw_centered_current(const float current, const uint8_t tx, const uint8_t ty) {
|
2021-06-08 14:51:28 +02:00
|
|
|
const char *str = ftostr31ns(current);
|
2021-06-07 21:15:09 +02:00
|
|
|
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
|
|
|
|
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-12-02 03:06:00 +01:00
|
|
|
#if DO_DRAW_HOTENDS
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-12-02 04:20:15 +01:00
|
|
|
// Draw hotend bitmap with current and target temperatures
|
2020-09-14 01:06:14 +02:00
|
|
|
FORCE_INLINE void _draw_hotend_status(const heater_id_t heater_id, const bool blink) {
|
2019-12-02 03:06:00 +01:00
|
|
|
#if !HEATER_IDLE_HANDLER
|
|
|
|
UNUSED(blink);
|
|
|
|
#endif
|
2019-09-10 09:20:49 +02:00
|
|
|
|
2020-09-14 01:06:14 +02:00
|
|
|
const bool isHeat = HOTEND_ALT(heater_id);
|
2018-12-03 01:03:29 +01:00
|
|
|
|
2020-09-14 01:06:14 +02:00
|
|
|
const uint8_t tx = STATUS_HOTEND_TEXT_X(heater_id);
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2021-04-24 03:19:23 +02:00
|
|
|
const celsius_t temp = thermalManager.wholeDegHotend(heater_id),
|
2021-03-24 10:11:43 +01:00
|
|
|
target = thermalManager.degTargetHotend(heater_id);
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-12-02 03:06:00 +01:00
|
|
|
#if DISABLED(STATUS_HOTEND_ANIM)
|
|
|
|
#define STATIC_HOTEND true
|
|
|
|
#define HOTEND_DOT isHeat
|
|
|
|
#else
|
|
|
|
#define STATIC_HOTEND false
|
|
|
|
#define HOTEND_DOT false
|
|
|
|
#endif
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2021-06-21 22:09:21 +02:00
|
|
|
#if ENABLED(STATUS_HOTEND_NUMBERLESS)
|
|
|
|
#define OFF_BMP(N) TERN(STATUS_HOTEND_INVERTED, status_hotend_b_bmp, status_hotend_a_bmp)
|
|
|
|
#define ON_BMP(N) TERN(STATUS_HOTEND_INVERTED, status_hotend_a_bmp, status_hotend_b_bmp)
|
2019-12-02 03:06:00 +01:00
|
|
|
#else
|
2021-06-21 22:09:21 +02:00
|
|
|
#define OFF_BMP(N) TERN(STATUS_HOTEND_INVERTED, status_hotend##N##_b_bmp, status_hotend##N##_a_bmp)
|
|
|
|
#define ON_BMP(N) TERN(STATUS_HOTEND_INVERTED, status_hotend##N##_a_bmp, status_hotend##N##_b_bmp)
|
2019-12-02 03:06:00 +01:00
|
|
|
#endif
|
2018-11-20 14:36:37 +01:00
|
|
|
|
2019-12-02 03:06:00 +01:00
|
|
|
#if STATUS_HOTEND_BITMAPS > 1
|
2021-05-08 08:41:40 +02:00
|
|
|
#define _OFF_BMP(N) OFF_BMP(N),
|
|
|
|
#define _ON_BMP(N) ON_BMP(N),
|
|
|
|
static const unsigned char* const status_hotend_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = { REPEAT_1(STATUS_HOTEND_BITMAPS, _OFF_BMP) };
|
2019-12-02 03:06:00 +01:00
|
|
|
#if ANIM_HOTEND
|
2021-05-08 08:41:40 +02:00
|
|
|
static const unsigned char* const status_hotend_on_gfx[STATUS_HOTEND_BITMAPS] PROGMEM = { REPEAT_1(STATUS_HOTEND_BITMAPS, _ON_BMP) };
|
2019-12-02 03:06:00 +01:00
|
|
|
#define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr((S) ? &status_hotend_on_gfx[(N) % (STATUS_HOTEND_BITMAPS)] : &status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
|
|
|
|
#else
|
|
|
|
#define HOTEND_BITMAP(N,S) (unsigned char*)pgm_read_ptr(&status_hotend_gfx[(N) % (STATUS_HOTEND_BITMAPS)])
|
|
|
|
#endif
|
|
|
|
#elif ANIM_HOTEND
|
|
|
|
#define HOTEND_BITMAP(N,S) ((S) ? ON_BMP() : OFF_BMP())
|
2018-11-28 04:15:52 +01:00
|
|
|
#else
|
2019-12-02 03:06:00 +01:00
|
|
|
#define HOTEND_BITMAP(N,S) status_hotend_a_bmp
|
2018-11-28 04:15:52 +01:00
|
|
|
#endif
|
2018-11-20 14:36:37 +01:00
|
|
|
|
2021-07-20 21:44:15 +02:00
|
|
|
#if DISABLED(STATUS_COMBINE_HEATERS)
|
|
|
|
|
|
|
|
if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_BOT)) {
|
|
|
|
|
|
|
|
#define BAR_TALL (STATUS_HEATERS_HEIGHT - 2)
|
|
|
|
|
|
|
|
const float prop = target - 20,
|
|
|
|
perc = prop > 0 && temp >= 20 ? (temp - 20) / prop : 0;
|
|
|
|
uint8_t tall = uint8_t(perc * BAR_TALL + 0.5f);
|
|
|
|
NOMORE(tall, BAR_TALL);
|
|
|
|
|
|
|
|
// Draw hotend bitmap, either whole or split by the heating percent
|
|
|
|
const uint8_t hx = STATUS_HOTEND_X(heater_id),
|
|
|
|
bw = STATUS_HOTEND_BYTEWIDTH(heater_id);
|
|
|
|
#if ENABLED(STATUS_HEAT_PERCENT)
|
|
|
|
if (isHeat && tall <= BAR_TALL) {
|
|
|
|
const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall;
|
|
|
|
u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, ph, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), false));
|
|
|
|
u8g.drawBitmapP(hx, STATUS_HEATERS_Y + ph, bw, tall + 1, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), true) + ph * bw);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, STATUS_HEATERS_HEIGHT, HOTEND_BITMAP(TERN(HAS_MMU, active_extruder, heater_id), isHeat));
|
|
|
|
|
|
|
|
} // PAGE_CONTAINS
|
2018-11-28 04:15:52 +01:00
|
|
|
|
2021-07-20 21:44:15 +02:00
|
|
|
#endif // !STATUS_COMBINE_HEATERS
|
2019-12-02 03:06:00 +01:00
|
|
|
|
|
|
|
if (PAGE_UNDER(7)) {
|
|
|
|
#if HEATER_IDLE_HANDLER
|
2020-09-14 06:58:39 +02:00
|
|
|
const bool dodraw = (blink || !thermalManager.heater_idle[heater_id].timed_out);
|
2019-12-02 03:06:00 +01:00
|
|
|
#else
|
|
|
|
constexpr bool dodraw = true;
|
|
|
|
#endif
|
2021-03-24 10:11:43 +01:00
|
|
|
if (dodraw) _draw_centered_temp(target, tx, 7);
|
2019-12-02 03:06:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
|
2021-03-24 10:11:43 +01:00
|
|
|
_draw_centered_temp(temp, tx, 28);
|
2019-12-02 03:06:00 +01:00
|
|
|
|
|
|
|
if (STATIC_HOTEND && HOTEND_DOT && PAGE_CONTAINS(17, 19)) {
|
|
|
|
u8g.setColorIndex(0); // set to white on black
|
|
|
|
u8g.drawBox(tx, 20 - 3, 2, 2);
|
|
|
|
u8g.setColorIndex(1); // restore black on white
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-12-02 04:20:15 +01:00
|
|
|
#endif // DO_DRAW_HOTENDS
|
2019-12-02 03:06:00 +01:00
|
|
|
|
|
|
|
#if DO_DRAW_BED
|
|
|
|
|
2019-12-02 04:20:15 +01:00
|
|
|
// Draw bed bitmap with current and target temperatures
|
2019-12-02 03:06:00 +01:00
|
|
|
FORCE_INLINE void _draw_bed_status(const bool blink) {
|
|
|
|
#if !HEATER_IDLE_HANDLER
|
|
|
|
UNUSED(blink);
|
2018-11-28 04:15:52 +01:00
|
|
|
#endif
|
|
|
|
|
2019-12-02 03:06:00 +01:00
|
|
|
const uint8_t tx = STATUS_BED_TEXT_X;
|
2018-11-28 04:15:52 +01:00
|
|
|
|
2021-04-24 03:19:23 +02:00
|
|
|
const celsius_t temp = thermalManager.wholeDegBed(),
|
2021-03-24 10:11:43 +01:00
|
|
|
target = thermalManager.degTargetBed();
|
2019-12-02 03:06:00 +01:00
|
|
|
|
2020-02-26 15:09:57 +01:00
|
|
|
#if ENABLED(STATUS_HEAT_PERCENT) || DISABLED(STATUS_BED_ANIM)
|
2020-01-02 04:58:16 +01:00
|
|
|
const bool isHeat = BED_ALT();
|
|
|
|
#endif
|
|
|
|
|
2020-02-26 15:09:57 +01:00
|
|
|
#if DISABLED(STATUS_BED_ANIM)
|
2019-12-02 03:06:00 +01:00
|
|
|
#define STATIC_BED true
|
|
|
|
#define BED_DOT isHeat
|
2018-11-28 04:15:52 +01:00
|
|
|
#else
|
2019-12-02 03:06:00 +01:00
|
|
|
#define STATIC_BED false
|
|
|
|
#define BED_DOT false
|
2018-11-28 04:15:52 +01:00
|
|
|
#endif
|
|
|
|
|
2019-12-02 03:06:00 +01:00
|
|
|
if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_BOT)) {
|
2018-11-28 04:15:52 +01:00
|
|
|
|
2019-12-02 03:06:00 +01:00
|
|
|
#define BAR_TALL (STATUS_HEATERS_HEIGHT - 2)
|
2018-11-20 14:36:37 +01:00
|
|
|
|
2019-12-02 03:06:00 +01:00
|
|
|
const float prop = target - 20,
|
|
|
|
perc = prop > 0 && temp >= 20 ? (temp - 20) / prop : 0;
|
|
|
|
uint8_t tall = uint8_t(perc * BAR_TALL + 0.5f);
|
|
|
|
NOMORE(tall, BAR_TALL);
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-12-02 03:06:00 +01:00
|
|
|
// Draw a heating progress bar, if specified
|
|
|
|
#if ENABLED(STATUS_HEAT_PERCENT)
|
|
|
|
|
|
|
|
if (isHeat) {
|
|
|
|
const uint8_t bx = STATUS_BED_X + STATUS_BED_WIDTH;
|
|
|
|
u8g.drawFrame(bx, STATUS_HEATERS_Y, 3, STATUS_HEATERS_HEIGHT);
|
|
|
|
if (tall) {
|
|
|
|
const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall;
|
|
|
|
if (PAGE_OVER(STATUS_HEATERS_Y + ph))
|
|
|
|
u8g.drawVLine(bx + 1, STATUS_HEATERS_Y + ph, tall);
|
|
|
|
}
|
|
|
|
}
|
2019-07-11 21:51:12 +02:00
|
|
|
|
2019-09-08 09:20:18 +02:00
|
|
|
#endif
|
|
|
|
|
2019-12-02 03:06:00 +01:00
|
|
|
} // PAGE_CONTAINS
|
2019-09-08 09:20:18 +02:00
|
|
|
|
2019-07-11 21:51:12 +02:00
|
|
|
if (PAGE_UNDER(7)) {
|
|
|
|
#if HEATER_IDLE_HANDLER
|
2020-09-14 06:58:39 +02:00
|
|
|
const bool dodraw = (blink || !thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out);
|
2019-07-11 21:51:12 +02:00
|
|
|
#else
|
|
|
|
constexpr bool dodraw = true;
|
|
|
|
#endif
|
2021-03-24 10:11:43 +01:00
|
|
|
if (dodraw) _draw_centered_temp(target, tx, 7);
|
2019-12-02 03:06:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
|
2021-03-24 10:11:43 +01:00
|
|
|
_draw_centered_temp(temp, tx, 28);
|
2019-12-02 03:06:00 +01:00
|
|
|
|
|
|
|
if (STATIC_BED && BED_DOT && PAGE_CONTAINS(17, 19)) {
|
|
|
|
u8g.setColorIndex(0); // set to white on black
|
|
|
|
u8g.drawBox(tx, 20 - 2, 2, 2);
|
|
|
|
u8g.setColorIndex(1); // restore black on white
|
2019-07-11 21:51:12 +02:00
|
|
|
}
|
2019-12-02 03:06:00 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // DO_DRAW_BED
|
|
|
|
|
|
|
|
#if DO_DRAW_CHAMBER
|
|
|
|
FORCE_INLINE void _draw_chamber_status() {
|
|
|
|
#if HAS_HEATED_CHAMBER
|
|
|
|
if (PAGE_UNDER(7))
|
2021-03-24 10:11:43 +01:00
|
|
|
_draw_centered_temp(thermalManager.degTargetChamber(), STATUS_CHAMBER_TEXT_X, 7);
|
2019-12-02 03:06:00 +01:00
|
|
|
#endif
|
2019-07-11 21:51:12 +02:00
|
|
|
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
|
2021-04-24 03:19:23 +02:00
|
|
|
_draw_centered_temp(thermalManager.wholeDegChamber(), STATUS_CHAMBER_TEXT_X, 28);
|
2019-07-11 21:51:12 +02:00
|
|
|
}
|
2021-03-06 21:13:28 +01:00
|
|
|
#endif
|
2019-07-11 21:51:12 +02:00
|
|
|
|
2021-03-06 21:13:28 +01:00
|
|
|
#if DO_DRAW_COOLER
|
|
|
|
FORCE_INLINE void _draw_cooler_status() {
|
|
|
|
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
|
2021-04-24 03:19:23 +02:00
|
|
|
_draw_centered_temp(thermalManager.wholeDegCooler(), STATUS_COOLER_TEXT_X, 28);
|
2021-03-06 21:13:28 +01:00
|
|
|
}
|
|
|
|
#endif
|
2019-07-11 21:51:12 +02:00
|
|
|
|
2021-03-29 08:41:56 +02:00
|
|
|
#if DO_DRAW_FLOWMETER
|
|
|
|
FORCE_INLINE void _draw_flowmeter_status() {
|
|
|
|
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
|
|
|
|
_draw_centered_flowrate(cooler.flowrate, STATUS_FLOWMETER_TEXT_X, 28);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-06-07 21:15:09 +02:00
|
|
|
#if DO_DRAW_AMMETER
|
|
|
|
FORCE_INLINE void _draw_ammeter_status() {
|
|
|
|
if (PAGE_CONTAINS(28 - INFO_FONT_ASCENT, 28 - 1))
|
|
|
|
_draw_centered_current(ammeter.read(), STATUS_AMMETER_TEXT_X, 28);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-05-10 08:19:20 +02:00
|
|
|
//
|
|
|
|
// Before homing, blink '123' <-> '???'.
|
|
|
|
// Homed but unknown... '123' <-> ' '.
|
|
|
|
// Homed and known, display constantly.
|
|
|
|
//
|
|
|
|
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
|
2020-11-24 06:02:54 +01:00
|
|
|
const bool is_inch = parser.using_inch_units();
|
2020-04-10 03:58:21 +02:00
|
|
|
const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis);
|
2020-11-24 06:02:54 +01:00
|
|
|
const uint8_t offs = a * (is_inch ? XYZ_SPACING_IN : XYZ_SPACING);
|
|
|
|
lcd_put_wchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, axis_codes[axis]);
|
|
|
|
lcd_moveto((is_inch ? X_VALUE_POS_IN : X_VALUE_POS) + offs, XYZ_BASELINE);
|
|
|
|
|
2018-02-14 22:43:54 +01:00
|
|
|
if (blink)
|
2018-05-10 08:19:20 +02:00
|
|
|
lcd_put_u8str(value);
|
2020-11-30 02:06:40 +01:00
|
|
|
else if (axis_should_home(axis))
|
|
|
|
while (const char c = *value++) lcd_put_wchar(c <= '.' ? c : '?');
|
|
|
|
else if (NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) && !axis_is_trusted(axis))
|
2021-09-26 06:52:41 +02:00
|
|
|
lcd_put_u8str(axis == Z_AXIS ? F(" ") : F(" "));
|
2020-11-30 02:06:40 +01:00
|
|
|
else
|
|
|
|
lcd_put_u8str(value);
|
2018-02-14 22:43:54 +01:00
|
|
|
}
|
|
|
|
|
2020-11-24 06:02:54 +01:00
|
|
|
/**
|
|
|
|
* Draw the Status Screen for a 128x64 DOGM (U8glib) display.
|
|
|
|
*
|
|
|
|
* Called as needed to update the current display stripe.
|
|
|
|
* Use the PAGE_CONTAINS macros to avoid pointless draw calls.
|
|
|
|
*/
|
2018-11-11 19:16:24 +01:00
|
|
|
void MarlinUI::draw_status_screen() {
|
2020-11-24 06:02:54 +01:00
|
|
|
constexpr int xystorage = TERN(INCH_MODE_SUPPORT, 8, 5);
|
|
|
|
static char xstring[TERN(LCD_SHOW_E_TOTAL, 12, xystorage)], ystring[xystorage], zstring[8];
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2018-11-20 14:36:37 +01:00
|
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
|
|
|
static char wstring[5], mstring[4];
|
|
|
|
#endif
|
|
|
|
|
2019-10-11 04:03:33 +02:00
|
|
|
#if HAS_PRINT_PROGRESS
|
2021-08-17 13:18:19 +02:00
|
|
|
#if DISABLED(SHOW_SD_PERCENT)
|
2019-10-24 21:00:32 +02:00
|
|
|
#define _SD_INFO_X(len) (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH) / 2 - (len) * (MENU_FONT_WIDTH) / 2)
|
2019-10-11 04:03:33 +02:00
|
|
|
#else
|
2019-10-24 21:00:32 +02:00
|
|
|
#define _SD_INFO_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH))
|
2019-10-11 04:03:33 +02:00
|
|
|
#endif
|
|
|
|
|
2021-08-17 13:18:19 +02:00
|
|
|
#if ENABLED(SHOW_SD_PERCENT)
|
2019-10-11 04:03:33 +02:00
|
|
|
static char progress_string[5];
|
|
|
|
#endif
|
2019-11-26 09:55:22 +01:00
|
|
|
static uint8_t lastElapsed = 0xFF, lastProgress = 0xFF;
|
2019-10-20 01:06:48 +02:00
|
|
|
static u8g_uint_t elapsed_x_pos = 0, progress_bar_solid_width = 0;
|
2019-10-14 20:11:59 +02:00
|
|
|
static char elapsed_string[16];
|
2019-10-11 04:03:33 +02:00
|
|
|
#if ENABLED(SHOW_REMAINING_TIME)
|
2019-10-20 01:06:48 +02:00
|
|
|
static u8g_uint_t estimation_x_pos = 0;
|
2019-10-11 04:03:33 +02:00
|
|
|
static char estimation_string[10];
|
2021-08-17 13:18:19 +02:00
|
|
|
#if BOTH(SHOW_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
|
2019-10-20 01:06:48 +02:00
|
|
|
static u8g_uint_t progress_x_pos = 0;
|
2019-10-16 11:18:20 +02:00
|
|
|
static uint8_t progress_state = 0;
|
|
|
|
static bool prev_blink = 0;
|
|
|
|
#endif
|
2019-10-11 04:03:33 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2021-05-08 11:35:35 +02:00
|
|
|
const bool show_e_total = TERN0(LCD_SHOW_E_TOTAL, printingIsActive());
|
2019-10-27 23:58:28 +01:00
|
|
|
|
2018-11-20 14:36:37 +01:00
|
|
|
// At the first page, generate new display values
|
|
|
|
if (first_page) {
|
2019-12-02 04:20:15 +01:00
|
|
|
#if ANIM_HBCC
|
2018-11-28 04:15:52 +01:00
|
|
|
uint8_t new_bits = 0;
|
|
|
|
#if ANIM_HOTEND
|
2021-03-29 08:41:56 +02:00
|
|
|
HOTEND_LOOP() if (thermalManager.isHeatingHotend(e)) SBI(new_bits, DRAWBIT_HOTEND + e);
|
2018-11-20 14:36:37 +01:00
|
|
|
#endif
|
2021-03-29 08:41:56 +02:00
|
|
|
if (TERN0(ANIM_BED, thermalManager.isHeatingBed())) SBI(new_bits, DRAWBIT_BED);
|
2019-09-08 09:20:18 +02:00
|
|
|
#if DO_DRAW_CHAMBER && HAS_HEATED_CHAMBER
|
2021-03-29 08:41:56 +02:00
|
|
|
if (thermalManager.isHeatingChamber()) SBI(new_bits, DRAWBIT_CHAMBER);
|
2021-03-06 21:13:28 +01:00
|
|
|
#endif
|
2021-03-29 08:41:56 +02:00
|
|
|
if (TERN0(ANIM_CUTTER, cutter.enabled())) SBI(new_bits, DRAWBIT_CUTTER);
|
|
|
|
draw_bits = new_bits;
|
2018-11-20 14:36:37 +01:00
|
|
|
#endif
|
2019-11-02 13:04:31 +01:00
|
|
|
|
2019-09-29 11:25:39 +02:00
|
|
|
const xyz_pos_t lpos = current_position.asLogical();
|
2020-11-24 06:02:54 +01:00
|
|
|
const bool is_inch = parser.using_inch_units();
|
|
|
|
strcpy(zstring, is_inch ? ftostr42_52(LINEAR_UNIT(lpos.z)) : ftostr52sp(lpos.z));
|
2019-11-02 13:04:31 +01:00
|
|
|
|
2020-06-25 23:39:22 +02:00
|
|
|
if (show_e_total) {
|
2019-10-27 23:49:27 +01:00
|
|
|
#if ENABLED(LCD_SHOW_E_TOTAL)
|
|
|
|
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
|
|
|
sprintf_P(xstring, PSTR("%ld%cm"), uint32_t(_MAX(e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
|
|
|
|
#endif
|
|
|
|
}
|
2020-06-25 23:39:22 +02:00
|
|
|
else {
|
2020-11-24 06:02:54 +01:00
|
|
|
strcpy(xstring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.x)) : ftostr4sign(lpos.x));
|
|
|
|
strcpy(ystring, is_inch ? ftostr53_63(LINEAR_UNIT(lpos.y)) : ftostr4sign(lpos.y));
|
2020-06-25 23:39:22 +02:00
|
|
|
}
|
2019-11-02 13:04:31 +01:00
|
|
|
|
2018-11-20 14:36:37 +01:00
|
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
2019-09-11 01:48:58 +02:00
|
|
|
strcpy(wstring, ftostr12ns(filwidth.measured_mm));
|
2020-03-09 01:42:18 +01:00
|
|
|
strcpy(mstring, i16tostr3rj(planner.volumetric_percent(parser.volumetric_enabled)));
|
2018-11-20 14:36:37 +01:00
|
|
|
#endif
|
2019-10-11 04:03:33 +02:00
|
|
|
|
|
|
|
// Progress / elapsed / estimation updates and string formatting to avoid float math on each LCD draw
|
|
|
|
#if HAS_PRINT_PROGRESS
|
2020-04-10 03:58:21 +02:00
|
|
|
const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)();
|
2019-10-11 04:03:33 +02:00
|
|
|
duration_t elapsed = print_job_timer.duration();
|
|
|
|
const uint8_t p = progress & 0xFF, ev = elapsed.value & 0xFF;
|
2019-10-24 20:39:32 +02:00
|
|
|
if (p != lastProgress) {
|
2019-10-11 04:03:33 +02:00
|
|
|
lastProgress = p;
|
|
|
|
|
2020-01-05 09:08:24 +01:00
|
|
|
progress_bar_solid_width = u8g_uint_t((PROGRESS_BAR_WIDTH - 2) * (progress / (PROGRESS_SCALE)) * 0.01f);
|
2019-10-11 04:03:33 +02:00
|
|
|
|
2021-08-17 13:18:19 +02:00
|
|
|
#if ENABLED(SHOW_SD_PERCENT)
|
2019-10-20 01:06:48 +02:00
|
|
|
if (progress == 0) {
|
|
|
|
progress_string[0] = '\0';
|
2019-10-22 03:16:29 +02:00
|
|
|
#if ENABLED(SHOW_REMAINING_TIME)
|
|
|
|
estimation_string[0] = '\0';
|
2019-10-24 21:00:32 +02:00
|
|
|
estimation_x_pos = _SD_INFO_X(0);
|
2019-10-22 03:16:29 +02:00
|
|
|
#endif
|
2019-10-20 01:06:48 +02:00
|
|
|
}
|
2020-04-10 03:58:21 +02:00
|
|
|
else
|
|
|
|
strcpy(progress_string, TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
|
|
|
|
|
2019-10-24 20:42:02 +02:00
|
|
|
#if BOTH(SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY) // Tri-state progress display mode
|
2019-11-02 13:01:50 +01:00
|
|
|
progress_x_pos = _SD_INFO_X(strlen(progress_string) + 1);
|
2019-10-16 11:18:20 +02:00
|
|
|
#endif
|
2019-10-11 04:03:33 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-08-17 13:18:19 +02:00
|
|
|
constexpr bool can_show_days = DISABLED(SHOW_SD_PERCENT) || ENABLED(ROTATE_PROGRESS_DISPLAY);
|
2019-10-11 04:03:33 +02:00
|
|
|
if (ev != lastElapsed) {
|
|
|
|
lastElapsed = ev;
|
2020-03-16 20:11:55 +01:00
|
|
|
const uint8_t len = elapsed.toDigital(elapsed_string, can_show_days && elapsed.value >= 60*60*24L);
|
2019-10-24 21:00:32 +02:00
|
|
|
elapsed_x_pos = _SD_INFO_X(len);
|
2019-10-11 04:03:33 +02:00
|
|
|
|
|
|
|
#if ENABLED(SHOW_REMAINING_TIME)
|
|
|
|
if (!(ev & 0x3)) {
|
2019-11-13 02:36:54 +01:00
|
|
|
uint32_t timeval = (0
|
2019-11-13 09:07:09 +01:00
|
|
|
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
|
2019-11-13 02:36:54 +01:00
|
|
|
+ get_remaining_time()
|
|
|
|
#endif
|
|
|
|
);
|
2019-11-26 09:55:22 +01:00
|
|
|
if (!timeval && progress > 0) timeval = elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress;
|
2019-11-13 02:36:54 +01:00
|
|
|
if (!timeval) {
|
2019-10-20 18:44:05 +02:00
|
|
|
estimation_string[0] = '\0';
|
2019-10-24 21:00:32 +02:00
|
|
|
estimation_x_pos = _SD_INFO_X(0);
|
2019-10-20 18:44:05 +02:00
|
|
|
}
|
|
|
|
else {
|
2019-11-13 02:36:54 +01:00
|
|
|
duration_t estimation = timeval;
|
2020-03-16 20:11:55 +01:00
|
|
|
const uint8_t len = estimation.toDigital(estimation_string, can_show_days && estimation.value >= 60*60*24L);
|
2021-08-17 13:18:19 +02:00
|
|
|
estimation_x_pos = _SD_INFO_X(len + !BOTH(SHOW_SD_PERCENT, ROTATE_PROGRESS_DISPLAY));
|
2019-10-20 18:44:05 +02:00
|
|
|
}
|
2019-10-11 04:03:33 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
2018-11-20 14:36:37 +01:00
|
|
|
}
|
|
|
|
|
2018-11-11 19:16:24 +01:00
|
|
|
const bool blink = get_blink();
|
2018-02-14 22:43:54 +01:00
|
|
|
|
|
|
|
// Status Menu Font
|
2018-11-11 19:16:24 +01:00
|
|
|
set_font(FONT_STATUSMENU);
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-09-07 11:52:57 +02:00
|
|
|
#if DO_DRAW_LOGO
|
2018-11-20 14:36:37 +01:00
|
|
|
if (PAGE_CONTAINS(STATUS_LOGO_Y, STATUS_LOGO_Y + STATUS_LOGO_HEIGHT - 1))
|
2018-11-28 04:15:52 +01:00
|
|
|
u8g.drawBitmapP(STATUS_LOGO_X, STATUS_LOGO_Y, STATUS_LOGO_BYTEWIDTH, STATUS_LOGO_HEIGHT, status_logo_bmp);
|
2018-11-20 14:36:37 +01:00
|
|
|
#endif
|
|
|
|
|
2018-11-28 04:15:52 +01:00
|
|
|
#if STATUS_HEATERS_WIDTH
|
|
|
|
// Draw all heaters (and maybe the bed) in one go
|
|
|
|
if (PAGE_CONTAINS(STATUS_HEATERS_Y, STATUS_HEATERS_Y + STATUS_HEATERS_HEIGHT - 1))
|
|
|
|
u8g.drawBitmapP(STATUS_HEATERS_X, STATUS_HEATERS_Y, STATUS_HEATERS_BYTEWIDTH, STATUS_HEATERS_HEIGHT, status_heaters_bmp);
|
2018-11-20 14:36:37 +01:00
|
|
|
#endif
|
|
|
|
|
2020-02-26 15:09:57 +01:00
|
|
|
#if DO_DRAW_CUTTER && DISABLED(STATUS_COMBINE_HEATERS)
|
2019-12-02 04:20:15 +01:00
|
|
|
#if ANIM_CUTTER
|
|
|
|
#define CUTTER_BITMAP(S) ((S) ? status_cutter_on_bmp : status_cutter_bmp)
|
|
|
|
#else
|
|
|
|
#define CUTTER_BITMAP(S) status_cutter_bmp
|
|
|
|
#endif
|
|
|
|
const uint8_t cuttery = STATUS_CUTTER_Y(CUTTER_ALT()),
|
|
|
|
cutterh = STATUS_CUTTER_HEIGHT(CUTTER_ALT());
|
|
|
|
if (PAGE_CONTAINS(cuttery, cuttery + cutterh - 1))
|
|
|
|
u8g.drawBitmapP(STATUS_CUTTER_X, cuttery, STATUS_CUTTER_BYTEWIDTH, cutterh, CUTTER_BITMAP(CUTTER_ALT()));
|
|
|
|
#endif
|
|
|
|
|
2019-09-07 11:52:57 +02:00
|
|
|
#if DO_DRAW_BED && DISABLED(STATUS_COMBINE_HEATERS)
|
2018-11-20 14:36:37 +01:00
|
|
|
#if ANIM_BED
|
2022-01-17 06:34:50 +01:00
|
|
|
#if BOTH(HAS_LEVELING, STATUS_ALT_BED_BITMAP)
|
|
|
|
#define BED_BITMAP(S) ((S) \
|
|
|
|
? (planner.leveling_active ? status_bed_leveled_on_bmp : status_bed_on_bmp) \
|
|
|
|
: (planner.leveling_active ? status_bed_leveled_bmp : status_bed_bmp))
|
|
|
|
#else
|
|
|
|
#define BED_BITMAP(S) ((S) ? status_bed_on_bmp : status_bed_bmp)
|
|
|
|
#endif
|
2018-11-20 14:36:37 +01:00
|
|
|
#else
|
|
|
|
#define BED_BITMAP(S) status_bed_bmp
|
|
|
|
#endif
|
2019-09-07 11:52:57 +02:00
|
|
|
const uint8_t bedy = STATUS_BED_Y(BED_ALT()),
|
|
|
|
bedh = STATUS_BED_HEIGHT(BED_ALT());
|
2018-11-28 04:15:52 +01:00
|
|
|
if (PAGE_CONTAINS(bedy, bedy + bedh - 1))
|
|
|
|
u8g.drawBitmapP(STATUS_BED_X, bedy, STATUS_BED_BYTEWIDTH, bedh, BED_BITMAP(BED_ALT()));
|
2018-10-28 04:06:25 +01:00
|
|
|
#endif
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2020-02-26 15:09:57 +01:00
|
|
|
#if DO_DRAW_CHAMBER && DISABLED(STATUS_COMBINE_HEATERS)
|
2019-07-11 21:35:48 +02:00
|
|
|
#if ANIM_CHAMBER
|
2019-05-31 01:31:50 +02:00
|
|
|
#define CHAMBER_BITMAP(S) ((S) ? status_chamber_on_bmp : status_chamber_bmp)
|
|
|
|
#else
|
|
|
|
#define CHAMBER_BITMAP(S) status_chamber_bmp
|
|
|
|
#endif
|
2019-09-07 11:52:57 +02:00
|
|
|
const uint8_t chambery = STATUS_CHAMBER_Y(CHAMBER_ALT()),
|
|
|
|
chamberh = STATUS_CHAMBER_HEIGHT(CHAMBER_ALT());
|
|
|
|
if (PAGE_CONTAINS(chambery, chambery + chamberh - 1))
|
|
|
|
u8g.drawBitmapP(STATUS_CHAMBER_X, chambery, STATUS_CHAMBER_BYTEWIDTH, chamberh, CHAMBER_BITMAP(CHAMBER_ALT()));
|
2019-05-31 01:31:50 +02:00
|
|
|
#endif
|
|
|
|
|
2018-11-20 14:36:37 +01:00
|
|
|
#if DO_DRAW_FAN
|
2018-11-24 06:14:56 +01:00
|
|
|
#if STATUS_FAN_FRAMES > 2
|
2018-11-20 14:36:37 +01:00
|
|
|
static bool old_blink;
|
|
|
|
static uint8_t fan_frame;
|
|
|
|
if (old_blink != blink) {
|
|
|
|
old_blink = blink;
|
2019-01-12 07:41:48 +01:00
|
|
|
if (!thermalManager.fan_speed[0] || ++fan_frame >= STATUS_FAN_FRAMES) fan_frame = 0;
|
2018-11-20 14:36:37 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (PAGE_CONTAINS(STATUS_FAN_Y, STATUS_FAN_Y + STATUS_FAN_HEIGHT - 1))
|
2019-09-07 11:52:57 +02:00
|
|
|
u8g.drawBitmapP(STATUS_FAN_X, STATUS_FAN_Y, STATUS_FAN_BYTEWIDTH, STATUS_FAN_HEIGHT,
|
2018-11-24 06:14:56 +01:00
|
|
|
#if STATUS_FAN_FRAMES > 2
|
2018-11-20 14:36:37 +01:00
|
|
|
fan_frame == 1 ? status_fan1_bmp :
|
|
|
|
fan_frame == 2 ? status_fan2_bmp :
|
2018-11-24 06:14:56 +01:00
|
|
|
#if STATUS_FAN_FRAMES > 3
|
2018-11-20 14:36:37 +01:00
|
|
|
fan_frame == 3 ? status_fan3_bmp :
|
2018-02-14 22:43:54 +01:00
|
|
|
#endif
|
2018-11-24 06:14:56 +01:00
|
|
|
#elif STATUS_FAN_FRAMES > 1
|
2019-01-12 07:41:48 +01:00
|
|
|
blink && thermalManager.fan_speed[0] ? status_fan1_bmp :
|
2018-02-14 22:43:54 +01:00
|
|
|
#endif
|
2018-11-20 14:36:37 +01:00
|
|
|
status_fan0_bmp
|
|
|
|
);
|
|
|
|
#endif
|
2018-02-14 22:43:54 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// Temperature Graphics and Info
|
|
|
|
//
|
2018-11-28 04:15:52 +01:00
|
|
|
if (PAGE_UNDER(6 + 1 + 12 + 1 + 6 + 1)) {
|
2018-02-14 22:43:54 +01:00
|
|
|
// Extruders
|
2019-12-02 04:20:15 +01:00
|
|
|
#if DO_DRAW_HOTENDS
|
2020-03-14 05:18:16 +01:00
|
|
|
LOOP_L_N(e, MAX_HOTEND_DRAW)
|
2020-09-14 01:06:14 +02:00
|
|
|
_draw_hotend_status((heater_id_t)e, blink);
|
2019-09-10 09:20:49 +02:00
|
|
|
#endif
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-12-02 04:20:15 +01:00
|
|
|
// Laser / Spindle
|
|
|
|
#if DO_DRAW_CUTTER
|
2020-06-08 07:47:31 +02:00
|
|
|
if (cutter.isReady && PAGE_CONTAINS(STATUS_CUTTER_TEXT_Y - INFO_FONT_ASCENT, STATUS_CUTTER_TEXT_Y - 1)) {
|
|
|
|
#if CUTTER_UNIT_IS(PERCENT)
|
|
|
|
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
|
|
|
|
#elif CUTTER_UNIT_IS(RPM)
|
2022-03-04 22:18:27 +01:00
|
|
|
lcd_put_u8str(STATUS_CUTTER_TEXT_X - 2, STATUS_CUTTER_TEXT_Y, ftostr61rj(float(cutter.unitPower) / 1000));
|
2020-04-03 02:31:08 +02:00
|
|
|
lcd_put_wchar('K');
|
2020-06-08 07:47:31 +02:00
|
|
|
#else
|
|
|
|
lcd_put_u8str(STATUS_CUTTER_TEXT_X, STATUS_CUTTER_TEXT_Y, cutter_power2str(cutter.unitPower));
|
2020-04-03 02:31:08 +02:00
|
|
|
#endif
|
2019-12-02 04:20:15 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-03-06 21:13:28 +01:00
|
|
|
// Laser Cooler
|
|
|
|
#if DO_DRAW_COOLER
|
2021-03-29 08:41:56 +02:00
|
|
|
const uint8_t coolery = STATUS_COOLER_Y(status_cooler_bmp1),
|
|
|
|
coolerh = STATUS_COOLER_HEIGHT(status_cooler_bmp1);
|
2021-03-06 21:13:28 +01:00
|
|
|
if (PAGE_CONTAINS(coolery, coolery + coolerh - 1))
|
2021-03-29 08:41:56 +02:00
|
|
|
u8g.drawBitmapP(STATUS_COOLER_X, coolery, STATUS_COOLER_BYTEWIDTH, coolerh, blink && cooler.enabled ? status_cooler_bmp2 : status_cooler_bmp1);
|
2021-03-06 21:13:28 +01:00
|
|
|
#endif
|
|
|
|
|
2021-03-29 08:41:56 +02:00
|
|
|
// Laser Cooler Flow Meter
|
|
|
|
#if DO_DRAW_FLOWMETER
|
|
|
|
const uint8_t flowmetery = STATUS_FLOWMETER_Y(status_flowmeter_bmp1),
|
|
|
|
flowmeterh = STATUS_FLOWMETER_HEIGHT(status_flowmeter_bmp1);
|
|
|
|
if (PAGE_CONTAINS(flowmetery, flowmetery + flowmeterh - 1))
|
|
|
|
u8g.drawBitmapP(STATUS_FLOWMETER_X, flowmetery, STATUS_FLOWMETER_BYTEWIDTH, flowmeterh, blink && cooler.flowpulses ? status_flowmeter_bmp2 : status_flowmeter_bmp1);
|
|
|
|
#endif
|
|
|
|
|
2021-06-07 21:15:09 +02:00
|
|
|
// Laser Ammeter
|
|
|
|
#if DO_DRAW_AMMETER
|
|
|
|
const uint8_t ammetery = STATUS_AMMETER_Y(status_ammeter_bmp_mA),
|
|
|
|
ammeterh = STATUS_AMMETER_HEIGHT(status_ammeter_bmp_mA);
|
|
|
|
if (PAGE_CONTAINS(ammetery, ammetery + ammeterh - 1))
|
2021-06-08 14:51:28 +02:00
|
|
|
u8g.drawBitmapP(STATUS_AMMETER_X, ammetery, STATUS_AMMETER_BYTEWIDTH, ammeterh, (ammeter.current < 0.1f) ? status_ammeter_bmp_mA : status_ammeter_bmp_A);
|
2021-06-07 21:15:09 +02:00
|
|
|
#endif
|
2021-03-29 08:41:56 +02:00
|
|
|
|
2019-12-02 04:20:15 +01:00
|
|
|
// Heated Bed
|
2020-04-22 23:35:03 +02:00
|
|
|
TERN_(DO_DRAW_BED, _draw_bed_status(blink));
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-12-02 04:20:15 +01:00
|
|
|
// Heated Chamber
|
2020-04-22 23:35:03 +02:00
|
|
|
TERN_(DO_DRAW_CHAMBER, _draw_chamber_status());
|
2019-05-31 01:31:50 +02:00
|
|
|
|
2021-03-06 21:13:28 +01:00
|
|
|
// Cooler
|
|
|
|
TERN_(DO_DRAW_COOLER, _draw_cooler_status());
|
|
|
|
|
2021-03-29 08:41:56 +02:00
|
|
|
// Flowmeter
|
|
|
|
TERN_(DO_DRAW_FLOWMETER, _draw_flowmeter_status());
|
|
|
|
|
2021-06-07 21:15:09 +02:00
|
|
|
// Flowmeter
|
|
|
|
TERN_(DO_DRAW_AMMETER, _draw_ammeter_status());
|
|
|
|
|
2018-11-20 14:36:37 +01:00
|
|
|
// Fan, if a bitmap was provided
|
|
|
|
#if DO_DRAW_FAN
|
2018-11-29 02:46:13 +01:00
|
|
|
if (PAGE_CONTAINS(STATUS_FAN_TEXT_Y - INFO_FONT_ASCENT, STATUS_FAN_TEXT_Y - 1)) {
|
2019-01-12 07:41:48 +01:00
|
|
|
char c = '%';
|
|
|
|
uint16_t spd = thermalManager.fan_speed[0];
|
|
|
|
if (spd) {
|
|
|
|
#if ENABLED(ADAPTIVE_FAN_SLOWING)
|
|
|
|
if (!blink && thermalManager.fan_speed_scaler[0] < 128) {
|
2019-06-28 20:58:40 +02:00
|
|
|
spd = thermalManager.scaledFanSpeed(0, spd);
|
2019-01-12 07:41:48 +01:00
|
|
|
c = '*';
|
|
|
|
}
|
|
|
|
#endif
|
2021-04-13 11:00:39 +02:00
|
|
|
lcd_put_u8str(STATUS_FAN_TEXT_X, STATUS_FAN_TEXT_Y, i16tostr3rj(thermalManager.pwmToPercent(spd)));
|
2019-01-12 07:41:48 +01:00
|
|
|
lcd_put_wchar(c);
|
2018-02-14 22:43:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
//
|
|
|
|
// SD Card Symbol
|
|
|
|
//
|
2018-10-27 20:07:03 +02:00
|
|
|
if (card.isFileOpen() && PAGE_CONTAINS(42, 51)) {
|
2018-02-14 22:43:54 +01:00
|
|
|
// Upper box
|
2018-10-27 20:07:03 +02:00
|
|
|
u8g.drawBox(42, 42, 8, 7); // 42-48 (or 41-47)
|
2018-02-14 22:43:54 +01:00
|
|
|
// Right edge
|
2018-10-27 20:07:03 +02:00
|
|
|
u8g.drawBox(50, 44, 2, 5); // 44-48 (or 43-47)
|
2018-02-14 22:43:54 +01:00
|
|
|
// Bottom hollow box
|
2018-10-27 20:07:03 +02:00
|
|
|
u8g.drawFrame(42, 49, 10, 4); // 49-52 (or 48-51)
|
2018-02-14 22:43:54 +01:00
|
|
|
// Corner pixel
|
2018-10-27 20:07:03 +02:00
|
|
|
u8g.drawPixel(50, 43); // 43 (or 42)
|
2018-02-14 22:43:54 +01:00
|
|
|
}
|
|
|
|
#endif // SDSUPPORT
|
|
|
|
|
2018-10-18 18:34:52 +02:00
|
|
|
#if HAS_PRINT_PROGRESS
|
2018-02-14 22:43:54 +01:00
|
|
|
//
|
|
|
|
// Progress bar frame
|
|
|
|
//
|
|
|
|
|
2020-05-12 06:19:56 +02:00
|
|
|
if (PAGE_CONTAINS(PROGRESS_BAR_Y, PROGRESS_BAR_Y + 3))
|
2020-05-03 08:24:39 +02:00
|
|
|
u8g.drawFrame(PROGRESS_BAR_X, PROGRESS_BAR_Y, PROGRESS_BAR_WIDTH, 4);
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-10-11 04:03:33 +02:00
|
|
|
//
|
|
|
|
// Progress bar solid part
|
|
|
|
//
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2020-05-12 06:19:56 +02:00
|
|
|
if (PAGE_CONTAINS(PROGRESS_BAR_Y + 1, PROGRESS_BAR_Y + 2))
|
|
|
|
u8g.drawBox(PROGRESS_BAR_X + 1, PROGRESS_BAR_Y + 1, progress_bar_solid_width, 2);
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-10-16 11:18:20 +02:00
|
|
|
if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) {
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2021-08-17 13:18:19 +02:00
|
|
|
#if ALL(SHOW_SD_PERCENT, SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY)
|
2019-10-24 20:38:39 +02:00
|
|
|
|
2019-10-16 11:18:20 +02:00
|
|
|
if (prev_blink != blink) {
|
|
|
|
prev_blink = blink;
|
2019-10-24 20:38:39 +02:00
|
|
|
if (++progress_state >= 3) progress_state = 0;
|
2018-02-14 22:43:54 +01:00
|
|
|
}
|
|
|
|
|
2019-10-16 11:18:20 +02:00
|
|
|
if (progress_state == 0) {
|
2019-10-24 20:38:39 +02:00
|
|
|
if (progress_string[0]) {
|
2019-10-16 11:18:20 +02:00
|
|
|
lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
|
|
|
|
lcd_put_wchar('%');
|
|
|
|
}
|
|
|
|
}
|
2019-10-24 20:38:39 +02:00
|
|
|
else if (progress_state == 2 && estimation_string[0]) {
|
2021-09-26 06:52:41 +02:00
|
|
|
lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, F("R:"));
|
2019-10-16 11:18:20 +02:00
|
|
|
lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
|
|
|
|
}
|
2019-10-24 20:38:39 +02:00
|
|
|
else if (elapsed_string[0]) {
|
2020-03-01 14:36:25 +01:00
|
|
|
lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, E_LBL);
|
2019-10-16 11:18:20 +02:00
|
|
|
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
|
|
|
|
}
|
2019-10-24 20:38:39 +02:00
|
|
|
|
2021-08-17 13:18:19 +02:00
|
|
|
#else // !SHOW_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-10-16 11:18:20 +02:00
|
|
|
//
|
|
|
|
// SD Percent Complete
|
|
|
|
//
|
|
|
|
|
2021-08-17 13:18:19 +02:00
|
|
|
#if ENABLED(SHOW_SD_PERCENT)
|
2019-10-24 20:38:39 +02:00
|
|
|
if (progress_string[0]) {
|
2020-05-03 08:24:39 +02:00
|
|
|
lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete
|
2019-10-16 11:18:20 +02:00
|
|
|
lcd_put_wchar('%');
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Elapsed Time
|
|
|
|
//
|
|
|
|
|
|
|
|
#if ENABLED(SHOW_REMAINING_TIME)
|
2019-10-24 20:38:39 +02:00
|
|
|
if (blink && estimation_string[0]) {
|
2019-10-24 21:00:32 +02:00
|
|
|
lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, 'R');
|
2019-10-16 11:18:20 +02:00
|
|
|
lcd_put_u8str(estimation_string);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
|
2019-10-11 04:03:33 +02:00
|
|
|
|
2021-08-17 13:18:19 +02:00
|
|
|
#endif // !SHOW_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
|
2018-02-14 22:43:54 +01:00
|
|
|
}
|
2019-10-24 20:38:39 +02:00
|
|
|
|
2018-10-28 04:06:25 +01:00
|
|
|
#endif // HAS_PRINT_PROGRESS
|
2018-02-14 22:43:54 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// XYZ Coordinates
|
|
|
|
//
|
|
|
|
|
2020-05-03 08:24:39 +02:00
|
|
|
#if EITHER(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME)
|
2018-02-14 22:43:54 +01:00
|
|
|
#define XYZ_FRAME_TOP 29
|
2018-10-31 04:39:44 +01:00
|
|
|
#define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 3
|
2018-02-14 22:43:54 +01:00
|
|
|
#else
|
|
|
|
#define XYZ_FRAME_TOP 30
|
2018-10-31 04:39:44 +01:00
|
|
|
#define XYZ_FRAME_HEIGHT INFO_FONT_ASCENT + 1
|
2018-02-14 22:43:54 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) {
|
|
|
|
|
2020-05-03 08:24:39 +02:00
|
|
|
#if DISABLED(XYZ_NO_FRAME)
|
|
|
|
#if ENABLED(XYZ_HOLLOW_FRAME)
|
|
|
|
u8g.drawFrame(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 29-40 7: 29-39
|
|
|
|
#else
|
|
|
|
u8g.drawBox(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 30-39 7: 30-37
|
|
|
|
#endif
|
2018-02-14 22:43:54 +01:00
|
|
|
#endif
|
|
|
|
|
2018-10-31 04:39:44 +01:00
|
|
|
if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_ASCENT - 1), XYZ_BASELINE)) {
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2020-05-03 08:24:39 +02:00
|
|
|
#if NONE(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME)
|
2018-02-14 22:43:54 +01:00
|
|
|
u8g.setColorIndex(0); // white on black
|
|
|
|
#endif
|
|
|
|
|
2020-04-22 23:35:03 +02:00
|
|
|
#if HAS_DUAL_MIXING
|
2019-02-10 11:54:23 +01:00
|
|
|
|
|
|
|
// Two-component mix / gradient instead of XY
|
|
|
|
|
2020-10-07 02:17:18 +02:00
|
|
|
char mixer_messages[15];
|
2020-05-06 00:55:35 +02:00
|
|
|
PGM_P mix_label;
|
2019-02-10 11:54:23 +01:00
|
|
|
#if ENABLED(GRADIENT_MIX)
|
|
|
|
if (mixer.gradient.enabled) {
|
|
|
|
mixer.update_mix_from_gradient();
|
2020-05-06 00:55:35 +02:00
|
|
|
mix_label = PSTR("Gr");
|
2019-02-10 11:54:23 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
mixer.update_mix_from_vtool();
|
2020-05-06 00:55:35 +02:00
|
|
|
mix_label = PSTR("Mx");
|
2019-02-10 11:54:23 +01:00
|
|
|
}
|
2020-11-14 01:27:31 +01:00
|
|
|
|
2021-10-19 12:52:41 +02:00
|
|
|
#pragma GCC diagnostic push
|
2021-04-12 23:49:53 +02:00
|
|
|
#if GCC_VERSION <= 50000
|
|
|
|
#pragma GCC diagnostic ignored "-Wformat-overflow"
|
|
|
|
#endif
|
2020-11-14 01:27:31 +01:00
|
|
|
|
2020-05-06 00:55:35 +02:00
|
|
|
sprintf_P(mixer_messages, PSTR(S_FMT " %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1]));
|
2019-08-23 02:36:18 +02:00
|
|
|
lcd_put_u8str(X_LABEL_POS, XYZ_BASELINE, mixer_messages);
|
2019-02-10 11:54:23 +01:00
|
|
|
|
2021-10-19 12:52:41 +02:00
|
|
|
#pragma GCC diagnostic pop
|
2020-11-14 01:27:31 +01:00
|
|
|
|
2019-02-10 11:54:23 +01:00
|
|
|
#else
|
|
|
|
|
2020-06-25 23:39:22 +02:00
|
|
|
if (show_e_total) {
|
2021-05-24 23:38:57 +02:00
|
|
|
#if ENABLED(LCD_SHOW_E_TOTAL)
|
|
|
|
_draw_axis_value(E_AXIS, xstring, true);
|
2021-09-26 06:52:41 +02:00
|
|
|
lcd_put_u8str(F(" "));
|
2021-05-24 23:38:57 +02:00
|
|
|
#endif
|
2019-10-27 23:49:27 +01:00
|
|
|
}
|
2020-06-25 23:39:22 +02:00
|
|
|
else {
|
|
|
|
_draw_axis_value(X_AXIS, xstring, blink);
|
|
|
|
_draw_axis_value(Y_AXIS, ystring, blink);
|
|
|
|
}
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-02-10 11:54:23 +01:00
|
|
|
#endif
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2018-05-10 08:19:20 +02:00
|
|
|
_draw_axis_value(Z_AXIS, zstring, blink);
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2020-05-03 08:24:39 +02:00
|
|
|
#if NONE(XYZ_NO_FRAME, XYZ_HOLLOW_FRAME)
|
2018-02-14 22:43:54 +01:00
|
|
|
u8g.setColorIndex(1); // black on white
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Feedrate
|
|
|
|
//
|
2018-11-29 02:46:13 +01:00
|
|
|
#define EXTRAS_2_BASELINE (EXTRAS_BASELINE + 3)
|
|
|
|
|
|
|
|
if (PAGE_CONTAINS(EXTRAS_2_BASELINE - INFO_FONT_ASCENT, EXTRAS_2_BASELINE - 1)) {
|
2018-11-11 19:16:24 +01:00
|
|
|
set_font(FONT_MENU);
|
2019-08-23 02:36:18 +02:00
|
|
|
lcd_put_wchar(3, EXTRAS_2_BASELINE, LCD_STR_FEEDRATE[0]);
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2018-11-11 19:16:24 +01:00
|
|
|
set_font(FONT_STATUSMENU);
|
2020-03-09 01:42:18 +01:00
|
|
|
lcd_put_u8str(12, EXTRAS_2_BASELINE, i16tostr3rj(feedrate_percentage));
|
2018-04-13 03:14:01 +02:00
|
|
|
lcd_put_wchar('%');
|
2018-02-14 22:43:54 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// Filament sensor display if SD is disabled
|
|
|
|
//
|
|
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
|
2019-08-23 02:36:18 +02:00
|
|
|
lcd_put_u8str(56, EXTRAS_2_BASELINE, wstring);
|
|
|
|
lcd_put_u8str(102, EXTRAS_2_BASELINE, mstring);
|
2018-04-13 03:14:01 +02:00
|
|
|
lcd_put_wchar('%');
|
2018-11-11 19:16:24 +01:00
|
|
|
set_font(FONT_MENU);
|
2021-09-26 06:52:41 +02:00
|
|
|
lcd_put_wchar(47, EXTRAS_2_BASELINE, LCD_STR_FILAM_DIA[0]); // lcd_put_u8str(F(LCD_STR_FILAM_DIA));
|
2019-08-23 02:36:18 +02:00
|
|
|
lcd_put_wchar(93, EXTRAS_2_BASELINE, LCD_STR_FILAM_MUL[0]);
|
2018-02-14 22:43:54 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Status line
|
|
|
|
//
|
2018-11-29 02:46:13 +01:00
|
|
|
if (PAGE_CONTAINS(STATUS_BASELINE - INFO_FONT_ASCENT, STATUS_BASELINE + INFO_FONT_DESCENT)) {
|
2018-04-13 03:14:01 +02:00
|
|
|
lcd_moveto(0, STATUS_BASELINE);
|
2018-02-14 22:43:54 +01:00
|
|
|
|
2019-03-17 05:43:06 +01:00
|
|
|
#if BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
|
2018-11-11 19:16:24 +01:00
|
|
|
// Alternate Status message and Filament display
|
2018-11-19 02:58:02 +01:00
|
|
|
if (ELAPSED(millis(), next_filament_display)) {
|
2021-09-26 06:52:41 +02:00
|
|
|
lcd_put_u8str(F(LCD_STR_FILAM_DIA));
|
2018-04-13 03:14:01 +02:00
|
|
|
lcd_put_wchar(':');
|
|
|
|
lcd_put_u8str(wstring);
|
2021-09-26 06:52:41 +02:00
|
|
|
lcd_put_u8str(F(" " LCD_STR_FILAM_MUL));
|
2018-04-13 03:14:01 +02:00
|
|
|
lcd_put_wchar(':');
|
|
|
|
lcd_put_u8str(mstring);
|
|
|
|
lcd_put_wchar('%');
|
2020-05-03 08:24:39 +02:00
|
|
|
return;
|
2018-02-14 22:43:54 +01:00
|
|
|
}
|
|
|
|
#endif
|
2020-05-03 08:24:39 +02:00
|
|
|
|
|
|
|
draw_status_message(blink);
|
2018-02-14 22:43:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-24 06:02:54 +01:00
|
|
|
/**
|
|
|
|
* Draw the Status Message area
|
|
|
|
*/
|
2018-11-28 04:15:52 +01:00
|
|
|
void MarlinUI::draw_status_message(const bool blink) {
|
|
|
|
|
|
|
|
// Get the UTF8 character count of the string
|
2020-06-18 22:23:03 +02:00
|
|
|
uint8_t lcd_width = LCD_WIDTH, pixel_width = LCD_PIXEL_WIDTH,
|
|
|
|
slen = utf8_strlen(status_message);
|
|
|
|
|
|
|
|
#if HAS_POWER_MONITOR
|
|
|
|
if (power_monitor.display_enabled()) {
|
|
|
|
// make room at the end of the status line for the power monitor reading
|
|
|
|
lcd_width -= 6;
|
|
|
|
pixel_width -= (MENU_FONT_WIDTH) * 6;
|
|
|
|
}
|
|
|
|
#endif
|
2018-11-28 04:15:52 +01:00
|
|
|
|
|
|
|
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
|
|
|
|
|
|
|
static bool last_blink = false;
|
|
|
|
|
2020-06-18 22:23:03 +02:00
|
|
|
if (slen <= lcd_width) {
|
2018-11-28 04:15:52 +01:00
|
|
|
// The string fits within the line. Print with no scrolling
|
|
|
|
lcd_put_u8str(status_message);
|
2020-06-18 22:23:03 +02:00
|
|
|
while (slen < lcd_width) { lcd_put_wchar(' '); ++slen; }
|
2018-11-28 04:15:52 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
// String is longer than the available space
|
2020-12-24 04:34:09 +01:00
|
|
|
if (blink != last_blink) {
|
|
|
|
last_blink = blink;
|
|
|
|
advance_status_scroll();
|
|
|
|
}
|
2018-11-28 04:15:52 +01:00
|
|
|
|
|
|
|
// Get a pointer to the next valid UTF8 character
|
2019-03-17 11:32:12 +01:00
|
|
|
// and the string remaining length
|
|
|
|
uint8_t rlen;
|
|
|
|
const char *stat = status_and_len(rlen);
|
2020-06-18 22:23:03 +02:00
|
|
|
lcd_put_u8str_max(stat, pixel_width);
|
2019-03-17 11:32:12 +01:00
|
|
|
|
|
|
|
// If the remaining string doesn't completely fill the screen
|
2020-06-18 22:23:03 +02:00
|
|
|
if (rlen < lcd_width) {
|
|
|
|
uint8_t chars = lcd_width - rlen; // Amount of space left in characters
|
2021-04-14 11:42:04 +02:00
|
|
|
lcd_put_wchar(' '); // Always at 1+ spaces left, draw a space
|
|
|
|
if (--chars) { // Draw a second space if there's room
|
|
|
|
lcd_put_wchar(' ');
|
|
|
|
if (--chars) { // Draw a third space if there's room
|
2018-12-03 13:17:09 +01:00
|
|
|
lcd_put_wchar(' ');
|
2021-04-14 11:42:04 +02:00
|
|
|
if (--chars) { // Print a second copy of the message
|
|
|
|
lcd_put_u8str_max(status_message, pixel_width - (rlen + 2) * (MENU_FONT_WIDTH));
|
|
|
|
lcd_put_wchar(' ');
|
|
|
|
}
|
2018-11-28 04:15:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#else // !STATUS_MESSAGE_SCROLLING
|
|
|
|
|
|
|
|
UNUSED(blink);
|
|
|
|
|
|
|
|
// Just print the string to the LCD
|
2020-06-18 22:23:03 +02:00
|
|
|
lcd_put_u8str_max(status_message, pixel_width);
|
2018-11-28 04:15:52 +01:00
|
|
|
|
|
|
|
// Fill the rest with spaces
|
2020-06-18 22:23:03 +02:00
|
|
|
for (; slen < lcd_width; ++slen) lcd_put_wchar(' ');
|
2018-11-28 04:15:52 +01:00
|
|
|
|
|
|
|
#endif // !STATUS_MESSAGE_SCROLLING
|
2020-06-18 22:23:03 +02:00
|
|
|
|
|
|
|
#if HAS_POWER_MONITOR
|
|
|
|
display_power_monitor(pixel_width + MENU_FONT_WIDTH, STATUS_BASELINE);
|
|
|
|
#endif
|
2018-11-28 04:15:52 +01:00
|
|
|
}
|
|
|
|
|
2020-09-28 08:13:27 +02:00
|
|
|
#endif // HAS_MARLINUI_U8GLIB && !LIGHTWEIGHT_UI
|