AEFeinstein / AEFeinstein/Super-2024-Swadge-FW

SwadgePass storage efficiency

Đang mở
#626 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Next Year System FW
Ngôn ngữ chính
C
Star
34
Fork
22
Merge trung bình
3 ngày 15 giờ
Pull request đã merge (30 ngày)
10

Mô tả

## Summary
NVS is not designed for large binary blobs, like SwadgePass data. We can store it more efficiently in a dedicated partition where it can't interfere with other storage needs.

## Technical Spec
- Set up a SwadgePass partition sized to (SwadgePass byte length) * (max SwadgePasses)
- We'll need to figure out some way to adjust the size during development so it doesn't end up to small as we add more SP struct fields.
- Write SP data to the new partition using the [partition APIs](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/storage/partition.html#flash-partition-apis). This ensures we don't override data in another partition accidentally.
- The last written SP index should be saved in NVS and loop back to the beginning once all slots are filled. This ensures writes will happen across the partition evenly and that the oldest entry is evicted when getting new entries.
- This still needs a strategy to deal with updating data of someone you already passed but whose data hasn't been overwritten yet. Something something exercise for the reader.
- Adjust the SP key to use the binary representation of the MAC instead of the string representation to save some space.

## How to Test
SwadgePass with 100 people and still have a working device.

## Extra Credit
Could this be turned into a general-purpose utility for writing fixed-size binary data to a partition? The sequential writing approach won't work for everything, so uneven wear could be an issue in some use cases.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.