From a0e3dea8b879aba8e0d2d7e4dc6a6447b3fe76ad Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 20 Jul 2023 20:25:39 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20ColorUI=20Touch=20Calibrate=20in?= =?UTF-8?q?=20CW=20order?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/macros.h | 6 +++--- Marlin/src/inc/Conditionals_LCD.h | 12 +++++++----- Marlin/src/lcd/HD44780/marlinui_HD44780.cpp | 2 ++ Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp | 3 ++- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 2 +- .../src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp | 10 +++++----- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 8 ++++---- Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp | 6 +++--- .../src/lcd/extui/mks_ui/draw_touch_calibration.cpp | 6 +++--- .../src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp | 2 +- Marlin/src/lcd/tft/tft_string.h | 5 ++++- Marlin/src/lcd/tft/ui_common.cpp | 10 +++++----- Marlin/src/lcd/tft/ui_common.h | 2 +- Marlin/src/lcd/tft_io/touch_calibration.cpp | 6 +++--- Marlin/src/lcd/tft_io/touch_calibration.h | 6 +++--- Marlin/src/lcd/touch/touch_buttons.cpp | 2 +- Marlin/src/libs/W25Qxx.cpp | 10 ++++++---- 17 files changed, 54 insertions(+), 44 deletions(-) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index da17450c2b9f..bb2bea2e3028 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -396,9 +396,9 @@ FORCE_INLINE constexpr T operator|(T x, T y) { return static_cast(static_cast(x) | static_cast(y)); } \ FORCE_INLINE constexpr T operator^(T x, T y) { return static_cast(static_cast(x) ^ static_cast(y)); } \ FORCE_INLINE constexpr T operator~(T x) { return static_cast(~static_cast(x)); } \ - FORCE_INLINE T & operator&=(T &x, T y) { return x &= y; } \ - FORCE_INLINE T & operator|=(T &x, T y) { return x |= y; } \ - FORCE_INLINE T & operator^=(T &x, T y) { return x ^= y; } + FORCE_INLINE T & operator&=(T &x, T y) { x = x & y; return x; } \ + FORCE_INLINE T & operator|=(T &x, T y) { x = x | y; return x; } \ + FORCE_INLINE T & operator^=(T &x, T y) { x = x ^ y; return x; } // C++11 solution that is standard compliant. is not available on all platform namespace Private { diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 01bc2805d948..084a3d74e91a 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1782,20 +1782,22 @@ #define HAS_UI_1024x600 1 #endif +// Number of text lines the screen can display (may depend on font used) +// Touch screens leave space for extra buttons at the bottom #if ANY(HAS_UI_320x240, HAS_UI_480x272) #if ENABLED(TFT_COLOR_UI_PORTRAIT) - #define LCD_HEIGHT TERN(TOUCH_SCREEN, 8, 9) // Fewer lines with touch buttons onscreen + #define LCD_HEIGHT TERN(TOUCH_SCREEN, 8, 9) #else - #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) // Fewer lines with touch buttons onscreen + #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) #endif #elif HAS_UI_480x320 #if ENABLED(TFT_COLOR_UI_PORTRAIT) - #define LCD_HEIGHT TERN(TOUCH_SCREEN, 9, 10) // Fewer lines with touch buttons onscreen + #define LCD_HEIGHT TERN(TOUCH_SCREEN, 9, 10) #else - #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) // Fewer lines with touch buttons onscreen + #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) #endif #elif HAS_UI_1024x600 - #define LCD_HEIGHT TERN(TOUCH_SCREEN, 12, 13) // Fewer lines with touch buttons onscreen + #define LCD_HEIGHT TERN(TOUCH_SCREEN, 12, 13) #endif // This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046' diff --git a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp index 148d0877cf57..b59ec150a1a5 100644 --- a/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/marlinui_HD44780.cpp @@ -784,6 +784,7 @@ void MarlinUI::draw_status_message(const bool blink) { } #if HAS_PRINT_PROGRESS + #define TPOFFSET (LCD_WIDTH - 1) static uint8_t timepos = TPOFFSET - 6; static char buffer[8]; @@ -837,6 +838,7 @@ void MarlinUI::draw_status_message(const bool blink) { } } #endif + #endif // HAS_PRINT_PROGRESS /** diff --git a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp index 02e5f05d92a1..4cec4dfa43bd 100644 --- a/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp +++ b/Marlin/src/lcd/TFTGLCD/marlinui_TFTGLCD.cpp @@ -596,8 +596,8 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const #endif // HAS_CUTTER - #if HAS_PRINT_PROGRESS // UNTESTED!!! + #define TPOFFSET (LCD_WIDTH - 1) static uint8_t timepos = TPOFFSET - 6; @@ -648,6 +648,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const } } #endif + #endif // HAS_PRINT_PROGRESS #if ENABLED(LCD_PROGRESS_BAR) diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index 5bce83849f83..2067a8428da6 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -773,7 +773,7 @@ void MarlinUI::draw_status_screen() { u8g.drawBox(PROGRESS_BAR_X + 1, PROGRESS_BAR_Y + 1, progress_bar_solid_width, 2); // Progress strings - if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)){ + if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) { ui.rotate_progress(); lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, bufferc); } diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp index 48c49b5c3312..c6aff38dc9b5 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp @@ -510,8 +510,8 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, } else { // clear last cross - x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x; - y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y; + x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_LEFT)].x; + y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_LEFT)].y; drawCross(x, y, TFT_MARLINBG_COLOR); } @@ -519,10 +519,10 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, if (stage < CALIBRATION_SUCCESS) { // handle current state switch (stage) { - case CALIBRATION_TOP_LEFT: str = GET_TEXT_F(MSG_TOP_LEFT); break; - case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT_F(MSG_BOTTOM_LEFT); break; - case CALIBRATION_TOP_RIGHT: str = GET_TEXT_F(MSG_TOP_RIGHT); break; + case CALIBRATION_TOP_LEFT: str = GET_TEXT_F(MSG_TOP_LEFT); break; + case CALIBRATION_TOP_RIGHT: str = GET_TEXT_F(MSG_TOP_RIGHT); break; case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT_F(MSG_BOTTOM_RIGHT); break; + case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT_F(MSG_BOTTOM_LEFT); break; default: break; } diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index fea1f081f6fe..5156848a436f 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -1420,7 +1420,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra case MLEVEL_BL: if (draw) - drawMenuItem(row, ICON_AxisBL, F("Bottom Left")); + drawMenuItem(row, ICON_AxisBL, GET_TEXT_F(MSG_BOTTOM_LEFT)); else { popupHandler(Popup_MoveWait); if (use_probe) { @@ -1443,7 +1443,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; case MLEVEL_TL: if (draw) - drawMenuItem(row, ICON_AxisTL, F("Top Left")); + drawMenuItem(row, ICON_AxisTL, GET_TEXT_F(MSG_TOP_LEFT)); else { popupHandler(Popup_MoveWait); if (use_probe) { @@ -1466,7 +1466,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; case MLEVEL_TR: if (draw) - drawMenuItem(row, ICON_AxisTR, F("Top Right")); + drawMenuItem(row, ICON_AxisTR, GET_TEXT_F(MSG_TOP_RIGHT)); else { popupHandler(Popup_MoveWait); if (use_probe) { @@ -1489,7 +1489,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; case MLEVEL_BR: if (draw) - drawMenuItem(row, ICON_AxisBR, F("Bottom Right")); + drawMenuItem(row, ICON_AxisBR, GET_TEXT_F(MSG_BOTTOM_RIGHT)); else { popupHandler(Popup_MoveWait); if (use_probe) { diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp index cf87bacf3be7..470fe10c43a3 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp @@ -60,10 +60,10 @@ namespace ExtUI { void onPrintTimerStopped() { dgus.timerEvent(AC_timer_stopped); } void onPrintDone() {} - void onFilamentRunout(const extruder_t) { dgus.filamentRunout(); } + void onFilamentRunout(const extruder_t) { dgus.filamentRunout(); } - void onUserConfirmRequired(const char * const msg) { dgus.confirmationRequest(msg); } - void onStatusChanged(const char * const msg) { dgus.statusChange(msg); } + void onUserConfirmRequired(const char * const msg) { dgus.confirmationRequest(msg); } + void onStatusChanged(const char * const msg) { dgus.statusChange(msg); } void onHomingStart() { dgus.homingStart(); } void onHomingDone() { dgus.homingComplete(); } diff --git a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp index dda9ee1c29a2..0fd2aa0ee9f7 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp @@ -62,8 +62,8 @@ void lv_update_touch_calibration_screen() { } else { // clear last cross - x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x; - y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y; + x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_LEFT)].x; + y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_LEFT)].y; drawCross(x, y, LV_COLOR_BACKGROUND.full); } @@ -72,9 +72,9 @@ void lv_update_touch_calibration_screen() { // handle current state switch (stage) { case CALIBRATION_TOP_LEFT: str = GET_TEXT(MSG_TOP_LEFT); break; - case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break; case CALIBRATION_TOP_RIGHT: str = GET_TEXT(MSG_TOP_RIGHT); break; case CALIBRATION_BOTTOM_RIGHT: str = GET_TEXT(MSG_BOTTOM_RIGHT); break; + case CALIBRATION_BOTTOM_LEFT: str = GET_TEXT(MSG_BOTTOM_LEFT); break; default: break; } diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index 09b9c7a53e19..a53e0d606b7c 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -310,7 +310,7 @@ static bool get_point(int16_t *x, int16_t *y) { #if ENABLED(TOUCH_SCREEN_CALIBRATION) const calibrationState state = touch_calibration.get_calibration_state(); - if (state >= CALIBRATION_TOP_LEFT && state <= CALIBRATION_BOTTOM_RIGHT) { + if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_LEFT)) { if (touch_calibration.handleTouch(*x, *y)) lv_update_touch_calibration_screen(); return false; } diff --git a/Marlin/src/lcd/tft/tft_string.h b/Marlin/src/lcd/tft/tft_string.h index ae05df40f00d..008064f69272 100644 --- a/Marlin/src/lcd/tft/tft_string.h +++ b/Marlin/src/lcd/tft/tft_string.h @@ -173,7 +173,10 @@ class TFT_String { static uint16_t *string() { return data; } static uint16_t width() { return span; } static uint16_t center(const uint16_t width) { return span > width ? 0 : (width - span) / 2; } - static uint16_t vcenter(const uint16_t height) { return (height + font_header->capitalAHeight + 1) / 2 > font_header->fontAscent ? (height + font_header->capitalAHeight + 1) / 2 - font_header->fontAscent : 0 ; } + static uint16_t vcenter(const uint16_t height) { + const uint16_t mid = (height + font_header->capitalAHeight + 1) / 2; + return mid > font_header->fontAscent ? mid - font_header->fontAscent : 0; + } }; extern TFT_String tft_string; diff --git a/Marlin/src/lcd/tft/ui_common.cpp b/Marlin/src/lcd/tft/ui_common.cpp index 09364d846ba6..5f426294dce9 100644 --- a/Marlin/src/lcd/tft/ui_common.cpp +++ b/Marlin/src/lcd/tft/ui_common.cpp @@ -440,8 +440,8 @@ void MarlinUI::clear_lcd() { stage = touch_calibration.calibration_start(); } else { - x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].x; - y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_RIGHT)].y; + x = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_LEFT)].x; + y = touch_calibration.calibration_points[_MIN(stage - 1, CALIBRATION_BOTTOM_LEFT)].y; tft.canvas(x - 15, y - 15, 31, 31); tft.set_background(COLOR_BACKGROUND); } @@ -450,10 +450,10 @@ void MarlinUI::clear_lcd() { if (stage < CALIBRATION_SUCCESS) { switch (stage) { - case CALIBRATION_TOP_LEFT: tft_string.set(GET_TEXT(MSG_TOP_LEFT)); break; - case CALIBRATION_BOTTOM_LEFT: tft_string.set(GET_TEXT(MSG_BOTTOM_LEFT)); break; - case CALIBRATION_TOP_RIGHT: tft_string.set(GET_TEXT(MSG_TOP_RIGHT)); break; + case CALIBRATION_TOP_LEFT: tft_string.set(GET_TEXT(MSG_TOP_LEFT)); break; + case CALIBRATION_TOP_RIGHT: tft_string.set(GET_TEXT(MSG_TOP_RIGHT)); break; case CALIBRATION_BOTTOM_RIGHT: tft_string.set(GET_TEXT(MSG_BOTTOM_RIGHT)); break; + case CALIBRATION_BOTTOM_LEFT: tft_string.set(GET_TEXT(MSG_BOTTOM_LEFT)); break; default: break; } diff --git a/Marlin/src/lcd/tft/ui_common.h b/Marlin/src/lcd/tft/ui_common.h index 592bf3184e6e..8229ab36abfa 100644 --- a/Marlin/src/lcd/tft/ui_common.h +++ b/Marlin/src/lcd/tft/ui_common.h @@ -109,7 +109,7 @@ void disable_steppers(); bool lcd_sleep_task(); #endif -void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater); +void draw_heater_status(uint16_t x, uint16_t y, const int8_t heater); void draw_fan_status(uint16_t x, uint16_t y, const bool blink); void text_line(const uint16_t y, uint16_t color=COLOR_BACKGROUND); diff --git a/Marlin/src/lcd/tft_io/touch_calibration.cpp b/Marlin/src/lcd/tft_io/touch_calibration.cpp index c239a94b41f9..3cd73fe6204c 100644 --- a/Marlin/src/lcd/tft_io/touch_calibration.cpp +++ b/Marlin/src/lcd/tft_io/touch_calibration.cpp @@ -103,10 +103,10 @@ bool TouchCalibration::handleTouch(const uint16_t x, const uint16_t y) { } switch (calibration_state) { - case CALIBRATION_TOP_LEFT: calibration_state = CALIBRATION_BOTTOM_LEFT; break; - case CALIBRATION_BOTTOM_LEFT: calibration_state = CALIBRATION_TOP_RIGHT; break; + case CALIBRATION_TOP_LEFT: calibration_state = CALIBRATION_TOP_RIGHT; break; case CALIBRATION_TOP_RIGHT: calibration_state = CALIBRATION_BOTTOM_RIGHT; break; - case CALIBRATION_BOTTOM_RIGHT: validate_calibration(); break; + case CALIBRATION_BOTTOM_RIGHT: calibration_state = CALIBRATION_BOTTOM_LEFT; break; + case CALIBRATION_BOTTOM_LEFT: validate_calibration(); break; default: break; } diff --git a/Marlin/src/lcd/tft_io/touch_calibration.h b/Marlin/src/lcd/tft_io/touch_calibration.h index e9d3110c56d6..2dd8a81ab7cc 100644 --- a/Marlin/src/lcd/tft_io/touch_calibration.h +++ b/Marlin/src/lcd/tft_io/touch_calibration.h @@ -43,9 +43,9 @@ typedef struct __attribute__((__packed__)) { enum calibrationState : uint8_t { CALIBRATION_TOP_LEFT = 0x00, - CALIBRATION_BOTTOM_LEFT, CALIBRATION_TOP_RIGHT, CALIBRATION_BOTTOM_RIGHT, + CALIBRATION_BOTTOM_LEFT, CALIBRATION_SUCCESS, CALIBRATION_FAIL, CALIBRATION_NONE, @@ -73,12 +73,12 @@ class TouchCalibration { calibration_state = CALIBRATION_TOP_LEFT; calibration_points[CALIBRATION_TOP_LEFT].x = 30; calibration_points[CALIBRATION_TOP_LEFT].y = 30; - calibration_points[CALIBRATION_BOTTOM_LEFT].x = 30; - calibration_points[CALIBRATION_BOTTOM_LEFT].y = TFT_HEIGHT - 31; calibration_points[CALIBRATION_TOP_RIGHT].x = TFT_WIDTH - 31; calibration_points[CALIBRATION_TOP_RIGHT].y = 30; calibration_points[CALIBRATION_BOTTOM_RIGHT].x = TFT_WIDTH - 31; calibration_points[CALIBRATION_BOTTOM_RIGHT].y = TFT_HEIGHT - 31; + calibration_points[CALIBRATION_BOTTOM_LEFT].x = 30; + calibration_points[CALIBRATION_BOTTOM_LEFT].y = TFT_HEIGHT - 31; failed_count = 0; return calibration_state; } diff --git a/Marlin/src/lcd/touch/touch_buttons.cpp b/Marlin/src/lcd/touch/touch_buttons.cpp index 856594c31a28..1ae5397b2ef6 100644 --- a/Marlin/src/lcd/touch/touch_buttons.cpp +++ b/Marlin/src/lcd/touch/touch_buttons.cpp @@ -80,7 +80,7 @@ uint8_t TouchButtons::read_buttons() { #if ENABLED(TOUCH_SCREEN_CALIBRATION) const calibrationState state = touch_calibration.get_calibration_state(); - if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_RIGHT)) { + if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_LEFT)) { if (touch_calibration.handleTouch(x, y)) ui.refresh(); return 0; } diff --git a/Marlin/src/libs/W25Qxx.cpp b/Marlin/src/libs/W25Qxx.cpp index 591d0d069318..558d604ea52d 100644 --- a/Marlin/src/libs/W25Qxx.cpp +++ b/Marlin/src/libs/W25Qxx.cpp @@ -48,10 +48,12 @@ void W25QXXFlash::init(uint8_t spiRate) { * STM32F1 has 3 SPI ports, SPI1 in APB2, SPI2/SPI3 in APB1 * so the minimum prescale of SPI1 is DIV4, SPI2/SPI3 is DIV2 */ - #if SPI_DEVICE == 1 - #define SPI_CLOCK_MAX SPI_CLOCK_DIV4 - #else - #define SPI_CLOCK_MAX SPI_CLOCK_DIV2 + #ifndef SPI_CLOCK_MAX + #if SPI_DEVICE == 1 + #define SPI_CLOCK_MAX SPI_CLOCK_DIV4 + #else + #define SPI_CLOCK_MAX SPI_CLOCK_DIV2 + #endif #endif uint8_t clock; switch (spiRate) {