-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corrected forced version number for TFT_eSPI #4423
base: main
Are you sure you want to change the base?
Changes from 2 commits
1466dde
79f3ef9
2646165
7d5b67d
3325b0b
e28f045
98215f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,8 +1,49 @@ | ||||||||||||||||||||
[env:esp32dev] | ||||||||||||||||||||
build_flags = ${common.build_flags_esp32} | ||||||||||||||||||||
; PIN defines - uncomment and change, if needed: | ||||||||||||||||||||
; -D LEDPIN=2 | ||||||||||||||||||||
-D BTNPIN=35 | ||||||||||||||||||||
# Example PlatformIO Project Configuration Override | ||||||||||||||||||||
# ------------------------------------------------------------------------------ | ||||||||||||||||||||
# Copy to platformio_override.ini to activate overrides | ||||||||||||||||||||
# ------------------------------------------------------------------------------ | ||||||||||||||||||||
# Please visit documentation: https://docs.platformio.org/page/projectconf.html | ||||||||||||||||||||
|
||||||||||||||||||||
[platformio] | ||||||||||||||||||||
#default_envs = WLED_tasmota_1M # define as many as you need | ||||||||||||||||||||
default_envs = WLED_T-Display # define as many as you need | ||||||||||||||||||||
#---------- | ||||||||||||||||||||
# SAMPLE | ||||||||||||||||||||
#---------- | ||||||||||||||||||||
[env:WLED_T-Display] | ||||||||||||||||||||
|
||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where do we define the pins needed by the display driver? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pins needed by the display are defined in the TFT_eSPI library when the user_setup_select.h file is modified (as described in the readme.md file). |
||||||||||||||||||||
board = esp32dev | ||||||||||||||||||||
upload_speed = 921600 | ||||||||||||||||||||
monitor_speed = 115200 | ||||||||||||||||||||
platform = ${esp32.platform} | ||||||||||||||||||||
platform_packages = ${esp32.platform_packages} | ||||||||||||||||||||
build_unflags = ${common.build_unflags} | ||||||||||||||||||||
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32\" | ||||||||||||||||||||
${esp32.AR_build_flags} | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be something like WLED_T-Display for the release name to indicate this is not a vanilla ESP32 build There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just fixed this - thanks! |
||||||||||||||||||||
; -D IRPIN=4 | ||||||||||||||||||||
; -D RLYPIN=12 | ||||||||||||||||||||
; -D RLYMDE=1 | ||||||||||||||||||||
; -D WLED_DISABLE_BROWNOUT_DET | ||||||||||||||||||||
;PIN defines - uncomment and change, if needed: | ||||||||||||||||||||
-D DATA_PINS=2 | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line 27 might be part of the problem you had with default pins - platformIO is very picky about indentations, and a comment starting at column 0 might be enough to "end" the multi-line string prematurely. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed (hopefully) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I confirmed that this issue has been fixed, and the data pin is being reassigned correctly. |
||||||||||||||||||||
;or use this for multiple outputs | ||||||||||||||||||||
;-D DATA_PINS=1,3 | ||||||||||||||||||||
-D BTNPIN=35 | ||||||||||||||||||||
; -D IRPIN=4 | ||||||||||||||||||||
; -D RLYPIN=12 | ||||||||||||||||||||
; -D RLYMDE=1 | ||||||||||||||||||||
; -D RLYODRAIN=0 | ||||||||||||||||||||
; -D LED_BUILTIN=2 # GPIO of built-in LED | ||||||||||||||||||||
lib_deps = ${esp32.lib_deps} | ||||||||||||||||||||
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line | ||||||||||||||||||||
;TFT_eSPI @ 2.5.33 | ||||||||||||||||||||
https://github.com/Bodmer/TFT_eSPI/archive/refs/tags/2.1.4.zip | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any special reason that TFT library is commented out? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes - the following line is forcing an older version (2.1.4) instead. |
||||||||||||||||||||
;https://github.com/Bodmer/TFT_eSPI/archive/refs/tags/2.1.9.zip | ||||||||||||||||||||
kosme/arduinoFFT @ 2.0.1 | ||||||||||||||||||||
monitor_filters = esp32_exception_decoder | ||||||||||||||||||||
board_build.partitions = ${esp32.default_partitions} | ||||||||||||||||||||
|
||||||||||||||||||||
; # additional build flags for audioreactive | ||||||||||||||||||||
; AR_build_flags = -D USERMOD_AUDIOREACTIVE | ||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The part for audioreactive is outdated - please replace with the proposed flags from platformio_override.sample.ini WLED/platformio_override.sample.ini Lines 143 to 150 in ae4de27
WLED/platformio_override.sample.ini Line 32 in ae4de27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corrected. |
||||||||||||||||||||
; -D sqrt_internal=sqrtf ;; -fsingle-precision-constant ;; forces ArduinoFFT to use float math (2x faster) | ||||||||||||||||||||
; AR_lib_deps = kosme/arduinoFFT @ 2.0.1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,27 +21,28 @@ | |
//Use userVar0 and userVar1 (API calls &U0=,&U1=, uint16_t) | ||
|
||
#include "wled.h" | ||
#include <TFT_eSPI.h> | ||
#include <SPI.h> | ||
#include <TFT_eSPI.h> | ||
#include "WiFi.h" | ||
#include <Wire.h> | ||
|
||
#ifndef TFT_DISPOFF | ||
#define TFT_DISPOFF 0x28 | ||
#endif | ||
// #ifndef TFT_DISPOFF | ||
// #define TFT_DISPOFF 0x28 | ||
// #endif | ||
|
||
#ifndef TFT_SLPIN | ||
#define TFT_SLPIN 0x10 | ||
#endif | ||
// #ifndef TFT_SLPIN | ||
// #define TFT_SLPIN 0x10 | ||
// #endif | ||
|
||
#define TFT_MOSI 19 | ||
#define TFT_SCLK 18 | ||
#define TFT_CS 5 | ||
#define TFT_DC 16 | ||
#define TFT_RST 23 | ||
// #define TFT_MOSI 19 | ||
// #define TFT_SCLK 18 | ||
// #define TFT_CS 5 | ||
// #define TFT_DC 16 | ||
// #define TFT_RST 23 | ||
|
||
#define TFT_BL 4 // Display backlight control pin | ||
#define ADC_EN 14 // Used for enabling battery voltage measurements - not used in this program | ||
//#define TFT_BL 4 // Display backlight control pin | ||
//#define ADC_EN 14 // Used for enabling battery voltage measurements - not used in this program | ||
//#define WLED_WATCHDOG_TIMEOUT 3 | ||
|
||
TFT_eSPI tft = TFT_eSPI(135, 240); // Invoke custom library | ||
|
||
|
@@ -53,11 +54,14 @@ void userSetup() { | |
tft.setRotation(3); //Rotation here is set up for the text to be readable with the port on the left. Use 1 to flip. | ||
tft.fillScreen(TFT_BLACK); | ||
tft.setTextSize(2); | ||
//tft.setTextSize(1); | ||
tft.setTextColor(TFT_WHITE); | ||
tft.setCursor(1, 10); | ||
tft.setTextDatum(MC_DATUM); | ||
tft.setTextSize(3); | ||
//tft.setTextSize(1); | ||
tft.print("Loading..."); | ||
Serial.println("Loading..."); | ||
|
||
if (TFT_BL > 0) { // TFT_BL has been set in the TFT_eSPI library in the User Setup file TTGO_T_Display.h | ||
pinMode(TFT_BL, OUTPUT); // Set backlight pin to output mode | ||
|
@@ -83,7 +87,7 @@ uint8_t knownMode = 0; | |
uint8_t knownPalette = 0; | ||
uint8_t tftcharwidth = 19; // Number of chars that fit on screen with text size set to 2 | ||
|
||
long lastUpdate = 0; | ||
long lastUpdate_mod = 0; | ||
long lastRedraw = 0; | ||
bool displayTurnedOff = false; | ||
// How often we are redrawing screen | ||
|
@@ -92,10 +96,10 @@ bool displayTurnedOff = false; | |
void userLoop() { | ||
|
||
// Check if we time interval for redrawing passes. | ||
if (millis() - lastUpdate < USER_LOOP_REFRESH_RATE_MS) { | ||
if (millis() - lastUpdate_mod < USER_LOOP_REFRESH_RATE_MS) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's defined 5 lines prior (line 94) |
||
return; | ||
} | ||
lastUpdate = millis(); | ||
lastUpdate_mod = millis(); | ||
|
||
// Turn off display after 5 minutes with no change. | ||
if(!displayTurnedOff && millis() - lastRedraw > 5*60*1000) { | ||
|
@@ -140,6 +144,7 @@ void userLoop() { | |
knownPalette = strip.getMainSegment().palette; | ||
|
||
tft.fillScreen(TFT_BLACK); | ||
//tft.setTextColor(TFT_WHITE); | ||
tft.setTextSize(2); | ||
// First row with Wifi name | ||
tft.setCursor(1, 1); | ||
|
@@ -156,7 +161,7 @@ void userLoop() { | |
// tft.print(apPass); | ||
// else | ||
// tft.print(knownIp); | ||
|
||
Serial.println("Print known AP"); | ||
if (apActive) { | ||
tft.print("AP IP: "); | ||
tft.print(knownIp); | ||
|
@@ -165,6 +170,7 @@ void userLoop() { | |
tft.print(apPass); | ||
} | ||
else { | ||
Serial.println("Print IP"); | ||
tft.print("IP: "); | ||
tft.print(knownIp); | ||
tft.setCursor(1,46); | ||
|
@@ -180,16 +186,23 @@ void userLoop() { | |
char lineBuffer[tftcharwidth+1]; | ||
extractModeName(knownMode, JSON_mode_names, lineBuffer, tftcharwidth); | ||
tft.print(lineBuffer); | ||
Serial.println("Print mode name"); | ||
|
||
// Fourth row with palette name | ||
tft.setCursor(1, 90); | ||
extractModeName(knownPalette, JSON_palette_names, lineBuffer, tftcharwidth); | ||
tft.print(lineBuffer); | ||
Serial.println("Print palette"); | ||
|
||
// Fifth row with estimated mA usage | ||
tft.setCursor(1, 112); | ||
// Print estimated milliamp usage (must specify the LED type in LED prefs for this to be a reasonable estimate). | ||
tft.print(strip.currentMilliamps); | ||
//tft.print(strip.currentMilliamps); | ||
tft.print(BusManager::currentMilliamps()); | ||
Serial.print(BusManager::currentMilliamps()); | ||
Serial.println(" mA (estimated)"); | ||
//tft.print("test "); | ||
tft.print("mA (estimated)"); | ||
Serial.println("Print estimated current"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"I am unable to get the overrides to change the initial pin setting of 16 (which conflicts with the display)."
@spiff72 using
-D DATA_PINS=2
did not work?Actually any build_flags for pin assignment will be overwritten by your cfg.json, so you'll need to wipe your device first if you want to test default pins assigned in build_flags.
WLED/platformio_override.sample.ini
Lines 61 to 70 in ae4de27