From 1c7a0ce2bd3cfc88de8dd0c2f2d4dff90ce7c20e Mon Sep 17 00:00:00 2001 From: liamcottle Date: Tue, 23 Sep 2025 18:00:52 +1200 Subject: [PATCH] use uint16_t to allow fetching up to 65535 neighbours --- examples/simple_repeater/MyMesh.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index 23280272..f868d5a7 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -197,11 +197,12 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t int reply_offset = 4; // get request params - uint8_t count = payload[2]; // how many neighbours to fetch - uint8_t offset = payload[3]; // offset from start of neighbours list - uint8_t order_by = payload[4]; // how to order neighbours. 0=newest_to_oldest, 1=oldest_to_newest, 2=strongest_to_weakest, 3=weakest_to_strongest - uint8_t pubkey_prefix_length = payload[5]; // how many bytes of neighbour pub key we want - // we also send a 4 byte random blob in payload[6...9] to help packet uniqueness + uint8_t count = payload[2]; // how many neighbours to fetch (0-255) + uint16_t offset; + memcpy(&offset, &payload[3], 2); // offset from start of neighbours list (0-65535) + uint8_t order_by = payload[5]; // how to order neighbours. 0=newest_to_oldest, 1=oldest_to_newest, 2=strongest_to_weakest, 3=weakest_to_strongest + uint8_t pubkey_prefix_length = payload[6]; // how many bytes of neighbour pub key we want + // we also send a 4 byte random blob in payload[7...10] to help packet uniqueness MESH_DEBUG_PRINTLN("REQ_TYPE_GET_NEIGHBOURS count=%d, offset=%d, order_by=%d, pubkey_prefix_length=%d", count, offset, order_by, pubkey_prefix_length);