Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More priorities for different types of MeshPackets #4606

Merged
merged 1 commit into from
Sep 1, 2024
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
14 changes: 11 additions & 3 deletions src/mesh/MeshPacketQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,19 @@ void fixPriority(meshtastic_MeshPacket *p)
p->priority = (p->want_ack ? meshtastic_MeshPacket_Priority_RELIABLE : meshtastic_MeshPacket_Priority_DEFAULT);
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
// if acks/naks give very high priority
if (p->decoded.portnum == meshtastic_PortNum_ROUTING_APP)
if (p->decoded.portnum == meshtastic_PortNum_ROUTING_APP) {
p->priority = meshtastic_MeshPacket_Priority_ACK;
// if text give high priority
else if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP)
// if text or admin, give high priority
} else if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP ||
p->decoded.portnum == meshtastic_PortNum_ADMIN_APP) {
p->priority = meshtastic_MeshPacket_Priority_HIGH;
// if it is a response, give higher priority to let it arrive early and stop the request being relayed
} else if (p->decoded.request_id != 0) {
p->priority = meshtastic_MeshPacket_Priority_RESPONSE;
// Also if we want a response, give a bit higher priority
} else if (p->decoded.want_response) {
p->priority = meshtastic_MeshPacket_Priority_RELIABLE;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/modules/NeighborInfoModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void NeighborInfoModule::sendNeighborInfo(NodeNum dest, bool wantReplies)
// because we want to get neighbors for the next cycle
p->to = dest;
p->decoded.want_response = wantReplies;
p->priority = meshtastic_MeshPacket_Priority_BACKGROUND;
printNeighborInfo("SENDING", &neighborInfo);
service->sendToMesh(p, RX_SRC_LOCAL, true);
}
Expand Down
Loading