Skip to content

Commit

Permalink
fine tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner committed Dec 30, 2024
1 parent f29af87 commit 53c5116
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/ZeDMDComm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ bool ZeDMDComm::StreamBytes(ZeDMDFrame* pFrame)

uint8_t* pData;
uint16_t size;
bool rgb565ZoneStreamAnnounced = false;

for (auto it = pFrame->data.rbegin(); it != pFrame->data.rend(); ++it)
{
Expand All @@ -595,14 +596,17 @@ bool ZeDMDComm::StreamBytes(ZeDMDFrame* pFrame)
}
else
{
size = CTRL_CHARS_HEADER_SIZE + 1;
pData = (uint8_t*)malloc(size);
memcpy(pData, CTRL_CHARS_HEADER, CTRL_CHARS_HEADER_SIZE);
pData[CTRL_CHARS_HEADER_SIZE] = ZEDMD_COMM_COMMAND::AnnounceRGB565ZonesStream;
if (!rgb565ZoneStreamAnnounced)
{
size = CTRL_CHARS_HEADER_SIZE + 1;
pData = (uint8_t*)malloc(size);
memcpy(pData, CTRL_CHARS_HEADER, CTRL_CHARS_HEADER_SIZE);
pData[CTRL_CHARS_HEADER_SIZE] = ZEDMD_COMM_COMMAND::AnnounceRGB565ZonesStream;

bool success = SendChunks(pData, size);
free(pData);
if (!success) return false;
bool success = SendChunks(pData, size);
free(pData);
if (!success) return false;
}

mz_ulong compressedSize = mz_compressBound(ZEDMD_ZONES_BYTE_LIMIT);
pData = (uint8_t*)malloc(CTRL_CHARS_HEADER_SIZE + 3 + ZEDMD_ZONES_BYTE_LIMIT);
Expand Down Expand Up @@ -678,7 +682,7 @@ bool ZeDMDComm::SendChunks(uint8_t* pData, uint16_t size)

if (response == 'A')
{
if (m_noAcknowledgeCounter > 0) m_noAcknowledgeCounter--;
m_noAcknowledgeCounter = 0;
}
else if (response == 'F')
{
Expand Down

0 comments on commit 53c5116

Please sign in to comment.