@@ -208,7 +208,7 @@ void MyMesh::logRx(mesh::Packet *pkt, int len, float score) {
208208
209209void MyMesh::logTx (mesh::Packet *pkt, int len) {
210210#ifdef WITH_BRIDGE
211- bridge-> onPacketTransmitted (pkt);
211+ bridge. onPacketTransmitted (pkt);
212212#endif
213213 if (_logging) {
214214 File f = openAppend (PACKET_LOG_FILE);
@@ -473,16 +473,13 @@ bool MyMesh::onPeerPathRecv(mesh::Packet *packet, int sender_idx, const uint8_t
473473MyMesh::MyMesh (mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondClock &ms, mesh::RNG &rng,
474474 mesh::RTCClock &rtc, mesh::MeshTables &tables)
475475 : mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32 ), tables),
476- _cli(board, rtc, &_prefs, this ), telemetry(MAX_PACKET_PAYLOAD - 4 ) {
477- #ifdef WITH_BRIDGE
476+ _cli(board, rtc, &_prefs, this ), telemetry(MAX_PACKET_PAYLOAD - 4 )
478477#if defined(WITH_RS232_BRIDGE)
479- bridge = new RS232Bridge (WITH_RS232_BRIDGE, _mgr, &rtc);
478+ , bridge (WITH_RS232_BRIDGE, _mgr, &rtc)
480479#elif defined(WITH_ESPNOW_BRIDGE)
481- bridge = new ESPNowBridge (_mgr, &rtc);
482- #else
483- #error "You must choose either RS232 or ESPNow bridge"
484- #endif
480+ , bridge(_mgr, &rtc)
485481#endif
482+ {
486483 memset (known_clients, 0 , sizeof (known_clients));
487484 next_local_advert = next_flood_advert = 0 ;
488485 set_radio_at = revert_radio_at = 0 ;
@@ -518,6 +515,10 @@ void MyMesh::begin(FILESYSTEM *fs) {
518515 // load persisted prefs
519516 _cli.loadPrefs (_fs);
520517
518+ #ifdef WITH_BRIDGE
519+ bridge.begin ();
520+ #endif
521+
521522 radio_set_params (_prefs.freq , _prefs.bw , _prefs.sf , _prefs.cr );
522523 radio_set_tx_power (_prefs.tx_power_dbm );
523524
@@ -668,7 +669,7 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, char *command, char *reply
668669
669670void MyMesh::loop () {
670671#ifdef WITH_BRIDGE
671- bridge-> loop ();
672+ bridge. loop ();
672673#endif
673674
674675 mesh::Mesh::loop ();
0 commit comments