Skip to content

Commit 617a594

Browse files
committed
new wifi implementation + new screen drivers
1 parent fd0d73a commit 617a594

181 files changed

Lines changed: 31623 additions & 758 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ jobs:
5050
cp ${pioenv}/firmware.bin firmware_output/${pioenv}.bin
5151
cp ${pioenv}/merged-firmware.bin firmware_output/${pioenv}_full.bin
5252
53+
- name: Build & Package esp32-s3-N16R8-extuart Firmware
54+
run: |
55+
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=\"${{ github.ref_name }}\" -D SHA=$GITHUB_SHA"
56+
pioenv=esp32-s3-N16R8-extuart
57+
pio run --environment ${pioenv}
58+
mkdir ${pioenv}
59+
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin ${pioenv}/boot_app0.bin
60+
cp .pio/build/${pioenv}/firmware.bin ${pioenv}/firmware.bin
61+
cp .pio/build/${pioenv}/bootloader.bin ${pioenv}/bootloader.bin
62+
cp .pio/build/${pioenv}/partitions.bin ${pioenv}/partitions.bin
63+
cd ${pioenv}
64+
esptool.py --chip esp32-s3 merge_bin -o merged-firmware.bin --flash_mode dio --flash_freq 80m --flash_size 16MB 0x0000 bootloader.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 firmware.bin
65+
cd ..
66+
cp ${pioenv}/firmware.bin firmware_output/${pioenv}.bin
67+
cp ${pioenv}/merged-firmware.bin firmware_output/${pioenv}_full.bin
68+
5369
- name: Build & Package esp32-s3-N8R8 Firmware
5470
run: |
5571
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=\"${{ github.ref_name }}\" -D SHA=$GITHUB_SHA"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ dkms.conf
7777
.clang_complete
7878
.gcc-flags.json
7979
.pio
80+
.vscode
8081

8182
### Other files
8283
.idea

lib/Seeed_GFX/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
idf_component_register(SRCS "TFT_eSPI.cpp"
2+
INCLUDE_DIRS "."
3+
"Extensions"
4+
REQUIRES driver arduino-esp32
5+
)
6+
7+
8+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation")
9+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-misleading-indentation")
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/***************************************************************************************
2+
** Code for the GFX button UI element
3+
** Grabbed from Adafruit_GFX library and enhanced to handle any label font
4+
***************************************************************************************/
5+
TFT_eSPI_Button::TFT_eSPI_Button(void) {
6+
_gfx = nullptr;
7+
_xd = 0;
8+
_yd = 0;
9+
_textdatum = MC_DATUM;
10+
_label[9] = '\0';
11+
currstate = false;
12+
laststate = false;
13+
}
14+
15+
// Classic initButton() function: pass center & size
16+
void TFT_eSPI_Button::initButton(
17+
TFT_eSPI *gfx, int16_t x, int16_t y, uint16_t w, uint16_t h,
18+
uint16_t outline, uint16_t fill, uint16_t textcolor,
19+
char *label, uint8_t textsize)
20+
{
21+
// Tweak arguments and pass to the newer initButtonUL() function...
22+
initButtonUL(gfx, x - (w / 2), y - (h / 2), w, h, outline, fill,
23+
textcolor, label, textsize);
24+
}
25+
26+
// Newer function instead accepts upper-left corner & size
27+
void TFT_eSPI_Button::initButtonUL(
28+
TFT_eSPI *gfx, int16_t x1, int16_t y1, uint16_t w, uint16_t h,
29+
uint16_t outline, uint16_t fill, uint16_t textcolor,
30+
char *label, uint8_t textsize)
31+
{
32+
_x1 = x1;
33+
_y1 = y1;
34+
_w = w;
35+
_h = h;
36+
_outlinecolor = outline;
37+
_fillcolor = fill;
38+
_textcolor = textcolor;
39+
_textsize = textsize;
40+
_gfx = gfx;
41+
strncpy(_label, label, 9);
42+
}
43+
44+
// Adjust text datum and x, y deltas
45+
void TFT_eSPI_Button::setLabelDatum(int16_t x_delta, int16_t y_delta, uint8_t datum)
46+
{
47+
_xd = x_delta;
48+
_yd = y_delta;
49+
_textdatum = datum;
50+
}
51+
52+
void TFT_eSPI_Button::drawButton(bool inverted, String long_name) {
53+
uint16_t fill, outline, text;
54+
55+
if(!inverted) {
56+
fill = _fillcolor;
57+
outline = _outlinecolor;
58+
text = _textcolor;
59+
} else {
60+
fill = _textcolor;
61+
outline = _outlinecolor;
62+
text = _fillcolor;
63+
}
64+
65+
uint8_t r = min(_w, _h) / 4; // Corner radius
66+
_gfx->fillRoundRect(_x1, _y1, _w, _h, r, fill);
67+
_gfx->drawRoundRect(_x1, _y1, _w, _h, r, outline);
68+
69+
if (_gfx->textfont == 255) {
70+
_gfx->setCursor(_x1 + (_w / 8),
71+
_y1 + (_h / 4));
72+
_gfx->setTextColor(text);
73+
_gfx->setTextSize(_textsize);
74+
_gfx->print(_label);
75+
}
76+
else {
77+
_gfx->setTextColor(text, fill);
78+
_gfx->setTextSize(_textsize);
79+
80+
uint8_t tempdatum = _gfx->getTextDatum();
81+
_gfx->setTextDatum(_textdatum);
82+
uint16_t tempPadding = _gfx->getTextPadding();
83+
_gfx->setTextPadding(0);
84+
85+
if (long_name == "")
86+
_gfx->drawString(_label, _x1 + (_w/2) + _xd, _y1 + (_h/2) - 4 + _yd);
87+
else
88+
_gfx->drawString(long_name, _x1 + (_w/2) + _xd, _y1 + (_h/2) - 4 + _yd);
89+
90+
_gfx->setTextDatum(tempdatum);
91+
_gfx->setTextPadding(tempPadding);
92+
}
93+
}
94+
95+
bool TFT_eSPI_Button::contains(int16_t x, int16_t y) {
96+
return ((x >= _x1) && (x < (_x1 + _w)) &&
97+
(y >= _y1) && (y < (_y1 + _h)));
98+
}
99+
100+
void TFT_eSPI_Button::press(bool p) {
101+
laststate = currstate;
102+
currstate = p;
103+
}
104+
105+
bool TFT_eSPI_Button::isPressed() { return currstate; }
106+
bool TFT_eSPI_Button::justPressed() { return (currstate && !laststate); }
107+
bool TFT_eSPI_Button::justReleased() { return (!currstate && laststate); }

