1.2-legacy
geeksville 2020-05-27 15:31:32 -07:00
rodzic da2ef0ac61
commit f56ff2ca20
5 zmienionych plików z 37 dodań i 12 usunięć

Wyświetl plik

@ -27,13 +27,12 @@
#include "NodeDB.h"
#include "Periodic.h"
#include "PowerFSM.h"
#include "Router.h"
#include "UBloxGPS.h"
#include "configuration.h"
#include "error.h"
#include "power.h"
// #include "rom/rtc.h"
#include "ReliableRouter.h"
#include "DSRRouter.h"
#include "main.h"
#include "screen.h"
#include "sleep.h"
@ -53,7 +52,7 @@ meshtastic::PowerStatus powerStatus;
bool ssd1306_found;
bool axp192_found;
ReliableRouter realRouter;
DSRRouter realRouter;
Router &router = realRouter; // Users of router don't care what sort of subclass implements that API
// -----------------------------------------------------------------------------

Wyświetl plik

@ -38,9 +38,26 @@ when we receive a routeError packet
ErrorCode DSRRouter::send(MeshPacket *p)
{
// If we have an entry in our routing tables, just send it, otherwise start a route discovery
// We only consider multihop routing packets (i.e. those with dest set)
if (p->decoded.dest) {
// add an entry for this pending message
auto pending = startRetransmission(p);
// FIXME - when acks come in for this packet, we should _not_ delete the record unless the ack was from
// the final dest. We need to keep that record around until FIXME
// Also we should not retransmit multihop entries in that table at all
return ReliableRouter::send(p);
// If we have an entry in our routing tables, just send it, otherwise start a route discovery
NodeNum nextHop = getNextHop(p->decoded.dest);
if (nextHop) {
sendNextHop(nextHop, p); // start a reliable single hop send
} else {
pending->wantRoute = true;
// start discovery, but only if we don't already a discovery in progress for that node number
startDiscovery(p->decoded.dest);
}
} else
return ReliableRouter::send(p);
}
void DSRRouter::sniffReceived(const MeshPacket *p)

Wyświetl plik

@ -146,13 +146,15 @@ bool ReliableRouter::stopRetransmission(GlobalPacketId key)
/**
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
*/
void ReliableRouter::startRetransmission(MeshPacket *p)
PendingPacket *ReliableRouter::startRetransmission(MeshPacket *p)
{
auto id = GlobalPacketId(p);
auto rec = PendingPacket(p);
stopRetransmission(p->from, p->id);
pending[id] = rec;
return &pending[id];
}
/**

Wyświetl plik

@ -103,6 +103,11 @@ class ReliableRouter : public FloodingRouter
*/
virtual bool shouldFilterReceived(const MeshPacket *p);
/**
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
*/
PendingPacket *startRetransmission(MeshPacket *p);
private:
/**
* Send an ack or a nak packet back towards whoever sent idFrom
@ -117,11 +122,6 @@ class ReliableRouter : public FloodingRouter
bool stopRetransmission(NodeNum from, PacketId id);
bool stopRetransmission(GlobalPacketId p);
/**
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
*/
void startRetransmission(MeshPacket *p);
/**
* Do any retransmissions that are scheduled (FIXME - for the time being called from loop)
*/

Wyświetl plik

@ -78,5 +78,12 @@ void nrf52Setup()
// Not yet on board
// pmu.init();
DEBUG_MSG("FIXME, need to call randomSeed on nrf52!\n");
// Init random seed
// FIXME - use this to get random numbers
// #include "nrf_rng.h"
// uint32_t r;
// ble_controller_rand_vector_get_blocking(&r, sizeof(r));
// randomSeed(r);
DEBUG_MSG("FIXME, call randomSeed\n");
}