mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-08 02:47:35 +00:00
Merge branch 'master' into pr-fix4154
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,6 +259,9 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_security_tag;
|
||||
fromRadioScratch.config.payload_variant.security = config.security;
|
||||
break;
|
||||
case meshtastic_Config_sessionkey_tag:
|
||||
fromRadioScratch.config.which_payload_variant = meshtastic_Config_sessionkey_tag;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("Unknown config type %d\n", config_state);
|
||||
}
|
||||
|
||||
@@ -165,6 +165,9 @@ meshtastic_QueueStatus Router::getQueueStatus()
|
||||
|
||||
ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src)
|
||||
{
|
||||
if (p->to == 0) {
|
||||
LOG_ERROR("Packet received with to: of 0!\n");
|
||||
}
|
||||
// No need to deliver externally if the destination is the local node
|
||||
if (p->to == nodeDB->getNodeNum()) {
|
||||
printPacket("Enqueued local", p);
|
||||
|
||||
@@ -350,6 +350,9 @@ typedef enum _meshtastic_MeshPacket_Priority {
|
||||
/* If priority is unset but the message is marked as want_ack,
|
||||
assume it is important and use a slightly higher priority */
|
||||
meshtastic_MeshPacket_Priority_RELIABLE = 70,
|
||||
/* If priority is unset but the packet is a response to a request, we want it to get there relatively quickly.
|
||||
Furthermore, responses stop relaying packets directed to a node early. */
|
||||
meshtastic_MeshPacket_Priority_RESPONSE = 80,
|
||||
/* Higher priority for specific message types (portnums) to distinguish between other reliable packets. */
|
||||
meshtastic_MeshPacket_Priority_HIGH = 100,
|
||||
/* Ack/naks are sent with very high priority to ensure that retransmission
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -129,6 +129,10 @@ void PositionModule::trySetRtc(meshtastic_Position p, bool isLocal, bool forceUp
|
||||
LOG_DEBUG("Ignoring time from mesh because we have a GPS, RTC, or Phone/NTP time source in the past day\n");
|
||||
return;
|
||||
}
|
||||
if (!isLocal && p.location_source < meshtastic_Position_LocSource_LOC_INTERNAL) {
|
||||
LOG_DEBUG("Ignoring time from mesh because it has a unknown or manual source\n");
|
||||
return;
|
||||
}
|
||||
struct timeval tv;
|
||||
uint32_t secs = p.time;
|
||||
|
||||
@@ -191,6 +195,10 @@ meshtastic_MeshPacket *PositionModule::allocReply()
|
||||
p.has_longitude_i = true;
|
||||
p.time = getValidTime(RTCQualityNTP) > 0 ? getValidTime(RTCQualityNTP) : localPosition.time;
|
||||
|
||||
if (config.position.fixed_position) {
|
||||
p.location_source = meshtastic_Position_LocSource_LOC_MANUAL;
|
||||
}
|
||||
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE) {
|
||||
if (pos_flags & meshtastic_Config_PositionConfig_PositionFlags_ALTITUDE_MSL) {
|
||||
p.altitude = localPosition.altitude;
|
||||
|
||||
Reference in New Issue
Block a user