TTGO T-Display Usermod Updates (#1565)

* Adding new usermod for TTGO T-DIsplay.

* Finalizing the code

* Modified and cleaned up readme.md file

* Fixes to platformio.ini to restore back to previous state

* Cleaned up comments in usermod file

* Updated readme with clarifications on how to modify the library files.  Saving the platformio.ini file after uncommenting the line to add the TFT_eSPI library should download the necessary library files without needing to build (and fail) first.

* Cleanup

* Readme cleanup

* corrected error in commenting platformio.ini

* updated usermod to add more info to built-in display, revised readme, added images for readme

* readme file updates
This commit is contained in:
spiff72 2020-12-27 13:33:51 -05:00 committed by GitHub
parent c5818ff5e4
commit ad6c154eb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 14 deletions

View File

@ -3,14 +3,24 @@ This usermod allows use of the TTGO T-Display ESP32 module with integrated 240x1
for controlling WLED and showing the following information:
* Current SSID
* IP address if obtained
* in AP mode and turned off lightning AP password is shown
* If connected to a network, current brightness % is shown
* in AP mode AP IP and password are shown
* Current effect
* Current palette
* Estimated current in mA is shown (NOTE: for this to be a reasonable value, the correct LED type must be specified in the LED Prefs section)
Button pin is mapped to the onboard button next to the side actuated reset button of the TTGO T-Display board.
I have designed a 3D printed case around this board and an ["ElectroCookie"](https://amzn.to/2WCNeeA) project board, a [level shifter](https://amzn.to/3hbKu18), a [buck regulator](https://amzn.to/3mLMy0W), and a DC [power jack](https://amzn.to/3phj9NZ). I use 12V WS2815 LED strips for my projects, and power them with 12V power supplies, so the regulator drops the voltage to the 5V level I need to power the ESP module and the level shifter. If there is any interest in this case, which elevates the board and display on some custom extended headers to make place the screen at the top of the enclosure (with accessible buttons), let me know, and I could post the STL files. It is a bit tricky to get the height correct, so I also designed a one-time use 3D printed solder fixture to set the board in the right location and at the correct height for the housing. (It is one-time use because it has to be cut off after soldering to be able to remove it). I didn't think the effort to make it in multiple pieces was worthwhile.
Usermod based on a rework of the ssd1306_i2c_oled_u8g2 usermod from the WLED repo.
## Hardware
![Hardware](assets/ttgo_hardware1.png)
![Hardware](assets/ttgo-tdisplay-enclosure1a.png)
![Hardware](assets/ttgo-tdisplay-enclosure2a.png)
![Hardware](assets/ttgo-tdisplay-enclosure3a.png)
![Hardware](assets/ttgo-tdisplay-enclosure3a.png)
## Github reference for TTGO-Tdisplay
@ -20,7 +30,11 @@ Usermod based on a rework of the ssd1306_i2c_oled_u8g2 usermod from the WLED rep
Functionality checked with:
* TTGO T-Display
* PlatformIO
* Group of 4 individual Neopixels from Adafruit, and a full string of 68 LEDs.
* Group of 4 individual Neopixels from Adafruit, and a several full strings of 12v WS2815 LEDs.
* The hardware design shown above should be limited to shorter strings. For larger strings, I use a different setup with a dedicated 12v power supply and power them directly off the supply (in addition to dropping the 12v supply down to 5v with a buck regulator for the ESP module and level shifter).
## Setup Needed:
* As with all usermods, copy the usermod.cpp file from the TTGO-T-Display usermod folder to the wled00 folder (replacing the default usermod.cpp file).
## Platformio Requirements
### Platformio.ini changes

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 KiB

View File

@ -56,7 +56,7 @@ void userSetup() {
tft.setTextColor(TFT_WHITE);
tft.setCursor(1, 10);
tft.setTextDatum(MC_DATUM);
tft.setTextSize(2);
tft.setTextSize(3);
tft.print("Loading...");
if (TFT_BL > 0) { // TFT_BL has been set in the TFT_eSPI library in the User Setup file TTGO_T_Display.h
@ -142,22 +142,41 @@ void userLoop() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(2);
// First row with Wifi name
tft.setCursor(1, 10);
tft.setCursor(1, 1);
tft.print(knownSsid.substring(0, tftcharwidth > 1 ? tftcharwidth - 1 : 0));
// Print `~` char to indicate that SSID is longer, than our dicplay
if (knownSsid.length() > tftcharwidth)
tft.print("~");
// Second row with IP or Psssword
tft.setCursor(1, 40);
// Print password in AP mode and if led is OFF.
if (apActive && bri == 0)
tft.print(apPass);
else
// Second row with AP IP and Password or IP
tft.setTextSize(2);
tft.setCursor(1, 24);
// Print AP IP and password in AP mode or knownIP if AP not active.
// if (apActive && bri == 0)
// tft.print(apPass);
// else
// tft.print(knownIp);
if (apActive) {
tft.print("AP IP: ");
tft.print(knownIp);
tft.setCursor(1,46);
tft.print("AP Pass:");
tft.print(apPass);
}
else {
tft.print("IP: ");
tft.print(knownIp);
tft.setCursor(1,46);
//tft.print("Signal Strength: ");
//tft.print(i.wifi.signal);
tft.print("Brightness: ");
tft.print(((float(bri)/255)*100));
tft.print("%");
}
// Third row with mode name
tft.setCursor(1, 70);
tft.setCursor(1, 68);
uint8_t qComma = 0;
bool insideQuotes = false;
uint8_t printedChars = 0;
@ -184,7 +203,7 @@ void userLoop() {
break;
}
// Fourth row with palette name
tft.setCursor(1, 100);
tft.setCursor(1, 90);
qComma = 0;
insideQuotes = false;
printedChars = 0;
@ -210,5 +229,10 @@ void userLoop() {
if ((qComma > knownPalette) || (printedChars > tftcharwidth - 1))
break;
}
}
// 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("mA (estimated)");
}