Skip to content

Commit c533821

Browse files
committed
Merge remote-tracking branch 'origin/dev' into jbrazio/2025_3f11ad35
2 parents 04042e3 + 541cd8c commit c533821

Some content is hidden

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

44 files changed

+2780
-169
lines changed

boards/minewsemi_me25ls01.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"ldscript": "nrf52840_s140_v7.ld"
5+
},
6+
"core": "nRF5",
7+
"cpu": "cortex-m4",
8+
"extra_flags": "-DARDUINO_WIO_WM1110 -DNRF52840_XXAA",
9+
"f_cpu": "64000000L",
10+
"hwids": [
11+
["0x239A", "0x8029"],
12+
["0x239A", "0x0029"],
13+
["0x239A", "0x002A"],
14+
["0x239A", "0x802A"]
15+
],
16+
"usb_product": "me25ls01-BOOT",
17+
"mcu": "nrf52840",
18+
"variant": "minewsemi_me25ls01",
19+
"bsp": {
20+
"name": "adafruit"
21+
},
22+
"softdevice": {
23+
"sd_flags": "-DS140",
24+
"sd_name": "s140",
25+
"sd_version": "7.3.0",
26+
"sd_fwid": "0x0123"
27+
},
28+
"bootloader": {
29+
"settings_addr": "0xFF000"
30+
}
31+
},
32+
"connectivity": ["bluetooth"],
33+
"debug": {
34+
"jlink_device": "nRF52840_xxAA",
35+
"svd_path": "nrf52840.svd",
36+
"openocd_target": "nrf52.cfg"
37+
},
38+
"frameworks": ["arduino"],
39+
"name": "Minewsemi ME25LS01",
40+
"upload": {
41+
"maximum_ram_size": 248832,
42+
"maximum_size": 815104,
43+
"speed": 115200,
44+
"protocol": "nrfutil",
45+
"protocols": [
46+
"jlink",
47+
"nrfjprog",
48+
"nrfutil",
49+
"stlink",
50+
"cmsis-dap",
51+
"blackmagic"
52+
],
53+
"use_1200bps_touch": true,
54+
"require_upload_port": true,
55+
"wait_for_upload_port": true
56+
},
57+
"url": "https://en.minewsemi.com/lora-module/lr1110-nrf52840-me25LS01",
58+
"vendor": "MINEWSEMI"
59+
}

boards/seeed_sensecap_solar.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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", "0x0059" ]
12+
],
13+
"mcu": "nrf52840",
14+
"variant": "Seeed_XIAO_nRF52840",
15+
"softdevice": {
16+
"sd_flags": "-DS140",
17+
"sd_name": "s140",
18+
"sd_version": "7.3.0",
19+
"sd_fwid": "0x0123"
20+
},
21+
"bsp": {
22+
"name": "adafruit"
23+
},
24+
"bootloader": {
25+
"settings_addr": "0xFF000"
26+
},
27+
"usb_product": "XIAO nRF52840"
28+
},
29+
"connectivity": [
30+
"bluetooth"
31+
],
32+
"debug": {
33+
"jlink_device": "nRF52840_xxAA",
34+
"openocd_target": "nrf52.cfg",
35+
"svd_path": "nrf52840.svd"
36+
},
37+
"frameworks": [
38+
"arduino"
39+
],
40+
"name": "Seeed Studio XIAO nRF52840",
41+
"upload": {
42+
"maximum_ram_size": 248832,
43+
"maximum_size": 815104,
44+
"protocol": "nrfutil",
45+
"speed": 115200,
46+
"protocols": [
47+
"jlink",
48+
"nrfjprog",
49+
"nrfutil",
50+
"cmsis-dap",
51+
"sam-ba",
52+
"blackmagic"
53+
],
54+
"use_1200bps_touch": true,
55+
"require_upload_port": true,
56+
"wait_for_upload_port": true
57+
},
58+
"url": "https://wiki.seeedstudio.com/meshtastic_solar_node/",
59+
"vendor": "Seeed Studio"
60+
}

