Skip to content

Commit

Permalink
Updates to keep ToRadio/FromRadio packets smaller than 512 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
geeksville committed May 12, 2020
1 parent 3bf195c commit bc3ecd9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
2 changes: 2 additions & 0 deletions mesh.options
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
*MeshPacket.encrypted max_size:256
*MeshPacket.payload anonymous_oneof:true

*SubPacket.payload anonymous_oneof:true

# MyMessage.name max_size:40
# or fixed_length or fixed_count, or max_count

66 changes: 37 additions & 29 deletions mesh.proto
Original file line number Diff line number Diff line change
Expand Up @@ -170,31 +170,13 @@ message RouteDiscovery {
// inside a radio packet (because from/to are broken out by the comms library)
message SubPacket {

// Typically only one of the following fields are populated, but there is no
// restriction wrt that
Position position = 1;
Data data = 3;
User user = 4;

/// Not normally used, but for testing a sender can request that recipient
/// responds in kind (i.e. if it received a position, it should unicast back
/// its position).
// Note: that if you set this on a broadcast you will receive many replies.
// FIXME - unify (i.e. remove) this with the new reliable messaging at the
// MeshPacket level
bool want_response = 5;

/**
This packet is a requested acknoledgement indicating that we have received
the specified message ID. This packet type can be used both for immediate (0
hops) messages or can be routed through multiple hops if dest is set.
// Only one of the following fields can be populated at a time
oneof payload {

Note: As an optimization, recipients can _also_ populate other fields in the
ack if they think the recipient would appreciate that extra state.
*/
uint32 ack_id = 10;
Position position = 1;
Data data = 3;
User user = 4;

oneof route {
/**
A route request going from the requester
*/
Expand All @@ -206,13 +188,29 @@ message SubPacket {
RouteDiscovery reply = 7;
}

/**
If unset treated as zero (no fowarding, send to adjacent nodes only)
if 1, allow hopping through one node, etc...
/// Not normally used, but for testing a sender can request that recipient
/// responds in kind (i.e. if it received a position, it should unicast back
/// its position).
// Note: that if you set this on a broadcast you will receive many replies.
// FIXME - unify (i.e. remove) this with the new reliable messaging at the
// MeshPacket level
bool want_response = 5;

For our usecase real world topologies probably have a max of about 3.
*/
// uint32 hop_limit = 8;
oneof ack {
/**
This packet is a requested acknoledgement indicating that we have received
the specified message ID. This packet type can be used both for immediate
(0 hops) messages or can be routed through multiple hops if dest is set.
Note: As an optimization, recipients can _also_ populate a field in payload
if they think the recipient would appreciate that extra state.
*/
uint32 success_id = 10;

/** This is a nak, we failed to deliver this message.
*/
uint32 fail_id = 11;
}

/**
The address of the destination node.
Expand Down Expand Up @@ -285,6 +283,16 @@ message MeshPacket {
/// SNR
/// of this packet. Used to collect statistics on current link waulity.
float rx_snr = 7;

/**
If unset treated as zero (no fowarding, send to adjacent nodes only)
if 1, allow hopping through one node, etc...
For our usecase real world topologies probably have a max of about 3.
This field is normally placed into a a couple of bits in the header.
*/
uint32 hop_limit = 10;
}

/// Shared constants between device and phone
Expand Down

0 comments on commit bc3ecd9

Please sign in to comment.