mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* companion radio: BLE variants now set device name to "MeshCore-{advert-name}"
This commit is contained in:
parent
a922d0711d
commit
67c7fc070e
1 changed files with 18 additions and 10 deletions
|
|
@ -417,9 +417,8 @@ public:
|
||||||
_prefs.tx_power_dbm = LORA_TX_POWER;
|
_prefs.tx_power_dbm = LORA_TX_POWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
void begin(FILESYSTEM& fs, BaseSerialInterface& serial, mesh::RNG& trng) {
|
void begin(FILESYSTEM& fs, mesh::RNG& trng) {
|
||||||
_fs = &fs;
|
_fs = &fs;
|
||||||
_serial = &serial;
|
|
||||||
|
|
||||||
BaseChatMesh::begin();
|
BaseChatMesh::begin();
|
||||||
|
|
||||||
|
|
@ -452,6 +451,13 @@ public:
|
||||||
_phy->setOutputPower(_prefs.tx_power_dbm);
|
_phy->setOutputPower(_prefs.tx_power_dbm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* getNodeName() { return _prefs.node_name; }
|
||||||
|
|
||||||
|
void startInterface(BaseSerialInterface& serial) {
|
||||||
|
_serial = &serial;
|
||||||
|
serial.enable();
|
||||||
|
}
|
||||||
|
|
||||||
void savePrefs() {
|
void savePrefs() {
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
File file = _fs->open("/node_prefs", FILE_O_WRITE);
|
File file = _fs->open("/node_prefs", FILE_O_WRITE);
|
||||||
|
|
@ -802,27 +808,29 @@ void setup() {
|
||||||
|
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
InternalFS.begin();
|
InternalFS.begin();
|
||||||
|
the_mesh.begin(InternalFS, trng);
|
||||||
|
|
||||||
#ifdef BLE_PIN_CODE
|
#ifdef BLE_PIN_CODE
|
||||||
serial_interface.begin("MeshCore", BLE_PIN_CODE);
|
char dev_name[32+10];
|
||||||
|
sprintf(dev_name, "MeshCore-%s", the_mesh.getNodeName());
|
||||||
|
serial_interface.begin(dev_name, BLE_PIN_CODE);
|
||||||
#else
|
#else
|
||||||
pinMode(WB_IO2, OUTPUT);
|
pinMode(WB_IO2, OUTPUT);
|
||||||
serial_interface.begin(Serial);
|
serial_interface.begin(Serial);
|
||||||
#endif
|
#endif
|
||||||
serial_interface.enable();
|
the_mesh.startInterface(serial_interface);
|
||||||
|
|
||||||
the_mesh.begin(InternalFS, serial_interface, trng);
|
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
SPIFFS.begin(true);
|
SPIFFS.begin(true);
|
||||||
|
the_mesh.begin(SPIFFS, trng);
|
||||||
|
|
||||||
#ifdef BLE_PIN_CODE
|
#ifdef BLE_PIN_CODE
|
||||||
serial_interface.begin("MeshCore", BLE_PIN_CODE);
|
char dev_name[32+10];
|
||||||
|
sprintf(dev_name, "MeshCore-%s", the_mesh.getNodeName());
|
||||||
|
serial_interface.begin(dev_name, BLE_PIN_CODE);
|
||||||
#else
|
#else
|
||||||
serial_interface.begin(Serial);
|
serial_interface.begin(Serial);
|
||||||
#endif
|
#endif
|
||||||
serial_interface.enable();
|
the_mesh.startInterface(serial_interface);
|
||||||
|
|
||||||
the_mesh.begin(SPIFFS, serial_interface, trng);
|
|
||||||
#else
|
#else
|
||||||
#error "need to define filesystem"
|
#error "need to define filesystem"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue