From fa8183aa9ea5117818db0b00ac9beb752de57b8c Mon Sep 17 00:00:00 2001 From: Linar Yusupov Date: Mon, 29 Jul 2024 13:24:41 +0300 Subject: [PATCH] [EPD] BARO screen adjustment for 2:1 aspect ratio --- .../firmware/source/SoftRF/src/driver/EPD.cpp | 8 ++--- .../source/SoftRF/src/platform/ESP32.h | 6 +++- .../src/platform/iomap/LilyGO_TUltima.h | 14 +++++++- .../source/SoftRF/src/ui/Baro_EPD.cpp | 32 +++++++++++++++++-- .../source/SoftRF/src/ui/Status_EPD.cpp | 2 ++ 5 files changed, 53 insertions(+), 9 deletions(-) diff --git a/software/firmware/source/SoftRF/src/driver/EPD.cpp b/software/firmware/source/SoftRF/src/driver/EPD.cpp index 2c9929e89..60b891f72 100644 --- a/software/firmware/source/SoftRF/src/driver/EPD.cpp +++ b/software/firmware/source/SoftRF/src/driver/EPD.cpp @@ -628,13 +628,13 @@ void EPD_fini(int reason, bool screen_saver) display->setFont(&FreeMonoBold12pt7b); display->getTextBounds(msg, 0, 0, &tbx, &tby, &tbw, &tbh); x = (display_width - tbw) / 2; - y = tbh + tbh / 2; + y = tbh + tbh / 2 + dy; display->setCursor(x, y); display->print(msg); #if defined(EPD_ASPECT_RATIO_1C1) x = (display_width - 128) / 2; - y = (display_height - 128) / 2 - tbh / 2; + y = (display_height - 128) / 2 - tbh / 2 + dy; display->drawBitmap(x, y, sleep_icon_128x128, 128, 128, GxEPD_BLACK); #endif /* EPD_ASPECT_RATIO_1C1 */ @@ -643,11 +643,11 @@ void EPD_fini(int reason, bool screen_saver) #if defined(EPD_ASPECT_RATIO_1C1) x = 5; - y += 128 + 17; + y += 128 + 17 + dy; #endif /* EPD_ASPECT_RATIO_1C1 */ #if defined(EPD_ASPECT_RATIO_2C1) x = 30; - y = (3 * display_height) / 4; + y = (3 * display_height) / 4 + dy; #endif /* EPD_ASPECT_RATIO_2C1 */ display->setCursor(x, y); display->print(EPD_SoftRF_text4); diff --git a/software/firmware/source/SoftRF/src/platform/ESP32.h b/software/firmware/source/SoftRF/src/platform/ESP32.h index c2c4adc31..406ec6f4e 100644 --- a/software/firmware/source/SoftRF/src/platform/ESP32.h +++ b/software/firmware/source/SoftRF/src/platform/ESP32.h @@ -156,6 +156,8 @@ extern Adafruit_NeoPixel strip; SOC_GPIO_PIN_HELTRK_LED : \ hw_info.model == SOFTRF_MODEL_ECO ?\ SOC_GPIO_PIN_T3C6_LED : \ + hw_info.model == SOFTRF_MODEL_INK ?\ + SOC_GPIO_PIN_T3S3_LED : \ hw_info.model != SOFTRF_MODEL_PRIME_MK2 ?\ SOC_UNUSED_PIN : \ (hw_info.revision == 2 ? \ @@ -176,7 +178,9 @@ extern Adafruit_NeoPixel strip; SOC_GPIO_PIN_HELTRK_GNSS_PPS : \ (hw_info.model == SOFTRF_MODEL_ECO ? \ SOC_GPIO_PIN_T3C6_GNSS_PPS : \ - SOC_UNUSED_PIN)))) + (hw_info.model == SOFTRF_MODEL_INK ? \ + SOC_GPIO_PIN_T3S3_GNSS_PPS : \ + SOC_UNUSED_PIN))))) #define SOC_GPIO_PIN_BUZZER (hw_info.model == SOFTRF_MODEL_PRIME_MK2 ? \ SOC_UNUSED_PIN : \ diff --git a/software/firmware/source/SoftRF/src/platform/iomap/LilyGO_TUltima.h b/software/firmware/source/SoftRF/src/platform/iomap/LilyGO_TUltima.h index fdeebb3a5..5c557b0e1 100644 --- a/software/firmware/source/SoftRF/src/platform/iomap/LilyGO_TUltima.h +++ b/software/firmware/source/SoftRF/src/platform/iomap/LilyGO_TUltima.h @@ -16,10 +16,11 @@ #define SOC_GPIO_PIN_TULTIMA_SCK _PINNUM(0, 3) // P0.03 #define SOC_GPIO_PIN_TULTIMA_SS _PINNUM(0, 23) // P0.23 -/* SX1262 or SX1276 */ +/* LR1121, SX1262, SX1276 or SX1280 */ #define SOC_GPIO_PIN_TULTIMA_RST _PINNUM(0, 25) // P0.25 #define SOC_GPIO_PIN_TULTIMA_DIO1 _PINNUM(0, 15) // P0.15 #define SOC_GPIO_PIN_TULTIMA_BUSY _PINNUM(0, 17) // P0.17 +#define SOC_GPIO_PIN_TULTIMA_EN _PINNUM(0, 13) // P0.13 /* I2C */ #define SOC_GPIO_PIN_TULTIMA_SDA _PINNUM(1, 1) // P1.01 @@ -47,6 +48,9 @@ #define SOC_GPIO_PIN_SFL_TULTIMA_HOLD _PINNUM(1, 15) // P1.15 #define SOC_GPIO_PIN_SFL_TULTIMA_WP _PINNUM(0, 31) // P0.31 +/* RTC */ +#define SOC_GPIO_PIN_RTC_TULTIMA_INT _PINNUM(1, 2) // P1.02 + /* I2S */ #define SOC_GPIO_PIN_I2S_TULTIMA_LRCK _PINNUM(1, 0) // P1.00 #define SOC_GPIO_PIN_I2S_TULTIMA_BCK _PINNUM(0, 24) // P0.24 @@ -56,4 +60,12 @@ /* IMU */ #define SOC_GPIO_PIN_IMU_TULTIMA_SS _PINNUM(0, 28) // P0.28 #define SOC_GPIO_PIN_IMU_TULTIMA_INT _PINNUM(0, 30) // P0.30 +#define SOC_GPIO_PIN_IMU_TULTIMA_HB _PINNUM(1, 12) // P1.12 /* TBD */ #define SOC_GPIO_PIN_IMU_TULTIMA_RST SOC_UNUSED_PIN + +/* FT6336U */ +#define SOC_GPIO_PIN_TOUCH_TULTIMA_RST _PINNUM(0, 8) // P0.08 +#define SOC_GPIO_PIN_TOUCH_TULTIMA_INT _PINNUM(0, 6) // P0.06 + +/* DRV2605 */ +#define SOC_GPIO_PIN_MOTOR_TULTIMA_EN _PINNUM(1, 9) // P1.09 diff --git a/software/firmware/source/SoftRF/src/ui/Baro_EPD.cpp b/software/firmware/source/SoftRF/src/ui/Baro_EPD.cpp index 9cf5ae04a..1adb3bd85 100644 --- a/software/firmware/source/SoftRF/src/ui/Baro_EPD.cpp +++ b/software/firmware/source/SoftRF/src/ui/Baro_EPD.cpp @@ -38,6 +38,20 @@ static float alt_scale = 1.0; void EPD_baro_setup() { + uint16_t display_width = display->width(); + uint16_t display_height = display->height(); + int16_t dy = 0; + +#if defined(EPD_ASPECT_RATIO_2C1) + if (display->epd2.panel == GxEPD2::DEPG0213BN) { + if (display_width == 128) display_width = 122; + if (display_height == 128) { + display_height = 122; + if (display->getRotation() == ROTATE_90 ) { dy = 6; } + } + } +#endif /* EPD_ASPECT_RATIO_2C1 */ + if (hw_info.baro != BARO_MODULE_NONE) { EPD_pages_mask |= (1 << VIEW_MODE_BARO); } @@ -48,9 +62,9 @@ void EPD_baro_setup() strcpy(navbox1.title + strlen(Altitude_text), ui->units == UNITS_METRIC ? "M" : "FT"); navbox1.x = 0; - navbox1.y = 0; - navbox1.width = display->width(); - navbox1.height = display->height() / 3; + navbox1.y = 0 + dy; + navbox1.width = display_width; + navbox1.height = display_height / 3; navbox1.value = Baro_altitude() * alt_scale; // navbox1.prev_value = navbox1.value; navbox1.timestamp = millis(); @@ -118,6 +132,7 @@ static void EPD_Draw_NavBoxes() display->setFont(&FreeMonoBold18pt7b); +#if defined(EPD_ASPECT_RATIO_1C1) display->setCursor(navbox1.x + navbox1.width / 3 + 15, navbox1.y + 52); display->print(navbox1.value); @@ -126,6 +141,17 @@ static void EPD_Draw_NavBoxes() display->setCursor(navbox3.x + navbox3.width / 3 + 15, navbox3.y + 52); display->print(navbox3.value); +#endif /* EPD_ASPECT_RATIO_1C1 */ +#if defined(EPD_ASPECT_RATIO_2C1) + display->setCursor(navbox1.x + navbox1.width / 2 + 17, navbox1.y + 32); + display->print(navbox1.value); + + display->setCursor(navbox2.x + navbox2.width / 2 + 17, navbox2.y + 32); + display->print(navbox2.value); + + display->setCursor(navbox3.x + navbox3.width / 2 + 59, navbox3.y + 32); + display->print(navbox3.value); +#endif /* EPD_ASPECT_RATIO_2C1 */ #if defined(USE_EPD_TASK) /* a signal to background EPD update task */ diff --git a/software/firmware/source/SoftRF/src/ui/Status_EPD.cpp b/software/firmware/source/SoftRF/src/ui/Status_EPD.cpp index 4880ed1df..820a7334d 100644 --- a/software/firmware/source/SoftRF/src/ui/Status_EPD.cpp +++ b/software/firmware/source/SoftRF/src/ui/Status_EPD.cpp @@ -50,6 +50,7 @@ void EPD_status_setup() uint16_t display_height = display->height(); int16_t dy = 0; +#if defined(EPD_ASPECT_RATIO_2C1) if (display->epd2.panel == GxEPD2::DEPG0213BN) { if (display_width == 128) display_width = 122; if (display_height == 128) { @@ -57,6 +58,7 @@ void EPD_status_setup() if (display->getRotation() == ROTATE_90 ) { dy = 6; } } } +#endif /* EPD_ASPECT_RATIO_2C1 */ memcpy(navbox1.title, NAVBOX1_TITLE, strlen(NAVBOX1_TITLE)); navbox1.x = 0;