examples/companion_radio/MyMesh.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,17 @@ void MyMesh::queueMessage(const ContactInfo &from, uint8_t txt_type, mesh::Packe
319319
uint8_t frame[1];
320320
frame[0] = PUSH_CODE_MSG_WAITING; // send push 'tickle'
321321
_serial->writeFrame(frame, 1);
322-
} else {
323-
#ifdef DISPLAY_CLASS
324-
ui_task.soundBuzzer(UIEventType::contactMessage);
325-
#endif
326322
}
323+
327324
#ifdef DISPLAY_CLASS
328-
ui_task.newMsg(path_len, from.name, text, offline_queue_len);
325+
// we only want to show text messages on display, not cli data
326+
bool should_display = txt_type == TXT_TYPE_PLAIN || txt_type == TXT_TYPE_SIGNED_PLAIN;
327+
if (should_display) {
328+
ui_task.newMsg(path_len, from.name, text, offline_queue_len);
329+
if (!_serial->isConnected()) {
330+
ui_task.soundBuzzer(UIEventType::contactMessage);
331+
}
332+
}
329333
#endif
330334
}
331335

examples/simple_repeater/main.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
153153
oldest->id = id;
154154
oldest->out_path_len = -1; // initially out_path is unknown
155155
oldest->last_timestamp = 0;
156-
self_id.calcSharedSecret(oldest->secret, id); // calc ECDH shared secret
157156
return oldest;
158157
}
159158

@@ -433,8 +432,8 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
433432
return ((int)_prefs.agc_reset_interval) * 4000; // milliseconds
434433
}
435434