lib/Seeed_GFX/Extensions/Button.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/***************************************************************************************
2+
// The following button class has been ported over from the Adafruit_GFX library so
3+
// should be compatible.
4+
// A slightly different implementation in this TFT_eSPI library allows the button
5+
// legends to be in any font, allow longer labels and to adjust text positioning
6+
// within button
7+
***************************************************************************************/
8+
9+
class TFT_eSPI_Button
10+
{
11+
public:
12+
TFT_eSPI_Button(void);
13+
// "Classic" initButton() uses centre & size
14+
void initButton(TFT_eSPI *gfx, int16_t x, int16_t y,
15+
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
16+
uint16_t textcolor, char *label, uint8_t textsize);
17+
18+
// New/alt initButton() uses upper-left corner & size
19+
void initButtonUL(TFT_eSPI *gfx, int16_t x1, int16_t y1,
20+
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
21+
uint16_t textcolor, char *label, uint8_t textsize);
22+
23+
// Adjust text datum and x, y deltas
24+
void setLabelDatum(int16_t x_delta, int16_t y_delta, uint8_t datum = MC_DATUM);
25+
26+
void drawButton(bool inverted = false, String long_name = "");
27+
bool contains(int16_t x, int16_t y);
28+
29+
void press(bool p);
30+
bool isPressed();
31+
bool justPressed();
32+
bool justReleased();
33+
34+
private:
35+
TFT_eSPI *_gfx;
36+
int16_t _x1, _y1; // Coordinates of top-left corner of button
37+
int16_t _xd, _yd; // Button text datum offsets (wrt centre of button)
38+
uint16_t _w, _h; // Width and height of button
39+
uint8_t _textsize, _textdatum; // Text size multiplier and text datum for button
40+
uint16_t _outlinecolor, _fillcolor, _textcolor;
41+
char _label[10]; // Button text is 9 chars maximum unless long_name used
42+
43+
bool currstate, laststate; // Button states
44+
};

0 commit comments

Comments
 (0)