diff --git a/.github/workflows/test_simulator.yml b/.github/workflows/tests.yml similarity index 64% rename from .github/workflows/test_simulator.yml rename to .github/workflows/tests.yml index 1d20657a0..f58b38ac9 100644 --- a/.github/workflows/test_simulator.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/.gitmodules b/.gitmodules index e6f376a0b..7c54ad513 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/meshtestic b/meshtestic new file mode 160000 index 000000000..31ee3d90c --- /dev/null +++ b/meshtestic @@ -0,0 +1 @@ +Subproject commit 31ee3d90c8bef61e835c3271be2c7cda8c4a5cc2 diff --git a/protobufs b/protobufs index 28492e88e..5f7c91adb 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 28492e88e515aabf5c886dd23631518d6dee82d7 +Subproject commit 5f7c91adb97187e0cb2140de7057344d93444bd1 diff --git a/src/mesh/MeshPacketQueue.cpp b/src/mesh/MeshPacketQueue.cpp index 8e5eedc87..6581b1ce4 100644 --- a/src/mesh/MeshPacketQueue.cpp +++ b/src/mesh/MeshPacketQueue.cpp @@ -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; + } } } } diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 0a9bb5b10..0ca89b1ef 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -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); } diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 804761f4e..d8e578db1 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -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); diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index a711da806..9d7ff74a1 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -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 diff --git a/src/modules/NeighborInfoModule.cpp b/src/modules/NeighborInfoModule.cpp index 2de4374e6..218fb8801 100644 --- a/src/modules/NeighborInfoModule.cpp +++ b/src/modules/NeighborInfoModule.cpp @@ -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); }