Skip to content

Commit 9337645

Browse files
author
Scott Powell
committed
Merge branch 'dev'
2 parents b2b755c + 1e263ca commit 9337645

Some content is hidden

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

58 files changed

+1750
-131
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"ldscript": "nrf52840_s140_v7.ld"
5+
},
6+
"core": "nRF5",
7+
"cpu": "cortex-m4",
8+
"extra_flags": "-DARDUINO_Seeed_XIAO_nRF52840 -DNRF52840_XXAA -DSEEED_XIAO_NRF52840 ",
9+
"f_cpu": "64000000L",
10+
"hwids": [
11+
[ "0x2886", "0x8044" ],
12+
[ "0x2886", "0x0044" ]
13+
],
14+
"mcu": "nrf52840",
15+
"variant": "Seeed_XIAO_nRF52840",
16+
"softdevice": {
17+
"sd_flags": "-DS140",
18+
"sd_name": "s140",
19+
"sd_version": "7.3.0",
20+
"sd_fwid": "0x0123"
21+
},
22+
"bsp": {
23+
"name": "adafruit"
24+
},
25+
"bootloader": {
26+
"settings_addr": "0xFF000"
27+
},
28+
"usb_product": "XIAO nRF52840"
29+
},
30+
"connectivity": [
31+
"bluetooth"
32+
],
33+
"debug": {
34+
"jlink_device": "nRF52840_xxAA",
35+
"openocd_target": "nrf52.cfg",
36+
"svd_path": "nrf52840.svd"
37+
},
38+
"frameworks": [
39+
"arduino"
40+
],
41+
"name": "Seeed Studio XIAO nRF52840",
42+
"upload": {
43+
"maximum_ram_size": 237568,
44+
"maximum_size": 811008,
45+
"protocol": "nrfutil",
46+
"speed": 115200,
47+
"protocols": [
48+
"jlink",
49+
"nrfjprog",
50+
"nrfutil",
51+
"cmsis-dap",
52+
"sam-ba",
53+
"blackmagic"
54+
],
55+
"use_1200bps_touch": true,
56+
"require_upload_port": true,
57+
"wait_for_upload_port": true
58+
},
59+
"url": "https://wiki.seeedstudio.com/XIAO_BLE",
60+
"vendor": "Seeed Studio"
61+
}

boards/t_beams3_supreme.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"build": {
3+
"arduino":{
4+
"ldscript": "esp32s3_out.ld",
5+
"partitions": "default.csv",
6+
"memory_type": "qio_qspi"
7+
},
8+
"core": "esp32",
9+
"extra_flags": [
10+
"-DARDUINO_USB_MODE=1",
11+
"-DARDUINO_USB_CDC_ON_BOOT=1",
12+
"-DARDUINO_RUNNING_CORE=1",
13+
"-DARDUINO_EVENT_RUNNING_CORE=1"
14+
],
15+
"f_cpu": "240000000L",
16+
"f_flash": "80000000L",
17+
"flash_mode": "qio",
18+
"hwids": [
19+
[
20+
"0x303A",
21+
"0x1001"
22+
]
23+
],
24+
"mcu": "esp32s3",
25+
"variant": "esp32s3"
26+
},
27+
"connectivity": [
28+
"wifi"
29+
],
30+
"debug": {
31+
"default_tool": "esp-builtin",
32+
"onboard_tools": [
33+
"esp-builtin"
34+
],
35+
"openocd_target": "esp32s3.cfg"
36+
},
37+
"frameworks": [
38+
"arduino",
39+
"espidf"
40+
],
41+
"name": "LilyGo T-Beam supreme (8MB Flash 8MB PSRAM)",
42+
"upload": {
43+
"flash_size": "8MB",
44+
"maximum_ram_size": 327680,
45+
"maximum_size": 8388608,
46+
"require_upload_port": true,
47+
"speed": 460800
48+
},
49+
"url": "https://www.lilygo.cc/products/t-beamsupreme-m",
50+
"vendor": "LilyGo"
51+
}

examples/companion_radio/UITask.cpp

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,30 @@ static const uint8_t meshcore_logo [] PROGMEM = {
2525
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
2626
};
2727

