Merge branch 'master' into pr-fix4154

This commit is contained in:
Thomas Göttgens 2024-09-02 09:16:52 +02:00 committed by GitHub
commit 3bf20dc3a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 69 additions and 5 deletions

View File

@ -1,4 +1,4 @@
name: Test Simulator
name: End to end tests
on:
schedule:
@ -55,3 +55,37 @@ jobs:
name: PlatformIO Tests
path: testreport.xml
reporter: java-junit
hardware-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Upgrade python tools
shell: bash
run: |
python -m pip install --upgrade pip
pip install -U --no-build-isolation --no-cache-dir "setuptools<72"
pip install -U platformio adafruit-nrfutil --no-build-isolation
pip install -U poetry --no-build-isolation
pip install -U meshtastic --pre --no-build-isolation
- name: Upgrade platformio
shell: bash
run: |
pio upgrade
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- name: Install Dependencies
run: pnpm install
- name: Setup devices
run: pnpm run setup
- name: Execute end to end tests on connected hardware
run: pnpm run test

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "protobufs"]
path = protobufs
url = https://github.com/meshtastic/protobufs.git
[submodule "meshtestic"]
path = meshtestic
url = https://github.com/meshtastic/meshTestic

1
meshtestic Submodule

@ -0,0 +1 @@
Subproject commit 31ee3d90c8bef61e835c3271be2c7cda8c4a5cc2

@ -1 +1 @@
Subproject commit 28492e88e515aabf5c886dd23631518d6dee82d7
Subproject commit 5f7c91adb97187e0cb2140de7057344d93444bd1

View File

@ -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;
}
}
}
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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

View File

@ -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);
}

View File

@ -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;