From 0b813334c4ef3b85baf1299764cb770107e62c30 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 9 Mar 2023 19:01:35 -0600 Subject: [PATCH] extra TICK_CYCLE --- .../src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp | 4 +--- Marlin/src/lcd/extui/mks_ui/wifi_module.cpp | 11 +++++------ 2 files changed, 6 insertions(+), 9 deletions(-) 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 1cf530ce2ba2..2248ef334ffd 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -298,10 +298,8 @@ void lv_fill_rect(lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2, lv W25QXX.init(SPI_QUARTER_SPEED); } -#define TICK_CYCLE 1 - uint16_t getTickDiff(const uint16_t curTick, const uint16_t lastTick) { - return TICK_CYCLE * (lastTick <= curTick ? (curTick - lastTick) : (0xFFFFFFFF - lastTick + curTick)); + return (TICK_CYCLE) * (lastTick <= curTick ? (curTick - lastTick) : (0xFFFFFFFF - lastTick + curTick)); } static bool get_point(int16_t *x, int16_t *y) { diff --git a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp index 2fce4e6f043c..0c2bbdfdb1c8 100644 --- a/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/mks_ui/wifi_module.cpp @@ -117,7 +117,7 @@ extern bool flash_dma_mode; uint32_t getWifiTick() { return millis(); } uint32_t getWifiTickDiff(const int32_t lastTick, const int32_t curTick) { - return TICK_CYCLE * (lastTick <= curTick ? curTick - lastTick : 0xFFFFFFFF - lastTick + curTick); + return (TICK_CYCLE) * (lastTick <= curTick ? curTick - lastTick : 0xFFFFFFFF - lastTick + curTick); } void wifi_delay(int n) { @@ -133,11 +133,10 @@ void wifi_reset() { WIFI_SET(); } -void mount_file_sys(uint8_t disk_type) { - if (disk_type == FILE_SYS_SD) { - TERN_(SDSUPPORT, card.mount()); - } - else if (disk_type == FILE_SYS_USB) { +void mount_file_sys(const uint8_t disk_type) { + switch (disk_type) { + case FILE_SYS_SD: TERN_(SDSUPPORT, card.mount()); break; + case FILE_SYS_USB: break; } }