Proposed changes to ST7920 lightweight status screen
parent
24eb275b99
commit
79272f98fc
@ -0,0 +1,442 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* status_screen_DOGM.h
|
||||
*
|
||||
* Standard Status Screen for Graphical Display
|
||||
*/
|
||||
|
||||
#ifndef ULTRALCD_IMPL_STATUS_SCREEN_DOGM_H
|
||||
#define ULTRALCD_IMPL_STATUS_SCREEN_DOGM_H
|
||||
|
||||
FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) {
|
||||
const char * const str = itostr3(temp);
|
||||
u8g.setPrintPos(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * DOG_CHAR_WIDTH / 2, y);
|
||||
lcd_print(str);
|
||||
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
|
||||
}
|
||||
|
||||
#ifndef HEAT_INDICATOR_X
|
||||
#define HEAT_INDICATOR_X 8
|
||||
#endif
|
||||
|
||||
FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, const bool blink) {
|
||||
#if !HEATER_IDLE_HANDLER
|
||||
UNUSED(blink);
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_BED
|
||||
const bool isBed = heater < 0;
|
||||
#else
|
||||
constexpr bool isBed = false;
|
||||
#endif
|
||||
|
||||
if (PAGE_UNDER(7)) {
|
||||
#if HEATER_IDLE_HANDLER
|
||||
const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) :
|
||||
#if HAS_TEMP_BED
|
||||
thermalManager.is_bed_idle()
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
|
||||
if (blink || !is_idle)
|
||||
#endif
|
||||
_draw_centered_temp((isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater)) + 0.5, x, 7); }
|
||||
|
||||
if (PAGE_CONTAINS(21, 28))
|
||||
_draw_centered_temp((isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)) + 0.5, x, 28);
|
||||
|
||||
if (PAGE_CONTAINS(17, 20)) {
|
||||
const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X,
|
||||
y = isBed ? 18 : 17;
|
||||
if (isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater)) {
|
||||
u8g.setColorIndex(0); // white on black
|
||||
u8g.drawBox(x + h, y, 2, 2);
|
||||
u8g.setColorIndex(1); // black on white
|
||||
}
|
||||
else {
|
||||
u8g.drawBox(x + h, y, 2, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) {
|
||||
if (blink)
|
||||
lcd_printPGM(pstr);
|
||||
else {
|
||||
if (!axis_homed[axis])
|
||||
u8g.print('?');
|
||||
else {
|
||||
#if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING)
|
||||
if (!axis_known_position[axis])
|
||||
u8g.print(' ');
|
||||
else
|
||||
#endif
|
||||
lcd_printPGM(pstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void lcd_implementation_status_message(const bool blink) {
|
||||
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||
static bool last_blink = false;
|
||||
const uint8_t slen = lcd_strlen(lcd_status_message);
|
||||
const char *stat = lcd_status_message + status_scroll_pos;
|
||||
if (slen <= LCD_WIDTH)
|
||||
lcd_print_utf(stat); // The string isn't scrolling
|
||||
else {
|
||||
if (status_scroll_pos <= slen - LCD_WIDTH)
|
||||
lcd_print_utf(stat); // The string fills the screen
|
||||
else {
|
||||
uint8_t chars = LCD_WIDTH;
|
||||
if (status_scroll_pos < slen) { // First string still visible
|
||||
lcd_print_utf(stat); // The string leaves space
|
||||
chars -= slen - status_scroll_pos; // Amount of space left
|
||||
}
|
||||
u8g.print('.'); // Always at 1+ spaces left, draw a dot
|
||||
if (--chars) {
|
||||
if (status_scroll_pos < slen + 1) // Draw a second dot if there's space
|
||||
--chars, u8g.print('.');
|
||||
if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message
|
||||
}
|
||||
}
|
||||
if (last_blink != blink) {
|
||||
last_blink = blink;
|
||||
// Skip any non-printing bytes
|
||||
if (status_scroll_pos < slen) while (!PRINTABLE(lcd_status_message[status_scroll_pos])) status_scroll_pos++;
|
||||
if (++status_scroll_pos >= slen + 2) status_scroll_pos = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
UNUSED(blink);
|
||||
lcd_print_utf(lcd_status_message);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lcd_implementation_status_screen() {
|
||||
|
||||
const bool blink = lcd_blink();
|
||||
|
||||
#if FAN_ANIM_FRAMES > 2
|
||||
static bool old_blink;
|
||||
static uint8_t fan_frame;
|
||||
if (old_blink != blink) {
|
||||
old_blink = blink;
|
||||
if (!fanSpeeds[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Status Menu Font
|
||||
lcd_setFont(FONT_STATUSMENU);
|
||||
|
||||
//
|
||||
// Fan Animation
|
||||
//
|
||||
// Draws the whole heading image as a B/W bitmap rather than
|
||||
// drawing the elements separately.
|
||||
// This was done as an optimization, as it was slower to draw
|
||||
// multiple parts compared to a single bitmap.
|
||||
//
|
||||
// The bitmap:
|
||||
// - May be offset in X
|
||||
// - Includes all nozzle(s), bed(s), and the fan.
|
||||
//
|
||||
// TODO:
|
||||
//
|
||||
// - Only draw the whole header on the first
|
||||
// entry to the status screen. Nozzle, bed, and
|
||||
// fan outline bits don't change.
|
||||
//
|
||||
if (PAGE_UNDER(STATUS_SCREENHEIGHT + 1)) {
|
||||
|
||||
u8g.drawBitmapP(
|
||||
STATUS_SCREEN_X, STATUS_SCREEN_Y,
|
||||
(STATUS_SCREENWIDTH + 7) / 8, STATUS_SCREENHEIGHT,
|
||||
#if HAS_FAN0
|
||||
#if FAN_ANIM_FRAMES > 2
|
||||
fan_frame == 1 ? status_screen1_bmp :
|
||||
fan_frame == 2 ? status_screen2_bmp :
|
||||
#if FAN_ANIM_FRAMES > 3
|
||||
fan_frame == 3 ? status_screen3_bmp :
|
||||
#endif
|
||||
#else
|
||||
blink && fanSpeeds[0] ? status_screen1_bmp :
|
||||
#endif
|
||||
#endif
|
||||
status_screen0_bmp
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Temperature Graphics and Info
|
||||
//
|
||||
|
||||
if (PAGE_UNDER(28)) {
|
||||
// Extruders
|
||||
HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink);
|
||||
|
||||
// Heated bed
|
||||
#if HOTENDS < 4 && HAS_TEMP_BED
|
||||
_draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink);
|
||||
#endif
|
||||
|
||||
#if HAS_FAN0
|
||||
if (PAGE_CONTAINS(20, 27)) {
|
||||
// Fan
|
||||
const int16_t per = ((fanSpeeds[0] + 1) * 100) / 256;
|
||||
if (per) {
|
||||
u8g.setPrintPos(STATUS_SCREEN_FAN_TEXT_X, STATUS_SCREEN_FAN_TEXT_Y);
|
||||
lcd_print(itostr3(per));
|
||||
u8g.print('%');
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
//
|
||||
// SD Card Symbol
|
||||
//
|
||||
if (card.isFileOpen() && PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) {
|
||||
// Upper box
|
||||
u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); // 42-48 (or 41-47)
|
||||
// Right edge
|
||||
u8g.drawBox(50, 44 - (TALL_FONT_CORRECTION), 2, 5); // 44-48 (or 43-47)
|
||||
// Bottom hollow box
|
||||
u8g.drawFrame(42, 49 - (TALL_FONT_CORRECTION), 10, 4); // 49-52 (or 48-51)
|
||||
// Corner pixel
|
||||
u8g.drawPixel(50, 43 - (TALL_FONT_CORRECTION)); // 43 (or 42)
|
||||
}
|
||||
#endif // SDSUPPORT
|
||||
|
||||
#if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
//
|
||||
// Progress bar frame
|
||||
//
|
||||
#define PROGRESS_BAR_X 54
|
||||
#define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X)
|
||||
|
||||
if (PAGE_CONTAINS(49, 52 - (TALL_FONT_CORRECTION))) // 49-52 (or 49-51)
|
||||
u8g.drawFrame(
|
||||
PROGRESS_BAR_X, 49,
|
||||
PROGRESS_BAR_WIDTH, 4 - (TALL_FONT_CORRECTION)
|
||||
);
|
||||
|
||||
#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
const uint8_t progress_bar_percent = card.percentDone();
|
||||
#endif
|
||||
|
||||
if (progress_bar_percent > 1) {
|
||||
|
||||
//
|
||||
// Progress bar solid part
|
||||
//
|
||||
|
||||
if (PAGE_CONTAINS(50, 51 - (TALL_FONT_CORRECTION))) // 50-51 (or just 50)
|
||||
u8g.drawBox(
|
||||
PROGRESS_BAR_X + 1, 50,
|
||||
(uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 - (TALL_FONT_CORRECTION)
|
||||
);
|
||||
|
||||
//
|
||||
// SD Percent Complete
|
||||
//
|
||||
|
||||
#if ENABLED(DOGM_SD_PERCENT)
|
||||
if (PAGE_CONTAINS(41, 48)) {
|
||||
// Percent complete
|
||||
u8g.setPrintPos(55, 48);
|
||||
u8g.print(itostr3(progress_bar_percent));
|
||||
u8g.print('%');
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Elapsed Time
|
||||
//
|
||||
|
||||
#if DISABLED(DOGM_SD_PERCENT)
|
||||
#define SD_DURATION_X (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH / 2) - len * (DOG_CHAR_WIDTH / 2))
|
||||
#else
|
||||
#define SD_DURATION_X (LCD_PIXEL_WIDTH - len * DOG_CHAR_WIDTH)
|
||||
#endif
|
||||
|
||||
if (PAGE_CONTAINS(41, 48)) {
|
||||
char buffer[10];
|
||||
duration_t elapsed = print_job_timer.duration();
|
||||
bool has_days = (elapsed.value >= 60*60*24L);
|
||||
uint8_t len = elapsed.toDigital(buffer, has_days);
|
||||
u8g.setPrintPos(SD_DURATION_X, 48);
|
||||
lcd_print(buffer);
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY
|
||||
|
||||
//
|
||||
// XYZ Coordinates
|
||||
//
|
||||
|
||||
#if ENABLED(USE_SMALL_INFOFONT)
|
||||
#define INFO_FONT_HEIGHT 7
|
||||
#else
|
||||
#define INFO_FONT_HEIGHT 8
|
||||
#endif
|
||||
|
||||
#define XYZ_BASELINE (30 + INFO_FONT_HEIGHT)
|
||||
|
||||
#define X_LABEL_POS 3
|
||||
#define X_VALUE_POS 11
|
||||
#define XYZ_SPACING 40
|
||||
|
||||
#if ENABLED(XYZ_HOLLOW_FRAME)
|
||||
#define XYZ_FRAME_TOP 29
|
||||
#define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 3
|
||||
#else
|
||||
#define XYZ_FRAME_TOP 30
|
||||
#define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1
|
||||
#endif
|
||||
|
||||
// Before homing the axis letters are blinking 'X' <-> '?'.
|
||||
// When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
|
||||
// When everything is ok you see a constant 'X'.
|
||||
|
||||
static char xstring[5], ystring[5], zstring[7];
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
||||
static char wstring[5], mstring[4];
|
||||
#endif
|
||||
|
||||
// At the first page, regenerate the XYZ strings
|
||||
if (page.page == 0) {
|
||||
strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS])));
|
||||
strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS])));
|
||||
strcpy(zstring, ftostr52sp(FIXFLOAT(LOGICAL_Z_POSITION(current_position[Z_AXIS]))));
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY)
|
||||
strcpy(wstring, ftostr12ns(filament_width_meas));
|
||||
strcpy(mstring, itostr3(100.0 * (
|
||||
parser.volumetric_enabled
|
||||
? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]
|
||||
: planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]
|
||||
)
|
||||
));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) {
|
||||
|
||||
#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
|
||||
|
||||
if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_HEIGHT - 1), XYZ_BASELINE)) {
|
||||
|
||||
#if DISABLED(XYZ_HOLLOW_FRAME)
|
||||
u8g.setColorIndex(0); // white on black
|
||||
#endif
|
||||
|
||||
u8g.setPrintPos(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
|
||||
_draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
|
||||
u8g.setPrintPos(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
|
||||
lcd_print(xstring);
|
||||
|
||||
u8g.setPrintPos(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
|
||||
_draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
|
||||
u8g.setPrintPos(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
|
||||
lcd_print(ystring);
|
||||
|
||||
u8g.setPrintPos(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE);
|
||||
_draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
|
||||
u8g.setPrintPos(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE);
|
||||
lcd_print(zstring);
|
||||
|
||||
#if DISABLED(XYZ_HOLLOW_FRAME)
|
||||
u8g.setColorIndex(1); // black on white
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Feedrate
|
||||
//
|
||||
|
||||
if (PAGE_CONTAINS(51 - INFO_FONT_HEIGHT, 49)) {
|
||||
lcd_setFont(FONT_MENU);
|
||||
u8g.setPrintPos(3, 50);
|
||||
lcd_print(LCD_STR_FEEDRATE[0]);
|
||||
|
||||
lcd_setFont(FONT_STATUSMENU);
|
||||
u8g.setPrintPos(12, 50);
|
||||
lcd_print(itostr3(feedrate_percentage));
|
||||
u8g.print('%');
|
||||
|
||||
//
|
||||
// Filament sensor display if SD is disabled
|
||||
//
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT)
|
||||
u8g.setPrintPos(56, 50);
|
||||
lcd_print(wstring);
|
||||
u8g.setPrintPos(102, 50);
|
||||
lcd_print(mstring);
|
||||
u8g.print('%');
|
||||
lcd_setFont(FONT_MENU);
|
||||
u8g.setPrintPos(47, 50);
|
||||
lcd_print(LCD_STR_FILAM_DIA);
|
||||
u8g.setPrintPos(93, 50);
|
||||
lcd_print(LCD_STR_FILAM_MUL);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Status line
|
||||
//
|
||||
|
||||
#define STATUS_BASELINE (55 + INFO_FONT_HEIGHT)
|
||||
|
||||
if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_HEIGHT - 1), STATUS_BASELINE)) {
|
||||
u8g.setPrintPos(0, STATUS_BASELINE);
|
||||
|
||||
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
|
||||
if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line
|
||||
lcd_implementation_status_message(blink);
|
||||
}
|
||||
else {
|
||||
lcd_printPGM(PSTR(LCD_STR_FILAM_DIA));
|
||||
u8g.print(':');
|
||||
lcd_print(wstring);
|
||||
lcd_printPGM(PSTR(" " LCD_STR_FILAM_MUL));
|
||||
u8g.print(':');
|
||||
lcd_print(mstring);
|
||||
u8g.print('%');
|
||||
}
|
||||
#else
|
||||
lcd_implementation_status_message(blink);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ULTRALCD_IMPL_STATUS_SCREEN_DOGM_H
|
@ -0,0 +1,108 @@
|
||||
/**
|
||||
* Lightweight Status Screen for the RepRapDiscount Full
|
||||
* Graphics Smart Controller (ST7920-based 128x64 LCD)
|
||||
*
|
||||
* (c) 2017 Aleph Objects, Inc.
|
||||
*
|
||||
* The code in this page is free software: you can
|
||||
* redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License (GNU GPL) as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STATUS_SCREEN_LITE_ST7920_CLASS_H
|
||||
#define STATUS_SCREEN_LITE_ST7920_CLASS_H
|
||||
|
||||
#include "../../core/macros.h"
|
||||
|
||||
typedef const __FlashStringHelper *progmem_str;
|
||||
|
||||
class ST7920_Lite_Status_Screen {
|
||||
private:
|
||||
static struct st7920_state_t {
|
||||
uint8_t synced : 1; // Whether a sync has been sent
|
||||
uint8_t cmd : 1; // Whether the sync was cmd or data
|
||||
uint8_t extended : 1;
|
||||
uint8_t graphics : 1;
|
||||
uint8_t sa : 1;
|
||||
} current_bits;
|
||||
|
||||
static void cs();
|
||||
static void ncs();
|
||||
static void sync_cmd();
|
||||
static void sync_dat();
|
||||
static void write_byte(const uint8_t w);
|
||||
|
||||
FORCE_INLINE static void write_word(const uint16_t w) {
|
||||
write_byte((w >> 8) & 0xFF);
|
||||
write_byte((w >> 0) & 0xFF);
|
||||
}
|
||||
|
||||
static void cmd(const uint8_t cmd);
|
||||
static void begin_data();
|
||||
|
||||
static void write_str(const char *str);
|
||||
static void write_str(const char *str, const uint8_t len);
|
||||
static void write_str_P(const char * const str);
|
||||
static void write_str(progmem_str str);
|
||||
static void write_number(const uint8_t value, const uint8_t digits=3);
|
||||
|
||||
static void _extended_function_set(const bool extended, const bool graphics);
|
||||
static void _scroll_or_addr_select(const bool sa);
|
||||
static void reset_state_from_unknown();
|
||||
|
||||
static void home();
|
||||
static void display_status(const bool display_on, const bool cursor_on, const bool blink_on);
|
||||
static void extended_function_set(const bool extended);
|
||||
static void graphics(const bool graphics);
|
||||
static void entry_mode_select(const bool ac_increase, const bool shift);
|
||||
static void scroll_or_addr_select(const bool sa);
|
||||
static void set_ddram_address(const uint8_t addr);
|
||||
static void set_cgram_address(const uint8_t addr);
|
||||
static void set_gdram_address(const uint8_t x, const uint8_t y);
|
||||
|
||||
static void clear();
|
||||
static void clear_ddram();
|
||||
static void clear_gdram();
|
||||
|
||||
static void load_cgram_icon(const uint16_t addr, const void *data);
|
||||
static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data);
|
||||
|
||||
static uint8_t string_checksum(const char *str);
|
||||
|
||||
protected:
|
||||
static void draw_static_elements();
|
||||
static void draw_progress_bar(const uint8_t value);
|
||||
static void draw_fan_icon(const bool whichIcon);
|
||||
static void draw_heat_icon(const bool whichIcon, const bool heating);
|
||||
static void draw_extruder_1_temp(const uint8_t temp, const uint8_t target);
|
||||
static void draw_extruder_2_temp(const uint8_t temp, const uint8_t target);
|
||||
static void draw_bed_temp(const uint8_t temp, const uint8_t target);
|
||||
static void draw_fan_speed(const uint8_t value);
|
||||
static void draw_print_time(const uint32_t elapsed);
|
||||
static void draw_feedrate_percentage(const uint8_t percentage);
|
||||
static void draw_status_message(const char *str);
|
||||
static void draw_position(const float x, const float y, const float z, bool position_known = true);
|
||||
|
||||
static bool indicators_changed();
|
||||
static bool position_changed();
|
||||
static bool blink_changed();
|
||||
static bool status_changed();
|
||||
|
||||
static void update_indicators(const bool forceUpdate);
|
||||
static void update_position(const bool forceUpdate, bool resetChecksum);
|
||||
static void update_status_or_position(bool forceUpdate);
|
||||
static void update_progress(const bool forceUpdate);
|
||||
|
||||
public:
|
||||
static void update(const bool forceUpdate);
|
||||
static void on_entry();
|
||||
static void on_exit();
|
||||
static void clear_text_buffer();
|
||||
};
|
||||
|
||||
#endif // STATUS_SCREEN_LITE_ST7920_CLASS_H
|
@ -1,247 +0,0 @@
|
||||
/*
|
||||
* Lightweight Status Screen for the RepRapDiscount Full
|
||||
* Graphics Smart Controller (ST7920-based 128x64 LCD)
|
||||
*
|
||||
* (c) 2017 Aleph Objects, Inc.
|
||||
*
|
||||
* The code in this page is free software: you can
|
||||
* redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License (GNU GPL) as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option)
|
||||
* any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTRALCD_ST7920_LITE_STATUS_H
|
||||
#define ULTRALCD_ST7920_LITE_STATUS_H
|
||||
|
||||
class ST7920_Lite_Status_Screen {
|
||||
private:
|
||||
static struct st7920_state_t {
|
||||
uint8_t synced : 1; // Whether a sync has been sent
|
||||
uint8_t cmd : 1; // Whether the sync was cmd or data
|
||||
uint8_t extended : 1;
|
||||
uint8_t graphics : 1;
|
||||
uint8_t sa : 1;
|
||||
} current_bits;
|
||||
|
||||
static void cs();
|
||||
static void ncs();
|
||||
static void sync_cmd();
|
||||
static void sync_dat();
|
||||
static void write_byte(uint8_t w);
|
||||
|
||||
static void cmd(uint8_t cmd);
|
||||
static void begin_data();
|
||||
static void write_word(uint16_t w);
|
||||
static void write_str(const char *str);
|
||||
static void write_str(const char *str, uint8_t len);
|
||||
static void write_str_P(const char *str);
|
||||
static void write_str(progmem_str str);
|
||||
static void write_number(uint8_t value, uint8_t digits=3);
|
||||
|
||||
static void _extended_function_set(bool extended, bool graphics);
|
||||
static void _scroll_or_addr_select(bool sa);
|
||||
static void reset_state_from_unknown();
|
||||
|
||||
static void home();
|
||||
static void display_status(bool display_on, bool cursor_on, bool blink_on);
|
||||
static void extended_function_set(bool extended);
|
||||
static void graphics(bool graphics);
|
||||
static void entry_mode_select(bool ac_increase, bool shift);
|
||||
static void scroll_or_addr_select(bool sa);
|
||||
static void set_ddram_address(uint8_t addr);
|
||||
static void set_cgram_address(uint8_t addr);
|
||||
static void set_gdram_address(uint8_t x, uint8_t y);
|
||||
|
||||
static void clear();
|
||||
static void clear_ddram();
|
||||
static void clear_gdram();
|
||||
|
||||
static void load_cgram_icon(uint16_t addr, const void *data);
|
||||
static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data);
|
||||
|
||||
static uint8_t string_checksum(const char *str);
|
||||
|
||||
protected:
|
||||
static void draw_static_elements();
|
||||
static void draw_progress_bar(uint8_t value);
|
||||
static void draw_fan_icon(bool whichIcon);
|
||||
static void draw_heat_icon(bool whichIcon, bool heating);
|
||||
static void draw_extruder_1_temp(uint8_t temp, uint8_t target);
|
||||
static void draw_extruder_2_temp(uint8_t temp, uint8_t target);
|
||||
static void draw_bed_temp(uint8_t temp, uint8_t target);
|
||||
static void draw_fan_speed(uint8_t value);
|
||||
static void draw_print_time(uint32_t elapsed);
|
||||
static void draw_feedrate_percentage(uint8_t percentage);
|
||||
static void draw_status_message(const char *str);
|
||||
static void draw_position(const float x, const float y, const float z, bool position_known = true);
|
||||
|
||||
static bool indicators_changed();
|
||||
static bool position_changed();
|
||||
static bool blink_changed();
|
||||
static bool status_changed();
|
||||
|
||||
static void update_indicators(bool forceUpdate);
|
||||
static void update_position(bool forceUpdate, bool resetChecksum);
|
||||
static void update_status_or_position(bool forceUpdate);
|
||||
static void update_progress(bool forceUpdate);
|
||||
|
||||
public:
|
||||
static void update(bool forceUpdate);
|
||||
static void on_entry();
|
||||
static void on_exit();
|
||||
static void clear_text_buffer();
|
||||
};
|
||||
|
||||
/************************** ICON DEFINITIONS *************************************/
|
||||
|
||||
#define CGRAM_ICON_1_ADDR 0x00
|
||||
#define CGRAM_ICON_2_ADDR 0x10
|
||||
#define CGRAM_ICON_3_ADDR 0x20
|
||||
#define CGRAM_ICON_4_ADDR 0x30
|
||||
|
||||
#define CGRAM_ICON_1_WORD 0x00
|
||||
#define CGRAM_ICON_2_WORD 0x02
|
||||
#define CGRAM_ICON_3_WORD 0x04
|
||||
#define CGRAM_ICON_4_WORD 0x06
|
||||
|
||||
PROGMEM const uint16_t nozzle_icon[] = {
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000111111110000,
|
||||
0b0001111111111000,
|
||||
0b0001111111111000,
|
||||
0b0001111111111000,
|
||||
0b0000111111110000,
|
||||
0b0000111111110000,
|
||||
0b0001111111111000,
|
||||
0b0001111111111000,
|
||||
0b0001111111111000,
|
||||
0b0000011111100000,
|
||||
0b0000001111000000,
|
||||
0b0000000110000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000
|
||||
};
|
||||
|
||||
PROGMEM const uint16_t bed_icon[] = {
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0111111111111110,
|
||||
0b0111111111111110,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000
|
||||
};
|
||||
|
||||
PROGMEM const uint16_t heat1_icon[] = {
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0010001000100000,
|
||||
0b0001000100010000,
|
||||
0b0000100010001000,
|
||||
0b0000100010001000,
|
||||
0b0001000100010000,
|
||||
0b0010001000100000,
|
||||
0b0010001000100000,
|
||||
0b0001000100010000,
|
||||
0b0000100010001000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000
|
||||
};
|
||||
|
||||
PROGMEM const uint16_t heat2_icon[] = {
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000100010001000,
|
||||
0b0000100010001000,
|
||||
0b0001000100010000,
|
||||
0b0010001000100000,
|
||||
0b0010001000100000,
|
||||
0b0001000100010000,
|
||||
0b0000100010001000,
|
||||
0b0000100010001000,
|
||||
0b0001000100010000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000
|
||||
};
|
||||
|
||||
PROGMEM const uint16_t fan1_icon[] = {
|
||||
0b0000000000000000,
|
||||
0b0111111111111110,
|
||||
0b0111000000001110,
|
||||
0b0110001111000110,
|
||||
0b0100001111000010,
|
||||
0b0100000110000010,
|
||||
0b0101100000011010,
|
||||
0b0101110110111010,
|
||||
0b0101100000011010,
|
||||
0b0100000110000010,
|
||||
0b0100001111000010,
|
||||
0b0110001111000110,
|
||||
0b0111000000001110,
|
||||
0b0111111111111110,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000
|
||||
};
|
||||
|
||||
PROGMEM const uint16_t fan2_icon[] = {
|
||||
0b0000000000000000,
|
||||
0b0111111111111110,
|
||||
0b0111000000001110,
|
||||
0b0110010000100110,
|
||||
0b0100111001110010,
|
||||
0b0101111001111010,
|
||||
0b0100110000110010,
|
||||
0b0100000110000010,
|
||||
0b0100110000110010,
|
||||
0b0101111001111010,
|
||||
0b0100111001110010,
|
||||
0b0110010000100110,
|
||||
0b0111000000001110,
|
||||
0b0111111111111110,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000
|
||||
};
|
||||
|
||||
PROGMEM const uint16_t feedrate_icon[] = {
|
||||
0b0000000000000000,
|
||||
0b0111111000000000,
|
||||
0b0100000000000000,
|
||||
0b0100000000000000,
|
||||
0b0100000000000000,
|
||||
0b0111111011111000,
|
||||
0b0100000010000100,
|
||||
0b0100000010000100,
|
||||
0b0100000010000100,
|
||||
0b0100000011111000,
|
||||
0b0000000010001000,
|
||||
0b0000000010000100,
|
||||
0b0000000010000100,
|
||||
0b0000000010000010,
|
||||
0b0000000000000000,
|
||||
0b0000000000000000
|
||||
};
|
||||
|
||||
static void lcd_implementation_status_screen();
|
||||
static void lcd_in_status(bool inStatus);
|
||||
|
||||
#endif // ULTRALCD_ST7920_LITE_STATUS_H
|
Loading…
Reference in New Issue