Skip to content

Commit 9ca0164

Browse files
committed
MagTag on Staging
1 parent 8ba32f8 commit 9ca0164

File tree

4 files changed

+36
-22
lines changed

4 files changed

+36
-22
lines changed

src/Wippersnapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,7 @@ ws_status_t Wippersnapper::run() {
29152915
WS.feedWDT();
29162916

29172917
// Process display controller events, if initialized
2918-
WS._displayController->update(getRSSI(), networkStatus() == WS_CONNECTED);
2918+
//WS._displayController->update(getRSSI(), networkStatus() == WS_CONNECTED);
29192919
WS.feedWDT();
29202920

29212921
return WS_NET_CONNECTED; // TODO: Make this funcn void!

src/components/display/controller.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ bool DisplayController::Handle_Display_AddOrReplace(
6969
return false;
7070
}
7171

72-
WS.feedWDT();
73-
display->showSplash();
72+
//WS.feedWDT();
73+
//display->showSplash();
7474
WS.feedWDT();
7575
display->drawStatusBar(WS._config.aio_user);
7676
WS.feedWDT();

src/components/display/drivers/dispDrvSt7789.h

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ class dispDrvSt7789 : public dispDrvBase {
4444
int16_t rst = -1, int16_t miso = -1)
4545
: dispDrvBase(cs, dc, mosi, sck, rst, miso), _display(nullptr) {}
4646

47+
/*!
48+
@brief Destructor for the ST7789 display driver.
49+
*/
4750
~dispDrvSt7789() {
4851
if (_display) {
4952
delete _display;
5053
_display = nullptr;
5154
}
55+
//digitalWrite(TFT_BACKLIGHT, LOW);
5256
}
5357

5458
/*!
@@ -57,30 +61,21 @@ class dispDrvSt7789 : public dispDrvBase {
5761
*/
5862
bool begin() override {
5963

60-
// Special power control configuration for
61-
// boards with built-in TFTs
62-
#if defined(TFT_BACKLITE)
63-
// turn on backlite
64-
pinMode(TFT_BACKLITE, OUTPUT);
65-
digitalWrite(TFT_BACKLITE, HIGH);
66-
67-
#if defined(TFT_I2C_POWER)
68-
// turn on the TFT / I2C power supply
69-
pinMode(TFT_I2C_POWER, OUTPUT);
70-
digitalWrite(TFT_I2C_POWER, HIGH);
71-
delay(10);
72-
#endif // TFT_I2C_POWER
73-
#endif
74-
7564
_display = new Adafruit_ST7789(_pin_cs, _pin_dc, _pin_rst);
7665
if (!_display)
7766
return false;
7867

7968
_display->init(_width, _height);
8069
_display->setRotation(_rotation);
8170
setTextSize(ST7789_TEXT_SZ_DEFAULT);
82-
_display->fillScreen(ST77XX_BLACK);
71+
_display->fillScreen(ST77XX_WHITE);
8372
_display->setTextColor(ST77XX_WHITE);
73+
74+
/* #ifdef TFT_BACKLIGHT
75+
pinMode(TFT_BACKLIGHT, OUTPUT);
76+
digitalWrite(TFT_BACKLIGHT, HIGH); // Backlight on
77+
#endif */
78+
8479
return true;
8580
}
8681

@@ -115,7 +110,7 @@ class dispDrvSt7789 : public dispDrvBase {
115110
return;
116111
}
117112

118-
delay(1000);
113+
delay(1500); // Pause for 1.5 seconds
119114
}
120115

121116
/*!

src/components/display/hardware.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ using FnCreateDispDrvTft = std::function<dispDrvBase *(
4444
// NOTE: When you add a new SPI TFT display driver, make sure to add it to the
4545
// factory!
4646
static const std::map<std::string, FnCreateDispDrvTft> FactoryDrvDispTft = {
47-
{"st7735",
47+
{"tft-154-wide-angle",
4848
[](int16_t cs, int16_t dc, int16_t mosi, int16_t sck, int16_t rst,
4949
int16_t miso) -> dispDrvBase * {
5050
return new dispDrvSt7789(cs, dc, mosi, sck, rst, miso);
5151
}},
52-
{"st7789",
52+
{"tft-154-wide-angle",
5353
[](int16_t cs, int16_t dc, int16_t mosi, int16_t sck, int16_t rst,
5454
int16_t miso) -> dispDrvBase * {
5555
return new dispDrvSt7789(cs, dc, mosi, sck, rst, miso);
@@ -344,12 +344,31 @@ bool DisplayHardware::beginTft(
344344
}
345345

346346
// Create display driver object using the factory function
347+
WS_DEBUG_PRINTLN("[display] Creating TFT display driver with pinout: ");
348+
WS_DEBUG_PRINT(" CS: D"); WS_DEBUG_PRINTLN(cs);
349+
WS_DEBUG_PRINT(" DC: D"); WS_DEBUG_PRINTLN(dc);
350+
WS_DEBUG_PRINT(" MOSI: D");WS_DEBUG_PRINTLN(mosi);
351+
WS_DEBUG_PRINT(" SCK: D"); WS_DEBUG_PRINTLN(sck);
352+
if (rst != -1) {
353+
WS_DEBUG_PRINT(" RST: D"); WS_DEBUG_PRINTLN(rst);
354+
}
355+
if (miso != -1) {
356+
WS_DEBUG_PRINT(" MISO: D"); WS_DEBUG_PRINTLN(miso);
357+
}
347358
_drvDisp = CreateDrvDispTft(_name, cs, dc, mosi, sck, rst, miso);
348359
if (!_drvDisp) {
349360
WS_DEBUG_PRINTLN("[display] Failed to create display driver!");
350361
return false;
351362
}
352363

364+
// Print configuration
365+
WS_DEBUG_PRINTLN("[display] Successfully created tft display driver!");
366+
WS_DEBUG_PRINTLN("[display] TFT configuration:");
367+
WS_DEBUG_PRINT(" Width: "); WS_DEBUG_PRINTLN(config->width);
368+
WS_DEBUG_PRINT(" Height: ");WS_DEBUG_PRINTLN(config->height);
369+
WS_DEBUG_PRINT(" Rotation: ");WS_DEBUG_PRINTLN(config->rotation);
370+
WS_DEBUG_PRINT(" Text Size: ");WS_DEBUG_PRINTLN(text_sz);
371+
353372
_drvDisp->setWidth(config->width);
354373
_drvDisp->setHeight(config->height);
355374
_drvDisp->setRotation(config->rotation);

0 commit comments

Comments
 (0)