Skip to content

Commit

Permalink
Merge pull request #20 from cr0bar/main
Browse files Browse the repository at this point in the history
LilyGo T-Display-S3 Support
  • Loading branch information
arcbtc authored Jan 21, 2025
2 parents 4769bde + 9f2eca2 commit 1956e59
Show file tree
Hide file tree
Showing 469 changed files with 309,188 additions and 5,798 deletions.
36 changes: 36 additions & 0 deletions libraries/TFT_eSPI/.github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Issue template
about: Guide to content
title: ''
labels: ''
assignees: ''

---

Only raise issues for problems with the library and/or provided examples. Post questions, comments and useful tips etc in the "Discussions" section.

To minimise effort to resolve issues the following should be provided as a minimum:
1. A description of the problem and the conditions that cause it to occur
2. IDE (e.g. Arduino or PlatformIO)
3. TFT_eSPI library version (try the latest, the problem may have been resolved!) from the Manage Libraries... menu
4. Board package version (e.g. 2.0.3) available from the Boards Manager... menu
5. Procesor, e.g RP2040, ESP32 S3 etc
6. TFT driver (e.g. ILI9341), a link to the vendors product web page is useful too.
7. Interface type (SPI or parallel)

Plus further information as appropriate to the problem:
1. TFT to processor connections used
2. A zip file containing your setup file (just drag and drop in message window - do not paste in long files!)
3. A zip file containing a simple and complete example sketch that demonstrates the problem but needs no special hardware sensors or libraries.
4. Screen shot pictures showing the problem (just drag and drop in message window)

The idea is to provide sufficient information so I can setup the exact same (or sufficiently similar) scenario to investigate and resolve the issue without having a tedious ping-pong of Q&A.

DO NOT paste code directly into the issue. To correctly format code put three ticks ( ` character on key next to "1" key) at the start and end of short pasted code segments to avoid format/markup anomolies. [See here:](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code)

Example output:

```
Serial.begin(115200);
tft.init();
```
5 changes: 5 additions & 0 deletions libraries/TFT_eSPI/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

# Arduino debug
debug.cfg
debug_custom.json
*.svd

# =========================
# Operating System Files
# =========================
Expand Down
1 change: 1 addition & 0 deletions libraries/TFT_eSPI/.piopm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "library", "name": "TFT_eSPI", "version": "2.5.43", "spec": {"owner": "bodmer", "id": 1559, "name": "TFT_eSPI", "requirements": null, "uri": null}}
4 changes: 4 additions & 0 deletions libraries/TFT_eSPI/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

idf_component_register(SRCS "TFT_eSPI.cpp"
INCLUDE_DIRS "."
PRIV_REQUIRES arduino)
38 changes: 25 additions & 13 deletions libraries/TFT_eSPI/Extensions/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
** Grabbed from Adafruit_GFX library and enhanced to handle any label font
***************************************************************************************/
TFT_eSPI_Button::TFT_eSPI_Button(void) {
_gfx = 0;
_gfx = nullptr;
_xd = 0;
_yd = 0;
_textdatum = MC_DATUM;
_label[9] = '\0';
currstate = false;
laststate = false;
}

// Classic initButton() function: pass center & size
Expand Down Expand Up @@ -63,21 +66,30 @@ void TFT_eSPI_Button::drawButton(bool inverted, String long_name) {
_gfx->fillRoundRect(_x1, _y1, _w, _h, r, fill);
_gfx->drawRoundRect(_x1, _y1, _w, _h, r, outline);

_gfx->setTextColor(text, fill);
_gfx->setTextSize(_textsize);
if (_gfx->textfont == 255) {
_gfx->setCursor(_x1 + (_w / 8),
_y1 + (_h / 4));
_gfx->setTextColor(text);
_gfx->setTextSize(_textsize);
_gfx->print(_label);
}
else {
_gfx->setTextColor(text, fill);
_gfx->setTextSize(_textsize);

uint8_t tempdatum = _gfx->getTextDatum();
_gfx->setTextDatum(_textdatum);
uint16_t tempPadding = _gfx->padX;
_gfx->setTextPadding(0);
uint8_t tempdatum = _gfx->getTextDatum();
_gfx->setTextDatum(_textdatum);
uint16_t tempPadding = _gfx->getTextPadding();
_gfx->setTextPadding(0);

if (long_name == "")
_gfx->drawString(_label, _x1 + (_w/2) + _xd, _y1 + (_h/2) - 4 + _yd);
else
_gfx->drawString(long_name, _x1 + (_w/2) + _xd, _y1 + (_h/2) - 4 + _yd);
if (long_name == "")
_gfx->drawString(_label, _x1 + (_w/2) + _xd, _y1 + (_h/2) - 4 + _yd);
else
_gfx->drawString(long_name, _x1 + (_w/2) + _xd, _y1 + (_h/2) - 4 + _yd);

_gfx->setTextDatum(tempdatum);
_gfx->setTextPadding(tempPadding);
_gfx->setTextDatum(tempdatum);
_gfx->setTextPadding(tempPadding);
}
}

bool TFT_eSPI_Button::contains(int16_t x, int16_t y) {
Expand Down
8 changes: 4 additions & 4 deletions libraries/TFT_eSPI/Extensions/Button.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// within button
***************************************************************************************/

class TFT_eSPI_Button {

class TFT_eSPI_Button
{
public:
TFT_eSPI_Button(void);
// "Classic" initButton() uses center & size
// "Classic" initButton() uses centre & size
void initButton(TFT_eSPI *gfx, int16_t x, int16_t y,
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
uint16_t textcolor, char *label, uint8_t textsize);
Expand All @@ -34,7 +34,7 @@ class TFT_eSPI_Button {
private:
TFT_eSPI *_gfx;
int16_t _x1, _y1; // Coordinates of top-left corner of button
int16_t _xd, _yd; // Button text datum offsets (wrt center of button)
int16_t _xd, _yd; // Button text datum offsets (wrt centre of button)
uint16_t _w, _h; // Width and height of button
uint8_t _textsize, _textdatum; // Text size multiplier and text datum for button
uint16_t _outlinecolor, _fillcolor, _textcolor;
Expand Down
Loading

0 comments on commit 1956e59

Please sign in to comment.