FTDI whitespace tweaks

This commit is contained in:
Scott Lahteine 2020-06-11 15:19:28 -05:00
parent bbe8400c5a
commit fe969ec6d3
19 changed files with 270 additions and 266 deletions

View file

@ -497,7 +497,8 @@ bool UIFlashStorage::is_present = false;
if (verifyOk) {
SERIAL_ECHOLNPGM("DONE");
return SUCCESS;
} else {
}
else {
SERIAL_ECHOLNPGM("FAIL");
return VERIFY_ERROR;
}

View file

@ -932,7 +932,8 @@ template <class T> bool CLCD::CommandFifo::_write_unaligned(T data, uint16_t len
if (command_read_ptr <= command_write_ptr) {
bytes_tail = 4096U - command_write_ptr;
bytes_head = command_read_ptr;
} else {
}
else {
bytes_tail = command_read_ptr - command_write_ptr;
bytes_head = 0;
}

View file

@ -78,7 +78,8 @@ class CommandProcessor : public CLCD::CommandFifo {
y += (h - th) / 2;
w -= tracker ? th * 5.0 : th * 2;
h = th;
} else {
}
else {
x += (w - th) / 2;
y += tracker ? th * 2.5 : th;
w = th;
@ -254,7 +255,8 @@ class CommandProcessor : public CLCD::CommandFifo {
if (is_tracking) {
if (FTDI::EventLoop::is_touch_held()) {
return CLCD::get_tracker(value);
} else {
}
else {
CLCD::CommandFifo::track(0, 0, 0, 0, 0);
CLCD::CommandFifo::execute();
is_tracking = false;
@ -319,7 +321,8 @@ class CommandProcessor : public CLCD::CommandFifo {
if (is_utf8) {
width = get_utf8_text_width(text, font_size_t::from_romfont(font));
height = font_size_t::from_romfont(font).get_height();
} else
}
else
#endif
{
CLCD::FontMetrics fm(font);

View file

@ -140,15 +140,12 @@ namespace FTDI {
if (UIData::flags.bits.touch_start_sound) sound.play(press_sound);
}
if (lastScreen != current_screen.getScreen()) {
// In the case in which a touch event triggered a new screen to be
// drawn, we don't issue a touchEnd since it would be sent to the
// wrong screen.
UIData::flags.bits.ignore_unpress = true;
} else {
UIData::flags.bits.ignore_unpress = false;
UIData::flags.bits.ignore_unpress = (lastScreen != current_screen.getScreen());
}
} else {
else {
touch_timer.start();
}
break;

View file

@ -209,7 +209,8 @@ class CachedScreen {
if (dlcache.has_data()) {
dlcache.append();
} else {
}
else {
#ifdef TOUCH_UI_USE_UTF8
load_utf8_bitmaps(cmd);
#endif

View file

@ -98,7 +98,8 @@ namespace FTDI {
if (ms == 0 && fx == SILENCE && nt == END_SONG) {
sequence = 0;
play(SILENCE, REST);
} else {
}
else {
wait = ms;
timer.start();
play(fx, nt);

View file

@ -45,7 +45,8 @@ namespace FTDI {
cmd.cmd(BITMAP_HANDLE(handle));
cmd.cmd(CELL(cell));
cmd.cmd(VERTEX2F(x * 16, y * 16));
} else {
}
else {
cmd.cmd(VERTEX2II(x, y, handle, cell));
}
}

View file

@ -21,7 +21,7 @@
#include "../ftdi_extended.h"
#if defined(FTDI_EXTENDED) && ENABLED(TOUCH_UI_USE_UTF8)
#if BOTH(FTDI_EXTENDED, TOUCH_UI_USE_UTF8)
namespace FTDI {
// Returns the height of a standard FTDI romfont

View file

@ -21,7 +21,7 @@
#include "../ftdi_extended.h"
#if defined(FTDI_EXTENDED) && ENABLED(TOUCH_UI_USE_UTF8)
#if BOTH(FTDI_EXTENDED, TOUCH_UI_USE_UTF8)
constexpr static uint8_t std_font = 31;

View file

@ -21,7 +21,7 @@
#include "../ftdi_extended.h"
#if defined(FTDI_EXTENDED) && ENABLED(TOUCH_UI_USE_UTF8)
#if BOTH(FTDI_EXTENDED, TOUCH_UI_USE_UTF8)
using namespace FTDI;

View file

@ -21,7 +21,7 @@
#include "../ftdi_extended.h"
#if defined(FTDI_EXTENDED) && BOTH(TOUCH_UI_USE_UTF8, TOUCH_UI_UTF8_WESTERN_CHARSET)
#if ALL(FTDI_EXTENDED, TOUCH_UI_USE_UTF8, TOUCH_UI_UTF8_WESTERN_CHARSET)
#include "western_char_set_bitmap_31.h"
@ -104,22 +104,22 @@
/* Centerline of characters that can take accents */
constexpr int8_t mid_a = 12;
constexpr int8_t mid_e = 12;
constexpr int8_t mid_i = 5;
constexpr int8_t mid_o = 12;
constexpr int8_t mid_u = 12;
constexpr int8_t mid_y = 11;
constexpr int8_t mid_n = 12;
constexpr int8_t mid_c = 12;
constexpr int8_t mid_A = 13;
constexpr int8_t mid_E = 13;
constexpr int8_t mid_I = 6;
constexpr int8_t mid_O = 14;
constexpr int8_t mid_U = 14;
constexpr int8_t mid_Y = 13;
constexpr int8_t mid_N = 15;
constexpr int8_t mid_C = 13;
constexpr int8_t mid_a = 12,
mid_e = 12,
mid_i = 5,
mid_o = 12,
mid_u = 12,
mid_y = 11,
mid_n = 12,
mid_c = 12,
mid_A = 13,
mid_E = 13,
mid_I = 6,
mid_O = 14,
mid_U = 14,
mid_Y = 13,
mid_N = 15,
mid_C = 13;
/* Centerline of accent glyphs */
@ -424,7 +424,8 @@
accent_char = 0;
if (c == UTF8('°'))
x -= fs.scale(deg_sign_leading);
} else {
}
else {
// Regular character with accent:
accent_dx = alt_data - mid_accent;
accent_dy = isupper(std_char) ? -7 : 0;

View file

@ -92,7 +92,8 @@ class PolyReader {
close_loop();
else
p = NULL;
} else {
}
else {
x = pgm_read_word_far(p++);
if (x == eol)
close_loop();
@ -225,7 +226,8 @@ class DeduplicatedPolyReader : public POLY_READER {
} while (POLY_READER::x == last_x && POLY_READER::y == last_y && !POLY_READER::end_of_loop());
if (POLY_READER::end_of_loop()) {
last_x = last_y = eol;
} else {
}
else {
last_x = POLY_READER::x;
last_y = POLY_READER::y;
}

View file

@ -102,11 +102,10 @@ bool BioPrintingDialogBox::onTouchEnd(uint8_t tag) {
case 1: GOTO_SCREEN(FeedratePercentScreen); break;
case 2: GOTO_SCREEN(TuneMenu); break;
case 3:
if (isPrinting()) {
if (isPrinting())
GOTO_SCREEN(ConfirmAbortPrintDialogBox);
} else {
else
GOTO_SCREEN(StatusScreen);
}
break;
default: return false;
}
@ -136,10 +135,9 @@ void BioPrintingDialogBox::setStatusMessage(const char* message) {
SERIAL_ECHOLNPAIR("New status message: ", message);
#endif
if (AT_SCREEN(BioPrintingDialogBox)) {
if (AT_SCREEN(BioPrintingDialogBox))
current_screen.onRefresh();
}
}
void BioPrintingDialogBox::onIdle() {
reset_menu_timeout();

View file

@ -114,7 +114,8 @@ void FilesScreen::drawFileList() {
for(uint8_t i = 0; i < files_per_page; i++, fileIndex++) {
if (files.seek(fileIndex)) {
drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false);
} else {
}
else {
break;
}
}

View file

@ -72,19 +72,11 @@ void LockScreen::onRedraw(draw_mode_t what) {
message = GET_TEXT_F(MSG_PASSCODE_ACCEPTED);
break;
default:
if (passcode == 0) {
message = GET_TEXT_F(MSG_PASSCODE_SELECT);
} else {
message = GET_TEXT_F(MSG_PASSCODE_REQUEST);
}
message = passcode ? GET_TEXT_F(MSG_PASSCODE_REQUEST) : GET_TEXT_F(MSG_PASSCODE_SELECT);
}
message_style() = '\0'; // Terminate the string.
#ifdef TOUCH_UI_PORTRAIT
constexpr uint8_t l = 6;
#else
constexpr uint8_t l = 3;
#endif
constexpr uint8_t l = TERN(TOUCH_UI_PORTRAIT, 6, 3);
const uint8_t pressed = EventLoop::get_pressed_tag();
@ -144,7 +136,8 @@ void LockScreen::onPasscodeEntered() {
onRefresh();
sound.play(twinkle, PLAY_SYNCHRONOUS);
GOTO_PREVIOUS();
} else {
}
else {
message_style() = 'w';
onRefresh();
sound.play(sad_trombone, PLAY_SYNCHRONOUS);
@ -162,7 +155,8 @@ bool LockScreen::onTouchEnd(uint8_t tag) {
// Backspace deletes previous entered characters.
*--c = '_';
}
} else {
}
else {
// Append character to passcode
*c++ = tag;
if (*c == '\0') {

View file

@ -380,7 +380,8 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
case 4:
if (isPrinting()) {
GOTO_SCREEN(TuneMenu);
} else {
}
else {
GOTO_SCREEN(MainMenu);
}
break;
@ -394,7 +395,8 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
#else
return false;
#endif
} else {
}
else {
GOTO_SCREEN(MoveAxisScreen);
}
break;

View file

@ -123,7 +123,8 @@ void StressTestScreen::onIdle() {
if (!isPositionKnown()) {
extern const char G28_STR[];
injectCommands_P(G28_STR);
} else {
}
else {
injectCommands_P(PSTR(
"G0 X100 Y100 Z100 F6000\n"
"T0\nG4 S1"