436-
void onAnonDataRecv(mesh::Packet* packet, uint8_t type, const mesh::Identity& sender, uint8_t* data, size_t len) override {
437-
if (type == PAYLOAD_TYPE_ANON_REQ) { // received an initial request by a possible admin client (unknown at this stage)
435+
void onAnonDataRecv(mesh::Packet* packet, const uint8_t* secret, const mesh::Identity& sender, uint8_t* data, size_t len) override {
436+
if (packet->getPayloadType() == PAYLOAD_TYPE_ANON_REQ) { // received an initial request by a possible admin client (unknown at this stage)
438437
uint32_t timestamp;
439438
memcpy(&timestamp, data, 4);
440439

@@ -461,6 +460,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
461460
client->last_timestamp = timestamp;
462461
client->last_activity = getRTCClock()->getCurrentTime();
463462
client->is_admin = is_admin;
463+
memcpy(client->secret, secret, PUB_KEY_SIZE);
464464

465465
uint32_t now = getRTCClock()->getCurrentTimeUnique();
466466
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
@@ -592,12 +592,12 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
592592
}
593593

594594
uint8_t temp[166];
595-
const char *command = (const char *) &data[5];
595+
char *command = (char *) &data[5];
596596
char *reply = (char *) &temp[5];
597597
if (is_retry) {
598598
*reply = 0;
599599
} else {
600-
_cli.handleCommand(sender_timestamp, command, reply);
600+
handleCommand(sender_timestamp, command, reply);
601601
}
602602
int text_len = strlen(reply);
603603
if (text_len > 0) {
@@ -673,8 +673,6 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
673673
_prefs.interference_threshold = 0; // disabled
674674
}
675675

676-
CommonCLI* getCLI() { return &_cli; }
677-
678676
void begin(FILESYSTEM* fs) {
679677
mesh::Mesh::begin();
680678
_fs = fs;
@@ -798,6 +796,18 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
798796
((SimpleMeshTables *)getTables())->resetStats();
799797
}
800798

799+
void handleCommand(uint32_t sender_timestamp, char* command, char* reply) {
800+
while (*command == ' ') command++; // skip leading spaces
801+
802+
if (strlen(command) > 4 && command[2] == '|') { // optional prefix (for companion radio CLI)
803+
memcpy(reply, command, 3); // reflect the prefix back
804+
reply += 3;
805+
command += 3;
806+
}
807+
808+
_cli.handleCommand(sender_timestamp, command, reply); // common CLI commands
809+
}
810+
801811
void loop() {
802812
#ifdef BRIDGE_OVER_SERIAL
803813
serialBridgeReceivePkt();
@@ -930,7 +940,7 @@ void loop() {
930940
if (len > 0 && command[len - 1] == '\r') { // received complete line
931941
command[len - 1] = 0; // replace newline with C string null terminator
932942
char reply[160];
933-
the_mesh.getCLI()->handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
943+
the_mesh.handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
934944
if (reply[0]) {
935945
Serial.print(" -> "); Serial.println(reply);
936946
}

examples/simple_room_server/main.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
188188
newClient->id = id;
189189
newClient->out_path_len = -1; // initially out_path is unknown
190190
newClient->last_timestamp = 0;
191-
self_id.calcSharedSecret(newClient->secret, id); // calc ECDH shared secret
192191
return newClient;
193192
}
194193

@@ -334,7 +333,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
334333
}
335334
return 0; // unknown command
336335
}
337-
336+
338337
protected:
339338
float getAirtimeBudgetFactor() const override {
340339
return _prefs.airtime_factor;
@@ -432,8 +431,8 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
432431
return true;
433432
}
434433

435-
void onAnonDataRecv(mesh::Packet* packet, uint8_t type, const mesh::Identity& sender, uint8_t* data, size_t len) override {
436-
if (type == PAYLOAD_TYPE_ANON_REQ) { // received an initial request by a possible admin client (unknown at this stage)
434+
void onAnonDataRecv(mesh::Packet* packet, const uint8_t* secret, const mesh::Identity& sender, uint8_t* data, size_t len) override {
435+
if (packet->getPayloadType() == PAYLOAD_TYPE_ANON_REQ) { // received an initial request by a possible admin client (unknown at this stage)
437436
uint32_t sender_timestamp, sender_sync_since;
438437
memcpy(&sender_timestamp, data, 4);
439438
memcpy(&sender_sync_since, &data[4], 4); // sender's "sync messags SINCE x" timestamp
@@ -465,6 +464,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
465464
client->sync_since = sender_sync_since;
466465
client->pending_ack = 0;
467466
client->push_failures = 0;
467+
memcpy(client->secret, secret, PUB_KEY_SIZE);
468468

469469
uint32_t now = getRTCClock()->getCurrentTime();
470470
client->last_activity = now;
@@ -555,7 +555,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
555555
if (is_retry) {
556556
temp[5] = 0; // no reply
557557
} else {
558-
_cli.handleCommand(sender_timestamp, (const char *) &data[5], (char *) &temp[5]);
558+
handleCommand(sender_timestamp, (char *) &data[5], (char *) &temp[5]);
559559
temp[4] = (TXT_TYPE_CLI_DATA << 2); // attempt and flags, (NOTE: legacy was: TXT_TYPE_PLAIN)
560560
}
561561
send_ack = false;
@@ -743,8 +743,6 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
743743
_num_posted = _num_post_pushes = 0;
744744
}
745745

746-
CommonCLI* getCLI() { return &_cli; }
747-
748746
void begin(FILESYSTEM* fs) {
749747
mesh::Mesh::begin();
750748
_fs = fs;
@@ -845,6 +843,18 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
845843
((SimpleMeshTables *)getTables())->resetStats();
846844
}
847845

846+
void handleCommand(uint32_t sender_timestamp, char* command, char* reply) {
847+
while (*command == ' ') command++; // skip leading spaces
848+
849+
if (strlen(command) > 4 && command[2] == '|') { // optional prefix (for companion radio CLI)
850+
memcpy(reply, command, 3); // reflect the prefix back
851+
reply += 3;
852+
command += 3;
853+
}
854+
855+
_cli.handleCommand(sender_timestamp, command, reply); // common CLI commands
856+
}
857+
848858
void loop() {
849859
mesh::Mesh::loop();
850860

@@ -998,7 +1008,7 @@ void loop() {
9981008
if (len > 0 && command[len - 1] == '\r') { // received complete line
9991009
command[len - 1] = 0; // replace newline with C string null terminator
10001010
char reply[160];
1001-
the_mesh.getCLI()->handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
1011+
the_mesh.handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
10021012
if (reply[0]) {
10031013
Serial.print(" -> "); Serial.println(reply);
10041014
}

0 commit comments

Comments
 (0)