mirror of
https://github.com/luc-github/ESP3D.git
synced 2026-03-11 02:16:47 +01:00
### Maintenance page
* Add add tab color for mobile view
* Add spellcheck off / autocorect off in input
* Add disconnect button when authenticate enabled
* Add Invalid user or password message when authentication failed
### Board support
* Add ESP32 S2 support
* Add ESP32 S3 support
* Add ESP32 C3 support
### ESP commands
* Add command 701 to control GCODE streaming
* Remove command 901 as duplicate
* Update command 420 to add more details
* Use text as default output
* All json on all commands for formated output
### Core
* Add benchmak function to check transfer speed (for test only-not production)
* Merge code for ESP3DLib support
* Add better printer display support (M117 / Serial TFT)
* Use ESP32 analogWrite instead of emulated one
### Modules
* Display
* Refactor code
* Remove SPI ILI 9341 / 9488 support as not suitable
* Add ST7789 support (135x240 / 240x240)
* Filesystem
* Bug fixes due to esp core updates
* Better SD sharing mecanism
* Better global FS management
* FTP
* Add SD sharing support
* Better global FS management
* GCODE Host
* Add basic support for macro files
* Add ESP command support
* Use not blocking method to stream commands / handle response
* Notifications
* Add IFTTT notification service
* Add WebUI notification
* Add ESP3D display notification
* WebDav
* Add SD sharing support
* Add bug fix from https://github.com/d-a-v/ESPWebDAV
* Better global FS management
* Websocket
* Add function to handle zombies connections
* WiFi
* Fix connection to AP sometime fail
* Fix low signal not diplayed in ESP420 even connected
* Add AP Setup mode
### Libraries
* Update SDFat-2.0.6 to 2.1.2
* Update ESP32SSDP 1.1.1 to 1.2.0
* Update TFT_eSPI-1.4.11 to 2.4.61
* Update arduinoWebSockets-2.3.5 to 2.3.6
* Update esp8266-oled-ssd1306-4.0.0 to 4.3.0
* Remove lvgl support
### Tools
* Add I2C scanner script
* Add python script to simulate/stress printer serial communication
### PlatformIO
* Use latest 4.4.0 Espressif32 release (ESP32-arduino core 2.0.3)
* Add fix for Flash more than 4MB
* Add Esp32 S2/S3/C3 env
* Add ESP32-ST7789 / esp32-TTGO_T_Display env
106 lines
3.1 KiB
C++
106 lines
3.1 KiB
C++
/***************************************************************************************
|
|
** Code for the GFX button UI element
|
|
** Grabbed from Adafruit_GFX library and enhanced to handle any label font
|
|
***************************************************************************************/
|
|
TFT_eSPI_Button::TFT_eSPI_Button(void) {
|
|
_gfx = nullptr;
|
|
_xd = 0;
|
|
_yd = 0;
|
|
_textdatum = MC_DATUM;
|
|
_label[9] = '\0';
|
|
}
|
|
|
|
// Classic initButton() function: pass center & size
|
|
void TFT_eSPI_Button::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)
|
|
{
|
|
// Tweak arguments and pass to the newer initButtonUL() function...
|
|
initButtonUL(gfx, x - (w / 2), y - (h / 2), w, h, outline, fill,
|
|
textcolor, label, textsize);
|
|
}
|
|
|
|
// Newer function instead accepts upper-left corner & size
|
|
void TFT_eSPI_Button::initButtonUL(
|
|
TFT_eSPI *gfx, int16_t x1, int16_t y1, uint16_t w, uint16_t h,
|
|
uint16_t outline, uint16_t fill, uint16_t textcolor,
|
|
char *label, uint8_t textsize)
|
|
{
|
|
_x1 = x1;
|
|
_y1 = y1;
|
|
_w = w;
|
|
_h = h;
|
|
_outlinecolor = outline;
|
|
_fillcolor = fill;
|
|
_textcolor = textcolor;
|
|
_textsize = textsize;
|
|
_gfx = gfx;
|
|
strncpy(_label, label, 9);
|
|
}
|
|
|
|
// Adjust text datum and x, y deltas
|
|
void TFT_eSPI_Button::setLabelDatum(int16_t x_delta, int16_t y_delta, uint8_t datum)
|
|
{
|
|
_xd = x_delta;
|
|
_yd = y_delta;
|
|
_textdatum = datum;
|
|
}
|
|
|
|
void TFT_eSPI_Button::drawButton(bool inverted, String long_name) {
|
|
uint16_t fill, outline, text;
|
|
|
|
if(!inverted) {
|
|
fill = _fillcolor;
|
|
outline = _outlinecolor;
|
|
text = _textcolor;
|
|
} else {
|
|
fill = _textcolor;
|
|
outline = _outlinecolor;
|
|
text = _fillcolor;
|
|
}
|
|
|
|
uint8_t r = min(_w, _h) / 4; // Corner radius
|
|
_gfx->fillRoundRect(_x1, _y1, _w, _h, r, fill);
|
|
_gfx->drawRoundRect(_x1, _y1, _w, _h, r, outline);
|
|
|
|
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->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);
|
|
|
|
_gfx->setTextDatum(tempdatum);
|
|
_gfx->setTextPadding(tempPadding);
|
|
}
|
|
}
|
|
|
|
bool TFT_eSPI_Button::contains(int16_t x, int16_t y) {
|
|
return ((x >= _x1) && (x < (_x1 + _w)) &&
|
|
(y >= _y1) && (y < (_y1 + _h)));
|
|
}
|
|
|
|
void TFT_eSPI_Button::press(bool p) {
|
|
laststate = currstate;
|
|
currstate = p;
|
|
}
|
|
|
|
bool TFT_eSPI_Button::isPressed() { return currstate; }
|
|
bool TFT_eSPI_Button::justPressed() { return (currstate && !laststate); }
|
|
bool TFT_eSPI_Button::justReleased() { return (!currstate && laststate); }
|