mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* companion, HeltecV3: now picks random BLE pin for every session (from boot), unless a (non-zero) one stored in _prefs
* companion, WSL3: uses static BLE pin, per build BLE_PIN_CODE define
This commit is contained in:
parent
01d84d5d3e
commit
78ee88c9ed
3 changed files with 35 additions and 11 deletions
|
|
@ -78,7 +78,7 @@ void UITask::renderCurrScreen() {
|
|||
if (_connected) {
|
||||
//_display->printf("freq : %03.2f sf %d\n", _prefs.freq, _prefs.sf);
|
||||
//_display->printf("bw : %03.2f cr %d\n", _prefs.bw, _prefs.cr);
|
||||
} else {
|
||||
} else if (_pin_code != 0) {
|
||||
_display->setTextSize(2);
|
||||
_display->setCursor(0, 43);
|
||||
sprintf(tmp, "Pin:%d", _pin_code);
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ class MyMesh : public BaseChatMesh {
|
|||
ContactsIterator _iter;
|
||||
uint32_t _iter_filter_since;
|
||||
uint32_t _most_recent_lastmod;
|
||||
uint32_t _active_ble_pin;
|
||||
bool _iter_started;
|
||||
uint8_t app_target_ver;
|
||||
uint8_t cmd_frame[MAX_FRAME_SIZE+1];
|
||||
|
|
@ -220,11 +221,6 @@ class MyMesh : public BaseChatMesh {
|
|||
if (!_identity_store->load("_main", self_id)) {
|
||||
self_id = mesh::LocalIdentity(&trng); // create new random identity
|
||||
saveMainIdentity(self_id);
|
||||
|
||||
#if defined(BLE_PIN_CODE) && defined(DISPLAY_CLASS)
|
||||
// start with randomly assigned BLE pin
|
||||
_prefs.ble_pin = trng.nextInt(100000, 999999);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -617,9 +613,6 @@ public:
|
|||
_prefs.bw = LORA_BW;
|
||||
_prefs.cr = LORA_CR;
|
||||
_prefs.tx_power_dbm = LORA_TX_POWER;
|
||||
#ifdef BLE_PIN_CODE
|
||||
_prefs.ble_pin = BLE_PIN_CODE;
|
||||
#endif
|
||||
//_prefs.rx_delay_base = 10.0f; enable once new algo fixed
|
||||
}
|
||||
|
||||
|
|
@ -672,6 +665,20 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef BLE_PIN_CODE
|
||||
if (_prefs.ble_pin == 0) {
|
||||
#ifdef DISPLAY_CLASS
|
||||
_active_ble_pin = trng.nextInt(100000, 999999); // random pin each session
|
||||
#else
|
||||
_active_ble_pin = BLE_PIN_CODE; // otherwise static pin
|
||||
#endif
|
||||
} else {
|
||||
_active_ble_pin = _prefs.ble_pin;
|
||||
}
|
||||
#else
|
||||
_active_ble_pin = 0;
|
||||
#endif
|
||||
|
||||
// init 'blob store' support
|
||||
_fs->mkdir("/bl");
|
||||
|
||||
|
|
@ -686,7 +693,7 @@ public:
|
|||
}
|
||||
|
||||
const char* getNodeName() { return _prefs.node_name; }
|
||||
uint32_t getBLEPin() { return _prefs.ble_pin; }
|
||||
uint32_t getBLEPin() { return _active_ble_pin; }
|
||||
|
||||
void startInterface(BaseSerialInterface& serial) {
|
||||
_serial = &serial;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ build_flags =
|
|||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=1
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_PIN_CODE=0 ; dynamic, random PIN
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
|
|
@ -196,6 +196,23 @@ lib_deps =
|
|||
${Heltec_lora32_v3.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:Heltec_WSL3_companion_radio_ble]
|
||||
extends = Heltec_lora32_v3
|
||||
build_flags =
|
||||
${Heltec_lora32_v3.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=1
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter} +<helpers/esp32/*.cpp> +<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${Heltec_lora32_v3.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:Heltec_v3_companion_radio_wifi]
|
||||
extends = Heltec_lora32_v3
|
||||
build_flags =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue