Compress NodeInfoLite bools into a bitfield
What does this PR do?
This PR proposes to squash 3 bytes into 1 and allows up to 5 new boolean flags "for free." This will save 2 bytes per NodeInfoLite, or about 200 - 500 bytes in memory for most devices.
I'm new to this, so the process for updating the protobufs and then refactoring the firmware is not clear to me. Please let me know if there is something else I must do before applying the associated refactor to the firmware repo.
Checklist before merging
- [x] All top level messages commented
- [x] All enum members have unique descriptions
I forgot to revisit switching out the uint32 for something smaller (since protobuf doesn't support uint8) before submitting, so the patch does not do as the PR claims. I will fix that up some time tomorrow.
I forgot to revisit switching out the uint32 for something smaller (since protobuf doesn't support uint8) before submitting, so the patch does not do as the PR claims. I will fix that up some time tomorrow.
You can use the nanopb annotations in the .options file to set the max size to 8. There should be some other examples in there where we do this for certain fields.
I like the approach here, but one concern I have is existing data migrations. When the NodeDB is first loaded from the file system and decoded by nanopb, I'm not sure that the existing field values wouldn't be simply lost in the deserialization process.
I will check on the deserialization issue.
FWIW, I believe a more obvious change with much greater savings to consider is limiting User.long_name to a more reasonable length of 20 instead of 40, which I suspect will deserialize fine, just truncating the excess length. @garthvh and I were just discussing this change on Discord.
JFYI
| dep | .bss sym | bytes used |
|---|---|---|
| libpax | seen_ids_map | 8192 |
| bsec2 | workBuffer | 4096 |
12K = roughly 70 NodeInfoLites