Apply ENABLED in ExiUI / FTDI

This commit is contained in:
Scott Lahteine 2020-12-23 15:33:34 -06:00
parent a24298f625
commit fa89a7b0bc
41 changed files with 91 additions and 165 deletions

View file

@ -45,7 +45,7 @@
static_assert(thfp + thb + Hsize == th, "Mismatch in display th"); \
static_assert(tvfp + tvb + Vsize == tv, "Mismatch in display tv");
#ifdef TOUCH_UI_320x240
#if ENABLED(TOUCH_UI_320x240)
namespace FTDI {
constexpr uint8_t Pclk = 8;
constexpr uint8_t Pclkpol = 0;

View file

@ -21,7 +21,7 @@
#include "ftdi_extended.h"
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
CommandProcessor::btn_style_func_t *CommandProcessor::_btn_style_callback = CommandProcessor::default_button_style_func;
bool CommandProcessor::is_tracking = false;

View file

@ -312,12 +312,12 @@ class CommandProcessor : public CLCD::CommandFifo {
int8_t apply_fit_text(int16_t w, int16_t h, T text) {
using namespace FTDI;
int8_t font = _font;
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
const bool is_utf8 = has_utf8_chars(text);
#endif
for (;font > 26;) {
int16_t width, height;
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
if (is_utf8) {
width = get_utf8_text_width(text, font_size_t::from_romfont(font));
height = font_size_t::from_romfont(font).get_height();
@ -345,7 +345,7 @@ class CommandProcessor : public CLCD::CommandFifo {
template<typename T>
uint16_t text_width(T text) {
using namespace FTDI;
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
if (has_utf8_chars(text))
return get_utf8_text_width(text, font_size_t::from_romfont(_font));
#endif
@ -362,7 +362,7 @@ class CommandProcessor : public CLCD::CommandFifo {
#else
const int8_t font = _font;
#endif
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
if (has_utf8_chars(text))
draw_utf8_text(*this, x, y, text, font_size_t::from_romfont(font), options);
else
@ -401,7 +401,7 @@ class CommandProcessor : public CLCD::CommandFifo {
const int8_t font = _font;
#endif
CLCD::CommandFifo::button(x, y, w, h, font, options);
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
if (has_utf8_chars(text)) {
CLCD::CommandFifo::str(F(""));
apply_text_alignment(x, y, w, h, OPT_CENTER);

View file

@ -22,7 +22,7 @@
#include "ftdi_extended.h"
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
/* The Display List Cache mechanism stores the display list corresponding
* to a menu into RAM_G so that on subsequent calls drawing the menu does

View file

@ -22,7 +22,7 @@
#include "ftdi_extended.h"
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
using namespace FTDI;
enum {

View file

@ -29,7 +29,7 @@
#define FTDI_EXTENDED
#endif
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
#include "unicode/font_size_t.h"
#include "unicode/unicode.h"
#include "unicode/standard_char_set.h"

View file

@ -88,7 +88,7 @@
}
namespace FTDI {
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
constexpr uint16_t display_width = Vsize;
constexpr uint16_t display_height = Hsize;
#else

View file

@ -66,7 +66,7 @@ namespace FTDI {
cmd.cmd(STENCIL_FUNC(STENCIL_FUNC_ALWAYS, 255, 255));
// Drawing the edge strip along scan lines
// seems to yield the best performance
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
path_initiator = EDGE_STRIP_B;
#else
path_initiator = EDGE_STRIP_R;

View file

@ -21,7 +21,7 @@
#include "ftdi_extended.h"
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
/********************** VIRTUAL DISPATCH DATA TYPE ******************************/

View file

@ -158,7 +158,7 @@ class UncachedScreen {
using namespace FTDI;
CommandProcessor cmd;
cmd.cmd(CMD_DLSTART);
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_bitmaps(cmd);
#endif
@ -199,7 +199,7 @@ class CachedScreen {
CommandProcessor cmd;
cmd.cmd(CMD_DLSTART);
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_bitmaps(cmd);
#endif
current_screen.onRedraw(BACKGROUND);
@ -222,7 +222,7 @@ class CachedScreen {
dlcache.append();
}
else {
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_bitmaps(cmd);
#endif
current_screen.onRedraw(BACKGROUND);

View file

@ -21,7 +21,7 @@
#include "ftdi_extended.h"
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
namespace FTDI {
SoundPlayer sound; // Global sound player object

View file

@ -21,7 +21,7 @@
#include "ftdi_extended.h"
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
namespace FTDI {
/**
@ -103,7 +103,7 @@ namespace FTDI {
if (line[line_len - 1] == '\n' || line[line_len - 1] == ' ')
line[line_len - 1] = 0;
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
if (has_utf8_chars(line)) {
draw_utf8_text(cmd, x + dx, y + dy, line, fm.fs, options & ~OPT_CENTERY);
} else

View file

@ -21,7 +21,7 @@
#include "ftdi_extended.h"
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
namespace FTDI {
@ -60,7 +60,7 @@ namespace FTDI {
}
cmd.apply_text_alignment(x, y, w, h, options);
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
if (has_utf8_chars(str)) {
draw_utf8_text(cmd, x, y, str, font_size_t::from_romfont(font), options);
} else

View file

@ -21,15 +21,11 @@
#include "ftdi_extended.h"
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
bool tiny_timer_t::elapsed(tiny_time_t duration) {
uint8_t now = tiny_time_t::tiny_time(
#ifdef __MARLIN_FIRMWARE__
ExtUI::safe_millis()
#else
millis()
#endif
TERN(__MARLIN_FIRMWARE__, ExtUI::safe_millis(), millis())
);
uint8_t elapsed = now - _start;
return elapsed >= duration._duration;
@ -37,11 +33,7 @@ bool tiny_timer_t::elapsed(tiny_time_t duration) {
void tiny_timer_t::start() {
_start = tiny_time_t::tiny_time(
#ifdef __MARLIN_FIRMWARE__
ExtUI::safe_millis()
#else
millis()
#endif
TERN(__MARLIN_FIRMWARE__, ExtUI::safe_millis(), millis())
);
}
#endif // FTDI_EXTENDED

View file

@ -21,7 +21,7 @@
#include "../ftdi_extended.h"
#ifdef FTDI_EXTENDED
#if ENABLED(FTDI_EXTENDED)
namespace FTDI {

View file

@ -24,7 +24,7 @@
class CommandProcessor;
namespace FTDI {
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
typedef uint16_t utf8_char_t;
/**
@ -75,14 +75,14 @@ namespace FTDI {
// Similar to CLCD::FontMetrics, but can be used with UTF8 encoded strings.
struct FontMetrics {
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
font_size_t fs;
#else
CLCD::FontMetrics fm;
#endif
inline void load(uint8_t rom_font_size) {
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
fs = font_size_t::from_romfont(rom_font_size);
#else
fm.load(rom_font_size);
@ -90,7 +90,7 @@ namespace FTDI {
}
inline uint16_t get_char_width(utf8_char_t c) const {
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
return get_utf8_char_width(c, fs);
#else
return fm.char_widths[(uint8_t)c];
@ -98,7 +98,7 @@ namespace FTDI {
}
inline uint8_t get_height() const {
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
return fs.get_height();
#else
return fm.height;

View file

@ -146,7 +146,7 @@ namespace Language_en {
PROGMEM Language_Str MSG_LEVELING = u8"Leveling";
PROGMEM Language_Str MSG_SHOW_MESH = u8"Show Bed Mesh";
#ifdef TOUCH_UI_LULZBOT_BIO
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
PROGMEM Language_Str MSG_MOVE_TO_HOME = u8"Move to Home";
PROGMEM Language_Str MSG_RAISE_PLUNGER = u8"Raise Plunger";
PROGMEM Language_Str MSG_RELEASE_XY_AXIS = u8"Release X and Y Axis";

View file

@ -37,7 +37,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
.cmd(CLEAR(true,true,true));
}
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#if EITHER(HAS_MULTI_HOTEND, SENSORLESS_HOMING)
#define GRID_ROWS 9
#else

View file

@ -30,7 +30,7 @@
using namespace FTDI;
using namespace Theme;
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 13
#define GRID_ROWS 10
#define LAYOUT_FONT font_small
@ -53,7 +53,7 @@ BaseNumericAdjustmentScreen::widgets_t::widgets_t(draw_mode_t what) : _what(what
cmd.font(font_medium);
_button(cmd, 1,
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
BTN_POS(1,10), BTN_SIZE(13,1),
#else
BTN_POS(15,7), BTN_SIZE(4,1),
@ -129,7 +129,7 @@ void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) {
cmd.font(font_medium)
.tag(0)
.text(
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
BTN_POS(1, _line), BTN_SIZE(12,1),
#else
BTN_POS(5, _line), BTN_SIZE(8,1),
@ -141,7 +141,7 @@ void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) {
_line++;
}
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#ifdef TOUCH_UI_800x480
#undef EDGE_R
#define EDGE_R 20
@ -172,7 +172,7 @@ void BaseNumericAdjustmentScreen::widgets_t::_draw_increment_btn(CommandProcesso
const bool highlight = (_what & FOREGROUND) && (increment == tag);
switch (pos) {
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
case 0: _button(cmd, tag, BTN_POS(5,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break;
case 1: _button(cmd, tag, BTN_POS(7,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break;
case 2: _button(cmd, tag, BTN_POS(9,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break;
@ -192,7 +192,7 @@ void BaseNumericAdjustmentScreen::widgets_t::increments() {
if (_what & BACKGROUND) {
_button_style(cmd, TEXT_LABEL);
cmd.tag(0).text(
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
BTN_POS(1, _line), BTN_SIZE(4,1),
#else
BTN_POS(15, 1), BTN_SIZE(4,1),
@ -205,7 +205,7 @@ void BaseNumericAdjustmentScreen::widgets_t::increments() {
_draw_increment_btn(cmd, _line+1, 244 - _decimals);
_draw_increment_btn(cmd, _line+1, 243 - _decimals);
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
_line++;
#endif
}
@ -308,7 +308,7 @@ void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, progmem_str lab
_button_style(cmd, TEXT_LABEL);
cmd.font(font_small)
.text(
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
BTN_POS(1, _line), BTN_SIZE( 8,1),
#else
BTN_POS(1, _line), BTN_SIZE(10,1),
@ -323,7 +323,7 @@ void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, progmem_str lab
.enabled(is_enabled)
.font(font_small)
.toggle2(
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
BTN_POS( 9,_line), BTN_SIZE(5,1),
#else
BTN_POS(10,_line), BTN_SIZE(4,1),

View file

@ -30,7 +30,7 @@ using namespace FTDI;
using namespace Theme;
using namespace ExtUI;
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 2
#define GRID_ROWS 10

View file

@ -73,7 +73,7 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
// The LulzBot Bio shows the temperature for
// the bed.
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
// Draw touch surfaces
ui.bounds(POLY(target_temp), x, y, h, v);
cmd.rectangle(x, y, h, v);
@ -95,7 +95,7 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
.cmd(COLOR_RGB(bg_text_enabled))
.icon (x, y, h, v, Bed_Heat_Icon_Info, icon_scale * 2);
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_bitmaps(cmd); // Restore font bitmap handles
#endif
}
@ -105,7 +105,7 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
cmd.cmd(COLOR_RGB(bg_text_enabled));
cmd.font(font_medium);
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0)
format_temp(str, getTargetTemp_celsius(BED));
else
@ -204,7 +204,7 @@ void StatusScreen::draw_fine_motion(draw_mode_t what) {
PolyUI ui(cmd, what);
cmd.font(
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
font_medium
#else
font_small
@ -273,7 +273,7 @@ void StatusScreen::loadBitmaps() {
CLCD::mem_write_pgm(base + Bed_Heat_Icon_Info.RAMG_offset, Bed_Heat_Icon, sizeof(Bed_Heat_Icon));
// Load fonts for internationalization
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_data(base + UTF8_FONT_OFFSET);
#endif
}

View file

@ -30,14 +30,14 @@
#include "../ftdi_eve_lib/extras/poly_ui.h"
#include "../archim2-flash/flash_storage.h"
#ifdef SHOW_CUSTOM_BOOTSCREEN
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(SHOW_CUSTOM_BOOTSCREEN)
#if ENABLED(TOUCH_UI_PORTRAIT)
#include "../theme/bootscreen_logo_portrait.h"
#else
#include "../theme/_bootscreen_landscape.h"
#endif
#else
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#include "../theme/marlin_bootscreen_portrait.h"
#else
#include "../theme/marlin_bootscreen_landscape.h"
@ -92,7 +92,7 @@ void BootScreen::onIdle() {
StatusScreen::loadBitmaps();
#ifdef TOUCH_UI_LULZBOT_BIO
#if ENABLED(TOUCH_UI_LULZBOT_BIO)
GOTO_SCREEN(BioConfirmHomeXYZ);
current_screen.forget();
PUSH_SCREEN(StatusScreen);

View file

@ -101,7 +101,7 @@ void ChangeFilamentScreen::onExit() {
void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
CommandProcessor cmd;
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 2
#define GRID_ROWS 11
#else
@ -114,13 +114,13 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
.cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled))
.tag(0)
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
.font(font_large)
#else
.font(font_medium)
#endif
.text(BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_EXTRUDER_SELECTION))
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
.text(BTN_POS(1,7), BTN_SIZE(1,1), GET_TEXT_F(MSG_CURRENT_TEMPERATURE))
#else
.text(BTN_POS(3,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_CURRENT_TEMPERATURE))
@ -142,14 +142,14 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
const rgb_t tcol = getWarmColor(getActualTemp_celsius(e), COOL_TEMP, LOW_TEMP, MED_TEMP, HIGH_TEMP);
cmd.cmd(COLOR_RGB(tcol))
.tag(15)
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
.rectangle(BTN_POS(2,7), BTN_SIZE(1,1))
#else
.rectangle(BTN_POS(3,2), BTN_SIZE(2,1))
#endif
.cmd(COLOR_RGB(tcol.luminance() > 128 ? 0x000000 : 0xFFFFFF))
.font(font_medium)
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
.text(BTN_POS(2,7), BTN_SIZE(1,1), e_str)
#else
.text(BTN_POS(3,2), BTN_SIZE(2,1), e_str)
@ -177,7 +177,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11;
#endif
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
cmd.font(font_large)
#else
cmd.font(font_medium)
@ -198,7 +198,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
cmd.font(
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
font_large
#else
font_small
@ -227,7 +227,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
.cmd(COLOR_MASK(1,1,1,1))
.cmd(COLOR_RGB(t_ok ? bg_text_enabled : bg_text_disabled))
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
.font(font_large)
.tag(0) .text (BTN_POS(1,8), BTN_SIZE(1,1), GET_TEXT_F(MSG_UNLOAD_FILAMENT))
.text (BTN_POS(2,8), BTN_SIZE(1,1), GET_TEXT_F(MSG_LOAD_FILAMENT))

View file

@ -45,7 +45,7 @@ void StatusScreen::loadBitmaps() {
constexpr uint32_t base = ftdi_memory_map::RAM_G;
// Load fonts for internationalization
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_data(base + UTF8_FONT_OFFSET);
#endif
}
@ -111,7 +111,7 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
ui.bounds(POLY(h3_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHAMBER));
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_bitmaps(cmd); // Restore font bitmap handles
#endif
}

View file

@ -57,7 +57,7 @@ void CustomUserMenus::onRedraw(draw_mode_t what) {
#define _MORE_THAN_TEN 0
#endif
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_ROWS 11
#define GRID_COLS (1 + _MORE_THAN_TEN)
#define USER_ITEM_POS(N) BTN_POS((1+((N-1)/10)), ((N-1) % 10 + 1)), BTN_SIZE(1,1)

View file

@ -52,7 +52,7 @@ void DeveloperMenu::onRedraw(draw_mode_t what) {
#endif
cmd.cmd(COLOR_RGB(bg_text_enabled));
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_ROWS 10
#define GRID_COLS 1
cmd.font(font_large) .text ( BTN_POS(1,1), BTN_SIZE(1,1), F("Developer Menu"))

View file

@ -53,7 +53,7 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) {
#define PIN_DISABLED(X,Y,LABEL,PIN) cmd.enabled(0).PIN_BTN(X,Y,PIN,LABEL);
cmd.font(
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
font_large
#else
font_medium

View file

@ -30,7 +30,7 @@ using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_ROWS 9
#define GRID_COLS 2
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)

View file

@ -67,7 +67,7 @@ uint16_t FilesScreen::getFileForTag(uint8_t tag) {
return screen_data.FilesScreen.cur_page * files_per_page + tag - 2;
}
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 6
#define GRID_ROWS (files_per_page + header_h + footer_h)
#else
@ -151,7 +151,7 @@ void FilesScreen::drawHeader() {
void FilesScreen::drawFooter() {
#undef MARGIN_T
#undef MARGIN_B
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define MARGIN_T 15
#define MARGIN_B 5
#else

View file

@ -58,7 +58,7 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) {
if (what & BACKGROUND) {
#define GRID_COLS 4
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_ROWS 7
#else
#define GRID_ROWS 6
@ -86,7 +86,7 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) {
}
if (what & FOREGROUND) {
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
constexpr uint8_t w = 2;
#else
constexpr uint8_t w = 1;
@ -106,7 +106,7 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) {
#endif
#undef EDGE_R
#define EDGE_R 0
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
.colors(normal_btn)
.tag(6).button (BTN_POS(1,6), BTN_SIZE(4,1), GET_TEXT_F(MSG_SOUNDS))
.colors(action_btn)

View file

@ -84,7 +84,7 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) {
}
if (what & FOREGROUND) {
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
constexpr uint8_t w = 2;
#else
constexpr uint8_t w = 1;

View file

@ -34,7 +34,7 @@ using namespace FTDI;
using namespace ExtUI;
using namespace Theme;
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_ROWS 9
#define GRID_COLS 2
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)

View file

@ -50,7 +50,7 @@ void LockScreen::onRedraw(draw_mode_t what) {
}
if (what & FOREGROUND) {
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 1
#define GRID_ROWS 10
#else
@ -81,7 +81,7 @@ void LockScreen::onRedraw(draw_mode_t what) {
const uint8_t pressed = EventLoop::get_pressed_tag();
cmd.font(font_large)
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
.text(BTN_POS(1,2), BTN_SIZE(1,1), message)
.font(font_xlarge)
.text(BTN_POS(1,4), BTN_SIZE(1,1), screen_data.LockScreen.passcode)

View file

@ -1,25 +1,3 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
*
*/
/*****************
* main_menu.cpp *
*****************/
@ -59,7 +37,7 @@ void MainMenu::onRedraw(draw_mode_t what) {
.cmd(CLEAR(true,true,true));
}
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_ROWS 8
#define GRID_COLS 2
#define ABOUT_PRINTER_POS BTN_POS(1,1), BTN_SIZE(2,1)
@ -129,15 +107,15 @@ bool MainMenu::onTouchEnd(uint8_t tag) {
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
case 2: SpinnerDialogBox::enqueueAndWait_P(F("G28")); break;
#if ENABLED(NOZZLE_CLEAN_FEATURE)
case 3: injectCommands_P(PSTR("G12")); GOTO_SCREEN(StatusScreen); break;
case 3: injectCommands_P(PSTR("G12")); GOTO_SCREEN(StatusScreen); break;
#endif
case 4: GOTO_SCREEN(MoveAxisScreen); break;
case 5: injectCommands_P(PSTR("M84")); break;
case 6: GOTO_SCREEN(TemperatureScreen); break;
case 7: GOTO_SCREEN(ChangeFilamentScreen); break;
case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
#ifdef HAS_LEVELING
case 9: GOTO_SCREEN(LevelingMenu); break;
#if HAS_LEVELING
case 9: GOTO_SCREEN(LevelingMenu); break;
#endif
case 10: GOTO_SCREEN(AboutScreen); break;
#if ENABLED(CUSTOM_USER_MENUS)

View file

@ -1,25 +1,3 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
*
*/
/***************
* screens.cpp *
***************/

View file

@ -1,25 +1,3 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
*
*/
/*************
* screens.h *
*************/
@ -767,7 +745,7 @@ class LockScreen : public BaseScreen, public CachedScreen<LOCK_SCREEN_CACHE> {
class FilesScreen : public BaseScreen, public CachedScreen<FILES_SCREEN_CACHE, FILE_SCREEN_DL_SIZE> {
private:
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
static constexpr uint8_t header_h = 2;
static constexpr uint8_t footer_h = 2;
static constexpr uint8_t files_per_page = 11;

View file

@ -32,7 +32,7 @@
using namespace FTDI;
using namespace Theme;
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_ROWS 8
#else
#define GRID_ROWS 8
@ -43,7 +43,7 @@ void StatusScreen::draw_axis_position(draw_mode_t what) {
#define GRID_COLS 3
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define X_LBL_POS BTN_POS(1,5), BTN_SIZE(1,1)
#define Y_LBL_POS BTN_POS(1,6), BTN_SIZE(1,1)
#define Z_LBL_POS BTN_POS(1,7), BTN_SIZE(1,1)
@ -111,7 +111,7 @@ void StatusScreen::draw_axis_position(draw_mode_t what) {
#undef GRID_COLS
}
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 8
#else
#define GRID_COLS 12
@ -164,7 +164,7 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
.cmd (BITMAP_SIZE (Fan_Icon_Info))
.icon(ICON_POS(FAN_POS), Fan_Icon_Info, icon_scale);
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_bitmaps(cmd); // Restore font bitmap handles
#endif
}
@ -334,7 +334,7 @@ void StatusScreen::loadBitmaps() {
CLCD::mem_write_pgm(base + Fan_Icon_Info.RAMG_offset, Fan_Icon, sizeof(Fan_Icon));
// Load fonts for internationalization
#ifdef TOUCH_UI_USE_UTF8
#if ENABLED(TOUCH_UI_USE_UTF8)
load_utf8_data(base + UTF8_FONT_OFFSET);
#endif
}

View file

@ -41,7 +41,7 @@ void TemperatureScreen::onRedraw(draw_mode_t what) {
w.heading(GET_TEXT_F(MSG_TEMPERATURE));
w.button(30, GET_TEXT_F(MSG_COOLDOWN));
#ifndef NO_TOOLHEAD_HEATER_GCODE
#ifdef TOUCH_UI_COCOA_PRESS
#if ENABLED(TOUCH_UI_COCOA_PRESS)
w.adjuster( 2, GET_TEXT_F(MSG_NOZZLE), getTargetTemp_celsius(E0));
w.adjuster( 4, GET_TEXT_F(MSG_BODY), getTargetTemp_celsius(E1));
#if ENABLED(COCOA_PRESS_EXTRA_HEATER)

View file

@ -38,7 +38,7 @@ void TuneMenu::onRedraw(draw_mode_t what) {
.cmd(CLEAR(true,true,true));
}
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_ROWS 9
#define GRID_COLS 2
#define TEMPERATURE_POS BTN_POS(1,1), BTN_SIZE(2,1)

View file

@ -51,7 +51,7 @@ void WidgetsScreen::onRedraw(draw_mode_t) {
const uint16_t m = (slider_val*12*60/0xFFFFU)%60;
const uint16_t s = (slider_val*12*60*60/0xFFFFU)%60;
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
#define GRID_COLS 3
#define GRID_ROWS 8
cmd.font(font_large)
@ -113,7 +113,7 @@ bool WidgetsScreen::onTouchStart(uint8_t tag) {
CommandProcessor cmd;
switch (tag) {
case 1: GOTO_PREVIOUS(); break;
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
case 2: cmd.track_circular (BTN_POS(1,2), BTN_SIZE(1,2), 2).execute(); break;
case 4: cmd.track_linear (BTN_POS(2,3), BTN_SIZE(2,1), 4).execute(); break;
case 5: cmd.track_linear (BTN_POS(2,4), BTN_SIZE(2,1), 5).execute(); break;

View file

@ -24,7 +24,7 @@
namespace Theme {
#ifdef TOUCH_UI_800x480
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
constexpr int16_t font_tiny = 26;
constexpr int16_t font_xsmall = 28;
constexpr int16_t font_small = 29;
@ -41,7 +41,7 @@ namespace Theme {
#endif
constexpr float icon_scale = 1.0;
#elif defined(TOUCH_UI_480x272)
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
constexpr int16_t font_tiny = 26;
constexpr int16_t font_xsmall = 26;
constexpr int16_t font_small = 26;
@ -59,7 +59,7 @@ namespace Theme {
constexpr float icon_scale = 0.6;
#endif
#elif defined(TOUCH_UI_320x240)
#ifdef TOUCH_UI_PORTRAIT
#if ENABLED(TOUCH_UI_PORTRAIT)
constexpr int16_t font_tiny = 26;
constexpr int16_t font_xsmall = 26;
constexpr int16_t font_small = 26;