Skip to content

Commit

Permalink
fixed zones reset
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner committed Jan 21, 2024
1 parent e34de88 commit 52b7558
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/ZeDMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void ZeDMD::RenderRgb24EncodedAs565(uint8_t* pFrame) {
}

if (m_usb) {
m_pZeDMDWiFi->QueueRgb565Command(ZEDMD_COMM_COMMAND::RGB565ZonesStream,
m_pZeDMDComm->QueueRgb565Command(ZEDMD_COMM_COMMAND::RGB565ZonesStream,
m_pRgb565Buffer, rgb565BufferSize, width,
height);
}
Expand Down
8 changes: 4 additions & 4 deletions src/ZeDMDComm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void ZeDMDComm::QueueCommand(char command, uint8_t* data, int size,
m_delayedFrameMutex.unlock();
m_lastStreamId = -1;
// Next streaming needs to be complete.
memset(m_zoneHashes, 0, 128);
memset(m_zoneHashes, 0, sizeof(m_zoneHashes));
}
// delayed streamed zones
else if (streamId != -1 && delayed) {
Expand All @@ -171,7 +171,7 @@ void ZeDMDComm::QueueCommand(char command, uint8_t* data, int size,
m_frameQueueMutex.unlock();
if (streamId == -1) {
// Next streaming needs to be complete.
memset(m_zoneHashes, 0, 128);
memset(m_zoneHashes, 0, sizeof(m_zoneHashes));
}
}
}
Expand Down Expand Up @@ -214,7 +214,7 @@ void ZeDMDComm::QueueCommand(char command, uint8_t* data, int size,

m_delayedFrameMutex.unlock();
// A delayed frame needs to be complete.
memset(m_zoneHashes, 0, 128);
memset(m_zoneHashes, 0, sizeof(m_zoneHashes));
}

for (uint16_t y = 0; y < height; y += m_zoneHeight) {
Expand Down Expand Up @@ -282,7 +282,7 @@ void ZeDMDComm::QueueRgb565Command(char command, uint16_t* data, int size,

m_delayedFrameMutex.unlock();
// A delayed frame needs to be complete.
memset(m_zoneHashes, 0, 128);
memset(m_zoneHashes, 0, sizeof(m_zoneHashes));
}

for (uint16_t y = 0; y < height; y += m_zoneHeight) {
Expand Down
38 changes: 19 additions & 19 deletions src/test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdarg.h>

#include <stdlib.h>
#include <chrono>
#include <thread>

Expand Down Expand Up @@ -42,7 +42,7 @@ int main(int argc, const char* argv[]) {
pZeDMD->SetLogCallback(LogCallback, nullptr);

if (pZeDMD->Open(128, 32)) {
pZeDMD->EnableDebug();
//pZeDMD->EnableDebug();

uint8_t* pImage2 = CreateImage(2);
uint8_t* pImage4 = CreateImage(4);
Expand All @@ -54,27 +54,27 @@ int main(int argc, const char* argv[]) {
printf("Grey2\n");
pZeDMD->SetDefaultPalette(2);
pZeDMD->RenderGray2(pImage2);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

printf("Grey4\n");
pZeDMD->SetDefaultPalette(4);
pZeDMD->RenderGray4(pImage4);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

printf("RGB24 Streming\n");
printf("RGB24 Streaming\n");
pZeDMD->RenderRgb24(pImage24);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));

printf("RGB24 Streming\n");
printf("RGB24 Streaming\n");
pZeDMD->RenderRgb24(pImage24);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

printf("RGB24 Streming\n");
printf("RGB24 Streaming\n");
pZeDMD->RenderRgb24(pImage24);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();
}

Expand All @@ -86,23 +86,23 @@ int main(int argc, const char* argv[]) {
printf("Grey2\n");
pZeDMD->SetDefaultPalette(2);
pZeDMD->RenderGray2(pImage2);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

printf("Grey4\n");
pZeDMD->SetDefaultPalette(4);
pZeDMD->RenderGray4(pImage4);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

printf("RGB24\n");
pZeDMD->RenderRgb24(pImage24);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

printf("RGB24 Streming\n");
printf("RGB24 Streaming\n");
pZeDMD->RenderRgb24(pImage24);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

}
Expand All @@ -115,23 +115,23 @@ int main(int argc, const char* argv[]) {
printf("Grey2\n");
pZeDMD->SetDefaultPalette(2);
pZeDMD->RenderGray2(pImage2);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

printf("Grey4\n");
pZeDMD->SetDefaultPalette(4);
pZeDMD->RenderGray4(pImage4);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

printf("RGB24\n");
pZeDMD->RenderRgb24(pImage24);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();

printf("RGB24 as RGB565\n");
pZeDMD->RenderRgb24EncodedAs565(pImage24);
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
std::this_thread::sleep_for(std::chrono::milliseconds(500));
pZeDMD->ClearScreen();
}

Expand Down

0 comments on commit 52b7558

Please sign in to comment.