mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
Merge pull request #60 from cjkas/test/snapshot-worst-case
test: prove no read item can outgrow the snapshot unit
This commit is contained in:
commit
2056930005
5 changed files with 153 additions and 6 deletions
|
|
@ -128,6 +128,10 @@ enum class snapshot_doc_t : uint8_t {
|
|||
// (device, radio and firmware details) into the open top-level object.
|
||||
typedef void (*snapshot_header_t)(JsonFormatter &json, const model_snapshot_t &snap);
|
||||
|
||||
// The buffer each room, shade, group and linked shade is formatted into on its
|
||||
// own. test_snapshot_limits checks the largest possible item of each fits.
|
||||
#define SNAPSHOT_UNIT_SIZE 3072
|
||||
|
||||
// Writes a document from a snapshot a piece at a time for a chunked response.
|
||||
// Each room, shade, group and linked shade is formatted into unit on its own;
|
||||
// one that doesn't fit is logged and left out so the JSON stays valid.
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ static void discoveryHeader(JsonFormatter &json, const model_snapshot_t &snap) {
|
|||
// window allows, so there is no growing response buffer either.
|
||||
struct SnapshotRead {
|
||||
uint8_t slot;
|
||||
char unit[3072];
|
||||
char unit[SNAPSHOT_UNIT_SIZE];
|
||||
SnapshotWriter writer;
|
||||
SnapshotRead(uint8_t slot, snapshot_doc_t doc, uint8_t id, snapshot_header_t header)
|
||||
: slot(slot), writer(snapshotSlots.snapshot(slot), doc, id, header, unit, sizeof(unit)) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue