Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/cli_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ region save

---

#### View or change the channel used for bridging (ESPNow only)
#### View or change the channel used for bridging (wireless bridges only)
**Usage:**
- `get bridge.channel`
- `set bridge.channel <channel>`
Expand All @@ -1127,13 +1127,13 @@ region save

---

#### Set the ESP-Now secret
#### Set the wireless bridge secret
**Usage:**
- `get bridge.secret`
- `set bridge.secret <secret>`

**Parameters:**
- `secret`: ESP-NOW bridge secret, up to 15 characters
- `secret`: bridge secret, up to 15 characters

**Default:** Varies by board

Expand Down
5 changes: 5 additions & 0 deletions examples/simple_repeater/MyMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ uint8_t MyMesh::handleAnonClockReq(const mesh::Identity& sender, uint32_t sender
reply_data[8] |= 0x01; // is bridge, type UART
#elif WITH_ESPNOW_BRIDGE
reply_data[8] |= 0x03; // is bridge, type ESP-NOW
#elif WITH_NRF_BRIDGE
reply_data[8] |= 0x05; // is bridge, type nRF 2.4GHz
#endif
if (_prefs.disable_fwd) { // is this repeater currently disabled
reply_data[8] |= 0x80; // is disabled
Expand Down Expand Up @@ -872,6 +874,9 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
#if defined(WITH_ESPNOW_BRIDGE)
, bridge(&_prefs, _mgr, &rtc)
#endif
#if defined(WITH_NRF_BRIDGE)
, bridge(&_prefs, _mgr, &rtc)
#endif
{
last_millis = 0;
uptime_millis = 0;
Expand Down
7 changes: 7 additions & 0 deletions examples/simple_repeater/MyMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#define WITH_BRIDGE
#endif

#ifdef WITH_NRF_BRIDGE
#include "helpers/bridges/NRFRadioBridge.h"
#define WITH_BRIDGE
#endif

#include <helpers/AdvertDataHelpers.h>
#include <helpers/ArduinoHelpers.h>
#include <helpers/ClientACL.h>
Expand Down Expand Up @@ -118,6 +123,8 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
RS232Bridge bridge;
#elif defined(WITH_ESPNOW_BRIDGE)
ESPNowBridge bridge;
#elif defined(WITH_NRF_BRIDGE)
NRFRadioBridge bridge;
#endif

void putNeighbour(const mesh::Identity& id, uint32_t timestamp, float snr);
Expand Down
2 changes: 2 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ build_src_filter =
+<helpers/*.cpp>
+<helpers/radiolib/*.cpp>
+<helpers/bridges/BridgeBase.cpp>
+<helpers/bridges/NRFRadioChannel.cpp>
+<helpers/ui/MomentaryButton.cpp>

; ----------------- ESP32 ---------------------
Expand Down Expand Up @@ -170,6 +171,7 @@ build_src_filter =
+<../src/Utils.cpp>
+<../src/Packet.cpp>
+<../src/helpers/ConfigSerializer.cpp>
+<../src/helpers/bridges/NRFRadioChannel.cpp>
lib_deps =
google/googletest @ 1.17.0

Expand Down
9 changes: 7 additions & 2 deletions src/helpers/CommonCLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, char* command, char* re
strcpy(reply, "ERR: clock cannot go backwards");
}
} else if (memcmp(command, "start ota", 9) == 0) {
// OTA needs the radio the bridge is holding: the SoftDevice claims the nRF
// RADIO, and on ESP32 the update wants the Wi-Fi interface ESP-NOW is on.
_callbacks->setBridgeState(false);
if (!_board->startOTAUpdate(_prefs->node_name, reply)) {
strcpy(reply, "Error");
}
Expand Down Expand Up @@ -746,7 +749,7 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, char* command, char* rep
sprintf(reply, "Error: baud rate must be between 9600-%d",BRIDGE_MAX_BAUD);
}
#endif
#ifdef WITH_ESPNOW_BRIDGE
#if defined(WITH_ESPNOW_BRIDGE) || defined(WITH_NRF_BRIDGE)
} else if (memcmp(config, "bridge.channel ", 15) == 0) {
int ch = atoi(&config[15]);
if (ch > 0 && ch < 15) {
Expand Down Expand Up @@ -910,6 +913,8 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
"rs232"
#elif WITH_ESPNOW_BRIDGE
"espnow"
#elif WITH_NRF_BRIDGE
"nrf"
#else
"none"
#endif
Expand All @@ -926,7 +931,7 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
} else if (memcmp(config, "bridge.baud", 11) == 0) {
sprintf(reply, "> %d", (uint32_t)_prefs->bridge_baud);
#endif
#ifdef WITH_ESPNOW_BRIDGE
#if defined(WITH_ESPNOW_BRIDGE) || defined(WITH_NRF_BRIDGE)
} else if (memcmp(config, "bridge.channel", 14) == 0) {
sprintf(reply, "> %d", (uint32_t)_prefs->bridge_channel);
} else if (memcmp(config, "bridge.secret", 13) == 0) {
Expand Down
Loading