Skip to content

Commit

Permalink
refactor: move macros to platformio.ini
Browse files Browse the repository at this point in the history
Responds to #3299 (comment)
  • Loading branch information
todd-herbert committed Feb 28, 2024
1 parent b5e7eab commit a143f16
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 17 deletions.
22 changes: 22 additions & 0 deletions src/graphics/EInkDisplay2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@
#include "main.h"
#include <SPI.h>

/*
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)
{
Expand Down
3 changes: 3 additions & 0 deletions variants/Dongle_nRF52840-pca10059-v1/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 3 additions & 0 deletions variants/MakePython_nRF52840_eink/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions variants/esp32-s3-pico/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions variants/esp32-s3-pico/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
#define PIN_EINK_MOSI 36
7 changes: 6 additions & 1 deletion variants/heltec_wireless_paper/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions variants/heltec_wireless_paper_v1/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
5 changes: 3 additions & 2 deletions variants/m5stack_coreink/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions variants/my_esp32s3_diy_eink/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 1 addition & 5 deletions variants/my_esp32s3_diy_eink/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
#define PIN_EINK_MOSI 6
3 changes: 3 additions & 0 deletions variants/rak10701/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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> +<mesh/eth/> +<mesh/api/> +<mqtt/>
lib_deps =
${nrf52840_base.lib_deps}
Expand Down
3 changes: 3 additions & 0 deletions variants/rak4631/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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> +<mesh/eth/> +<mesh/api/> +<mqtt/>
lib_deps =
${nrf52840_base.lib_deps}
Expand Down
3 changes: 3 additions & 0 deletions variants/rak4631_epaper/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 3 additions & 0 deletions variants/rak4631_epaper_onrxtx/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 3 additions & 0 deletions variants/t-echo/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit a143f16

Please sign in to comment.