28-
void UITask::begin(DisplayDriver* display, const char* node_name, const char* build_date, uint32_t pin_code) {
28+
void UITask::begin(DisplayDriver* display, const char* node_name, const char* build_date, const char* firmware_version, uint32_t pin_code) {
2929
_display = display;
3030
_auto_off = millis() + AUTO_OFF_MILLIS;
3131
clearMsgPreview();
3232
_node_name = node_name;
33-
_build_date = build_date;
3433
_pin_code = pin_code;
3534
if (_display != NULL) {
3635
_display->turnOn();
3736
}
37+
38+
// strip off dash and commit hash by changing dash to null terminator
39+
// e.g: v1.2.3-abcdef -> v1.2.3
40+
char *version = strdup(firmware_version);
41+
char *dash = strchr(version, '-');
42+
if(dash){
43+
*dash = 0;
44+
}
45+
46+
#ifdef PIN_USER_BTN
47+
pinMode(PIN_USER_BTN, INPUT);
48+
#endif
49+
50+
// v1.2.3 (1 Jan 2025)
51+
sprintf(_version_info, "%s (%s)", version, build_date);
3852
}
3953

4054
void UITask::msgRead(int msgcount) {
@@ -47,6 +61,7 @@ void UITask::msgRead(int msgcount) {
4761
void UITask::clearMsgPreview() {
4862
_origin[0] = 0;
4963
_msg[0] = 0;
64+
_need_refresh = true;
5065
}
5166

5267
void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount) {
@@ -62,6 +77,7 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i
6277
if (_display != NULL) {
6378
if (!_display->isOn()) _display->turnOn();
6479
_auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer
80+
_need_refresh = true;
6581
}
6682
}
6783

@@ -73,38 +89,46 @@ void UITask::renderCurrScreen() {
7389
// render message preview
7490
_display->setCursor(0, 0);
7591
_display->setTextSize(1);
92+
_display->setColor(DisplayDriver::GREEN);
7693
_display->print(_node_name);
7794

7895
_display->setCursor(0, 12);
96+
_display->setColor(DisplayDriver::YELLOW);
7997
_display->print(_origin);
8098
_display->setCursor(0, 24);
99+
_display->setColor(DisplayDriver::LIGHT);
81100
_display->print(_msg);
82101

83-
_display->setCursor(100, 9);
102+
_display->setCursor(_display->width() - 28, 9);
84103
_display->setTextSize(2);
104+
_display->setColor(DisplayDriver::ORANGE);
85105
sprintf(tmp, "%d", _msgcount);
86106
_display->print(tmp);
87107
} else {
88108
// render 'home' screen
109+
_display->setColor(DisplayDriver::BLUE);
89110
_display->drawXbm(0, 0, meshcore_logo, 128, 13);
90111
_display->setCursor(0, 20);
91112
_display->setTextSize(1);
92-
_display->print(_node_name);
93113

94-
sprintf(tmp, "Build: %s", _build_date);
114+
_display->setColor(DisplayDriver::LIGHT);
115+
_display->print(_node_name);
116+
95117
_display->setCursor(0, 32);
96-
_display->print(tmp);
118+
_display->print(_version_info);
97119

98120
if (_connected) {
99121
//_display->printf("freq : %03.2f sf %d\n", _prefs.freq, _prefs.sf);
100122
//_display->printf("bw : %03.2f cr %d\n", _prefs.bw, _prefs.cr);
101123
} else if (_pin_code != 0) {
124+
_display->setColor(DisplayDriver::RED);
102125
_display->setTextSize(2);
103126
_display->setCursor(0, 43);
104127
sprintf(tmp, "Pin:%d", _pin_code);
105128
_display->print(tmp);
106129
}
107130
}
131+
_need_refresh = false;
108132
}
109133

110134
void UITask::userLedHandler() {
@@ -148,6 +172,7 @@ void UITask::buttonHandler() {
148172
clearMsgPreview();
149173
} else {
150174
_display->turnOn();
175+
_need_refresh = true;
151176
}
152177
_auto_off = cur_time + AUTO_OFF_MILLIS; // extend auto-off timer
153178
}
@@ -173,7 +198,7 @@ void UITask::loop() {
173198
userLedHandler();
174199

175200
if (_display != NULL && _display->isOn()) {
176-
if (millis() >= _next_refresh) {
201+
if (millis() >= _next_refresh && _need_refresh) {
177202
_display->startFrame();
178203
renderCurrScreen();
179204
_display->endFrame();

examples/companion_radio/UITask.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ class UITask {
1111
bool _connected;
1212
uint32_t _pin_code;
1313
const char* _node_name;
14-
const char* _build_date;
14+
char _version_info[32];
1515
char _origin[62];
1616
char _msg[80];
1717
int _msgcount;
18+
bool _need_refresh = true;
1819

1920
void renderCurrScreen();
2021
void buttonHandler();
@@ -26,7 +27,7 @@ class UITask {
2627
_next_refresh = 0;
2728
_connected = false;
2829
}
29-
void begin(DisplayDriver* display, const char* node_name, const char* build_date, uint32_t pin_code);
30+
void begin(DisplayDriver* display, const char* node_name, const char* build_date, const char* firmware_version, uint32_t pin_code);
3031

3132
void setHasConnection(bool connected) { _connected = connected; }
3233
bool hasDisplay() const { return _display != NULL; }

0 commit comments

Comments
 (0)