From c8b223972db8cc44b56d7e83f9c3084f44d2c2db Mon Sep 17 00:00:00 2001 From: Todd Herbert Date: Wed, 28 Feb 2024 15:30:02 +1300 Subject: [PATCH] refactor: move macros to platformio.ini Responds to https://github.com/meshtastic/firmware/pull/3299#issuecomment-1966425926 --- src/graphics/EInkDisplay2.cpp | 22 +++++++++++++++++++ .../platformio.ini | 3 +++ .../MakePython_nRF52840_eink/platformio.ini | 3 +++ variants/esp32-s3-pico/platformio.ini | 5 +++-- variants/esp32-s3-pico/variant.h | 6 +---- variants/heltec_wireless_paper/platformio.ini | 7 +++++- .../heltec_wireless_paper_v1/platformio.ini | 3 +++ variants/m5stack_coreink/platformio.ini | 5 +++-- variants/my_esp32s3_diy_eink/platformio.ini | 5 +++-- variants/my_esp32s3_diy_eink/variant.h | 6 +---- variants/rak10701/platformio.ini | 3 +++ variants/rak4631/platformio.ini | 3 +++ variants/rak4631_epaper/platformio.ini | 3 +++ variants/rak4631_epaper_onrxtx/platformio.ini | 3 +++ variants/t-echo/platformio.ini | 3 +++ 15 files changed, 63 insertions(+), 17 deletions(-) diff --git a/src/graphics/EInkDisplay2.cpp b/src/graphics/EInkDisplay2.cpp index 45005dee1f..fc0bec564f 100644 --- a/src/graphics/EInkDisplay2.cpp +++ b/src/graphics/EInkDisplay2.cpp @@ -6,6 +6,28 @@ #include "main.h" #include +/* + The macros EINK_DISPLAY_MODEL, EINK_WIDTH, and EINK_HEIGHT are defined as build_flags in a variant's platformio.ini + Previously, these macros were defined at the top of this file. + + For archival reasons, note that the following configurations had also been tested during this period: + * ifdef RAK4631 + - 4.2 inch + EINK_DISPLAY_MODEL: GxEPD2_420_M01 + EINK_WIDTH: 300 + EINK_WIDTH: 400 + + - 2.9 inch + EINK_DISPLAY_MODEL: GxEPD2_290_T5D + EINK_WIDTH: 296 + EINK_HEIGHT: 128 + + - 1.54 inch + EINK_DISPLAY_MODEL: GxEPD2_154_M09 + EINK_WIDTH: 200 + EINK_HEIGHT: 200 +*/ + // Constructor EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY geometry, HW_I2C i2cBus) { diff --git a/variants/Dongle_nRF52840-pca10059-v1/platformio.ini b/variants/Dongle_nRF52840-pca10059-v1/platformio.ini index a937bfa98c..b1608770ee 100644 --- a/variants/Dongle_nRF52840-pca10059-v1/platformio.ini +++ b/variants/Dongle_nRF52840-pca10059-v1/platformio.ini @@ -4,6 +4,9 @@ board = nordic_pca10059 board_level = extra build_flags = ${nrf52840_base.build_flags} -Ivariants/Dongle_nRF52840-pca10059-v1 -D NORDIC_PCA10059 -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" + -DEINK_DISPLAY_MODEL=GxEPD2_420_M01 + -DEINK_WIDTH=300 + -DEINK_HEIGHT=400 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/Dongle_nRF52840-pca10059-v1> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/MakePython_nRF52840_eink/platformio.ini b/variants/MakePython_nRF52840_eink/platformio.ini index 3ac18bcf06..f421466ec4 100644 --- a/variants/MakePython_nRF52840_eink/platformio.ini +++ b/variants/MakePython_nRF52840_eink/platformio.ini @@ -10,5 +10,8 @@ lib_deps = ${nrf52840_base.lib_deps} https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f zinggjm/GxEPD2@^1.4.9 + -DEINK_DISPLAY_MODEL=GxEPD2_290_T5D + -DEINK_WIDTH=296 + -DEINK_HEIGHT=128 debug_tool = jlink ;upload_port = /dev/ttyACM4 diff --git a/variants/esp32-s3-pico/platformio.ini b/variants/esp32-s3-pico/platformio.ini index a4c8afcfc3..ef737d98a4 100644 --- a/variants/esp32-s3-pico/platformio.ini +++ b/variants/esp32-s3-pico/platformio.ini @@ -16,8 +16,9 @@ build_flags = ${esp32_base.build_flags} ;-DPRIVATE_HW -Ivariants/esp32-s3-pico -DBOARD_HAS_PSRAM - -DEPD_HEIGHT=128 ;Redundant? See variant.h - -DEPD_WIDTH=296 ;Redundant? See variant.h + -DEINK_DISPLAY_MODEL=GxEPD2_290_T94_V2 + -DEINK_WIDTH=296 + -DEINK_HEIGHT=128 lib_deps = ${esp32s3_base.lib_deps} zinggjm/GxEPD2@^1.5.3 diff --git a/variants/esp32-s3-pico/variant.h b/variants/esp32-s3-pico/variant.h index 401f389cd4..87378d3788 100644 --- a/variants/esp32-s3-pico/variant.h +++ b/variants/esp32-s3-pico/variant.h @@ -74,8 +74,4 @@ #define PIN_EINK_DC 33 #define PIN_EINK_RES 42 // 37 //(-1) // cant be MISO Waveshare ??) #define PIN_EINK_SCLK 35 -#define PIN_EINK_MOSI 36 - -#define EINK_DISPLAY_MODEL GxEPD2_290_T94_V2 -#define EINK_WIDTH 296 -#define EINK_HEIGHT 128 \ No newline at end of file +#define PIN_EINK_MOSI 36 \ No newline at end of file diff --git a/variants/heltec_wireless_paper/platformio.ini b/variants/heltec_wireless_paper/platformio.ini index dd93b52cb4..56446dc8bb 100644 --- a/variants/heltec_wireless_paper/platformio.ini +++ b/variants/heltec_wireless_paper/platformio.ini @@ -2,7 +2,12 @@ extends = esp32s3_base board = heltec_wifi_lora_32_V3 build_flags = - ${esp32s3_base.build_flags} -D HELTEC_WIRELESS_PAPER -I variants/heltec_wireless_paper + ${esp32s3_base.build_flags} + -I variants/heltec_wireless_paper + -D HELTEC_WIRELESS_PAPER + -D EINK_DISPLAY_MODEL=GxEPD2_213_FC1 + -D EINK_WIDTH=250 + -D EINK_HEIGHT=122 lib_deps = ${esp32s3_base.lib_deps} https://github.com/ixt/GxEPD2#39f325b677713eb04dfcc83b8e402e77523fb8bf diff --git a/variants/heltec_wireless_paper_v1/platformio.ini b/variants/heltec_wireless_paper_v1/platformio.ini index 7d7f4eb14f..01b68f5f08 100644 --- a/variants/heltec_wireless_paper_v1/platformio.ini +++ b/variants/heltec_wireless_paper_v1/platformio.ini @@ -5,6 +5,9 @@ build_flags = ${esp32s3_base.build_flags} -I variants/heltec_wireless_paper_v1 -D HELTEC_WIRELESS_PAPER_V1_0 + -D EINK_DISPLAY_MODEL=GxEPD2_213_BN + -D EINK_WIDTH=250 + -D EINK_HEIGHT=122 lib_deps = ${esp32s3_base.lib_deps} https://github.com/meshtastic/GxEPD2/ diff --git a/variants/m5stack_coreink/platformio.ini b/variants/m5stack_coreink/platformio.ini index ee6d340dc2..dfb078a0ad 100644 --- a/variants/m5stack_coreink/platformio.ini +++ b/variants/m5stack_coreink/platformio.ini @@ -9,8 +9,9 @@ build_flags = ;-D RADIOLIB_VERBOSE -Ofast -D__MCUXPRESSO - -DEPD_HEIGHT=200 - -DEPD_WIDTH=200 + -DEINK_DISPLAY_MODEL=GxEPD2_154_M09 + -DEINK_WIDTH=200 + -DEINK_HEIGHT=200 -DUSER_SETUP_LOADED -DM5_COREINK -DM5STACK diff --git a/variants/my_esp32s3_diy_eink/platformio.ini b/variants/my_esp32s3_diy_eink/platformio.ini index 7af66adc1b..966bc580e4 100644 --- a/variants/my_esp32s3_diy_eink/platformio.ini +++ b/variants/my_esp32s3_diy_eink/platformio.ini @@ -19,8 +19,9 @@ build_flags = ;${esp32_base.build_flags} -D MY_ESP32S3_DIY -I variants/my_esp32s3_diy_eink ${esp32_base.build_flags} -D PRIVATE_HW -I variants/my_esp32s3_diy_eink -Dmy - -DEPD_HEIGHT=128 ;Redundant? See variant.h - -DEPD_WIDTH=296 ;Redundant? See variant.h + -DEINK_DISPLAY_MODEL=GxEPD2_290_T5D + -DEINK_WIDTH=296 + -DEINK_HEIGHT=128 -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -DARDUINO_USB_MODE=0 diff --git a/variants/my_esp32s3_diy_eink/variant.h b/variants/my_esp32s3_diy_eink/variant.h index 0f6ae1d57c..516fa7f340 100644 --- a/variants/my_esp32s3_diy_eink/variant.h +++ b/variants/my_esp32s3_diy_eink/variant.h @@ -53,8 +53,4 @@ #define PIN_EINK_DC 1 #define PIN_EINK_RES (-1) #define PIN_EINK_SCLK 5 -#define PIN_EINK_MOSI 6 - -#define EINK_DISPLAY_MODEL GxEPD2_290_T5D -#define EINK_WIDTH 296 -#define EINK_HEIGHT 128 \ No newline at end of file +#define PIN_EINK_MOSI 6 \ No newline at end of file diff --git a/variants/rak10701/platformio.ini b/variants/rak10701/platformio.ini index 736329eb87..37f785e849 100644 --- a/variants/rak10701/platformio.ini +++ b/variants/rak10701/platformio.ini @@ -5,6 +5,9 @@ board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak10701 -D RAK_4631 -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + -DEINK_DISPLAY_MODEL=GxEPD2_213_BN + -DEINK_WIDTH=250 + -DEINK_HEIGHT=122 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak10701> + + + lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/rak4631/platformio.ini b/variants/rak4631/platformio.ini index b9789166f0..b1bc2d9b55 100644 --- a/variants/rak4631/platformio.ini +++ b/variants/rak4631/platformio.ini @@ -5,6 +5,9 @@ board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631 -D RAK_4631 -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + -DEINK_DISPLAY_MODEL=GxEPD2_213_BN + -DEINK_WIDTH=250 + -DEINK_HEIGHT=122 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631> + + + lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/rak4631_epaper/platformio.ini b/variants/rak4631_epaper/platformio.ini index 0871eee450..ced732d94b 100644 --- a/variants/rak4631_epaper/platformio.ini +++ b/variants/rak4631_epaper/platformio.ini @@ -4,6 +4,9 @@ extends = nrf52840_base board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_epaper -D RAK_4631 -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" + -DEINK_DISPLAY_MODEL=GxEPD2_213_BN + -DEINK_WIDTH=250 + -DEINK_HEIGHT=122 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631_epaper> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/rak4631_epaper_onrxtx/platformio.ini b/variants/rak4631_epaper_onrxtx/platformio.ini index 0a4f05344f..c4a13ec824 100644 --- a/variants/rak4631_epaper_onrxtx/platformio.ini +++ b/variants/rak4631_epaper_onrxtx/platformio.ini @@ -6,6 +6,9 @@ board = wiscore_rak4631 build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631_epaper -D RAK_4631 -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" -D PIN_EINK_EN=34 + -D EINK_DISPLAY_MODEL=GxEPD2_213_BN + -D EINK_WIDTH=250 + -D EINK_HEIGHT=122 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak4631_epaper_onrxtx> lib_deps = ${nrf52840_base.lib_deps} diff --git a/variants/t-echo/platformio.ini b/variants/t-echo/platformio.ini index 843bd88ff0..49ba3bb34b 100644 --- a/variants/t-echo/platformio.ini +++ b/variants/t-echo/platformio.ini @@ -8,6 +8,9 @@ debug_tool = jlink build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo -DGPS_POWER_TOGGLE -L "${platformio.libdeps_dir}/${this.__env__}/BSEC2 Software Library/src/cortex-m4/fpv4-sp-d16-hard" + -DEINK_DISPLAY_MODEL=GxEPD2_154_D67 + -DEINK_WIDTH=200 + -DEINK_HEIGHT=200 build_src_filter = ${nrf52_base.build_src_filter} +<../variants/t-echo> lib_deps = ${nrf52840_base.lib_deps}