Skip to content
Merged
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
28 changes: 28 additions & 0 deletions src/CdpPacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ enum topics {
sig = 0x17,
//battery level
bat = 0x18,
// external battery status
externalbattery = 0x19,
// bird detection event
birddetection = 0x1A,
// sleep status
sleepstatus = 0x1B,
// teensy status
teensystatus = 0x1C,
// teensy health status
teensyhealth = 0x1D,
// boot status
boot = 0x1E,
// tbeam status
tbeamstatus = 0x1F,
// Send duck commands
dcmd = 0x16,
//gps
Expand Down Expand Up @@ -280,6 +294,20 @@ class CdpPacket {
return "sensor";
case topics::bat:
return "battery";
case topics::externalbattery:
return "externalbattery";
case topics::birddetection:
return "birddetection";
case topics::sleepstatus:
return "sleepstatus";
case topics::teensystatus:
return "teensystatus";
case topics::teensyhealth:
return "teensyhealth";
case topics::tbeamstatus:
return "tbeamstatus";
case topics::boot:
return "boot";
case topics::sig:
return "signal health";
case topics::alert:
Expand Down
6 changes: 5 additions & 1 deletion src/Ducks/Duck.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ class Duck {
*/
static bool sendSignalData(void* p){
Duck* duckInstance = static_cast<Duck*>(p);
if (duckInstance->getType() == DuckType::PAPA) {
logdbg_ln("[DUCK] Skipping signal info send for PapaDuck.");
return true;
}
int err;
duckInstance->router.cullRoutingTable();
std::optional<std::string> message = duckInstance->router.getEntriesFor(PAPADUCK_DUID, duckInstance->duid);
Expand Down Expand Up @@ -486,7 +490,7 @@ class Duck {

//Telemetry
const int HEALTH_INTERVAL = 1000 * 60 * 15; //15 minutes
const int SIGNAL_INTERVAL = 1000 * 60;//0 * 7; //1 hour 2 min
const int SIGNAL_INTERVAL = 1000 * 60 * 10; //10 minutes
int counter = 1;
Timer<10> duckTimer;

Expand Down
3 changes: 2 additions & 1 deletion src/Ducks/DuckLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class DuckLink : public Duck<WifiCapability, RadioType> {
case reservedTopic::rrep: {
//we still need to recieve rreps in case of ttl expiry
RouteJSON rrepDoc = RouteJSON(rxPacket.data);
loginfo_ln("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Received Route Response from DUID: %s", rxPacket.sduid.data());
std::string sourceDuid(rxPacket.sduid.begin(), rxPacket.sduid.end());
loginfo_ln("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Received Route Response from DUID: %s", sourceDuid.c_str());
//destination = sender of the rrep -> the last hop to current duck
std::optional<Duid> last = rrepDoc.getlastInPath();
Duid lastInPath = last.value();
Expand Down
5 changes: 3 additions & 2 deletions src/Ducks/MamaDuck.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ private :
RouteJSON rrepDoc = RouteJSON(rxPacket.data);
std::optional<Duid> last = rrepDoc.getlastInPath();
Duid lastInPath = last.has_value() ? last.value() : rxPacket.sduid;
loginfo_ln("Received Route Response from DUID: %s", rxPacket.sduid.data(), rxPacket.sduid.size());
std::string sourceDuid(rxPacket.sduid.begin(), rxPacket.sduid.end());
loginfo_ln("Received Route Response from DUID: %s", sourceDuid.c_str());

std::optional<Duid> nextHop;
if(rxPacket.duckType == DuckType::PAPA){
Expand Down Expand Up @@ -189,4 +190,4 @@ private :

};

#endif
#endif
3 changes: 2 additions & 1 deletion src/Ducks/PapaDuck.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ void ifNotBroadcast(CdpPacket rxPacket, bool relay = false) {
RouteJSON rrepDoc = RouteJSON(rxPacket.data);
std::optional<Duid> last = rrepDoc.getlastInPath();
Duid lastInPath = last.has_value() ? last.value() : rxPacket.sduid;
loginfo_ln("Received Route Response from DUID: %s", rxPacket.sduid.data(), rxPacket.sduid.size());
std::string sourceDuid(rxPacket.sduid.begin(), rxPacket.sduid.end());
loginfo_ln("Received Route Response from DUID: %s", sourceDuid.c_str());

std::optional<Duid> nextHop = this->router.getBestNextHop(rrepDoc.getDestination());
if((rrepDoc.getDestination() != this->duid) && (nextHop.has_value()) && (nextHop.value() != rxPacket.sduid)){ //and not papaduck_duid?
Expand Down
Loading