Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion opendisplay_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,13 @@ static void handle_config_read(uint8_t connection)
{
static uint8_t config_data[MAX_CONFIG_SIZE];
uint32_t config_len = MAX_CONFIG_SIZE;
const uint16_t max_chunks = 10u;
/* Chunk 0 carries a 4-byte header plus a 2-byte length prefix; later chunks
* carry only the 4-byte header. Sizing the cap against the smallest per-chunk
* payload (MAX_RESPONSE_DATA_SIZE - 6) guarantees enough chunks to read a
* full MAX_CONFIG_SIZE config, and scales automatically with MAX_CONFIG_SIZE. */
const uint16_t max_chunks =
(uint16_t)((MAX_CONFIG_SIZE + (MAX_RESPONSE_DATA_SIZE - 6u) - 1u) /
(MAX_RESPONSE_DATA_SIZE - 6u));

if (!initConfigStorage()) {
uint8_t err[] = { 0xFFu, RESP_CONFIG_READ, 0x00u, 0x00u };
Expand Down