Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions include/DMDUtil/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class DMDUTILAPI Config
void SetMaximumUnknownFramesToSkip(int framesToSkip) { m_framesToSkip = framesToSkip; }
int GetIgnoreUnknownFramesTimeout() { return m_framesTimeout; }
int GetMaximumUnknownFramesToSkip() { return m_framesToSkip; }
bool IsShowNotColorizedFrames() const { return m_showNotColorizedFrames; }
void SetShowNotColorizedFrames(bool showNotColorizedFrames) { m_showNotColorizedFrames = showNotColorizedFrames; }
bool IsDumpNotColorizedFrames() const { return m_dumpNotColorizedFrames; }
void SetDumpNotColorizedFrames(bool dumpNotColorizedFrames) { m_dumpNotColorizedFrames = dumpNotColorizedFrames; }
bool IsFilterTransitionalFrames() const { return m_filterTransitionalFrames; }
Expand Down Expand Up @@ -103,6 +105,7 @@ class DMDUTILAPI Config
bool m_pupExactColorMatch;
int m_framesTimeout;
int m_framesToSkip;
bool m_showNotColorizedFrames;
bool m_dumpNotColorizedFrames;
bool m_filterTransitionalFrames;
bool m_zedmd;
Expand Down
5 changes: 3 additions & 2 deletions include/DMDUtil/DMD.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ class DMDUTILAPI DMD
NotColorized = 10,
};

bool IsSerumMode(Mode mode)
bool IsSerumMode(Mode mode, bool showNotColorized = false)
{
return (mode == Mode::SerumV1 || mode == Mode::SerumV2_32 || mode == Mode::SerumV2_32_64 ||
mode == Mode::SerumV2_64 || mode == Mode::SerumV2_64_32);
mode == Mode::SerumV2_64 || mode == Mode::SerumV2_64_32 ||
(showNotColorized && mode == Mode::NotColorized));
}

bool IsSerumV2Mode(Mode mode)
Expand Down
1 change: 1 addition & 0 deletions src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Config::Config()
m_pupExactColorMatch = true;
m_framesTimeout = 0;
m_framesToSkip = 0;
m_showNotColorizedFrames = false;
m_dumpNotColorizedFrames = false;
m_filterTransitionalFrames = false;
m_zedmd = true;
Expand Down
27 changes: 20 additions & 7 deletions src/DMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,9 @@ void DMD::ZeDMDThread()
m_dmdFrameReady.load(std::memory_order_acquire);
m_stopFlag.load(std::memory_order_acquire);

Config* const pConfig = Config::GetInstance();
bool showNotColorizedFrames = pConfig->IsShowNotColorizedFrames();

while (true)
{
std::shared_lock<std::shared_mutex> sl(m_dmdSharedMutex);
Expand All @@ -669,7 +672,7 @@ void DMD::ZeDMDThread()
bufferPosition = GetNextBufferQueuePosition(bufferPosition, updateBufferQueuePosition);

if (m_pSerum &&
(!IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode) ||
(!IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode, showNotColorizedFrames) ||
(m_pZeDMD->GetWidth() == 256 && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::SerumV2_32_64) ||
(m_pZeDMD->GetWidth() < 256 && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::SerumV2_64_32)))
continue;
Expand Down Expand Up @@ -720,7 +723,8 @@ void DMD::ZeDMDThread()
memcpy(indexBuffer, m_pUpdateBufferQueue[bufferPosition]->data, frameSize);
update = true;
}
else if (!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data)
else if ((!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data) ||
(showNotColorizedFrames && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::NotColorized))
{
memcpy(indexBuffer, m_pUpdateBufferQueue[bufferPosition]->data, frameSize);
update = true;
Expand Down Expand Up @@ -782,6 +786,7 @@ void DMD::SerumThread()
m_stopFlag.load(std::memory_order_acquire);

Config* const pConfig = Config::GetInstance();
bool showNotColorizedFrames = pConfig->IsShowNotColorizedFrames();
bool dumpNotColorizedFrames = pConfig->IsDumpNotColorizedFrames();

while (true)
Expand Down Expand Up @@ -867,7 +872,7 @@ void DMD::SerumThread()
prevTriggerId = m_pSerum->triggerID;
}
}
else if (dumpNotColorizedFrames)
else if (showNotColorizedFrames || dumpNotColorizedFrames)
{
Log(DMDUtil_LogLevel_DEBUG, "Serum: unidentified frame detected");

Expand Down Expand Up @@ -1003,6 +1008,9 @@ void DMD::PixelcadeDMDThread()
m_dmdFrameReady.load(std::memory_order_acquire);
m_stopFlag.load(std::memory_order_acquire);

Config* const pConfig = Config::GetInstance();
bool showNotColorizedFrames = pConfig->IsShowNotColorizedFrames();

while (true)
{
std::shared_lock<std::shared_mutex> sl(m_dmdSharedMutex);
Expand All @@ -1020,7 +1028,7 @@ void DMD::PixelcadeDMDThread()
{
bufferPosition = GetNextBufferQueuePosition(bufferPosition, updateBufferQueuePosition);

if (m_pSerum && !IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode)) continue;
if (m_pSerum && !IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode, showNotColorizedFrames)) continue;

if (m_pUpdateBufferQueue[bufferPosition]->hasData || m_pUpdateBufferQueue[bufferPosition]->hasSegData)
{
Expand Down Expand Up @@ -1101,7 +1109,8 @@ void DMD::PixelcadeDMDThread()
memcpy(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->data, length);
update = true;
}
else if (!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data)
else if ((!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data) ||
(showNotColorizedFrames && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::NotColorized))
{
memcpy(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->data, length);
update = true;
Expand Down Expand Up @@ -1218,6 +1227,9 @@ void DMD::RGB24DMDThread()
m_dmdFrameReady.load(std::memory_order_acquire);
m_stopFlag.load(std::memory_order_acquire);

Config* const pConfig = Config::GetInstance();
bool showNotColorizedFrames = pConfig->IsShowNotColorizedFrames();

while (true)
{
std::shared_lock<std::shared_mutex> sl(m_dmdSharedMutex);
Expand All @@ -1235,7 +1247,7 @@ void DMD::RGB24DMDThread()
{
bufferPosition = GetNextBufferQueuePosition(bufferPosition, updateBufferQueuePosition);

if (m_pSerum && !IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode)) continue;
if (m_pSerum && !IsSerumMode(m_pUpdateBufferQueue[bufferPosition]->mode, showNotColorizedFrames)) continue;

if (!m_rgb24DMDs.empty() &&
(m_pUpdateBufferQueue[bufferPosition]->hasData || m_pUpdateBufferQueue[bufferPosition]->hasSegData))
Expand Down Expand Up @@ -1280,7 +1292,8 @@ void DMD::RGB24DMDThread()
m_pUpdateBufferQueue[bufferPosition]->r, m_pUpdateBufferQueue[bufferPosition]->g,
m_pUpdateBufferQueue[bufferPosition]->b);

if (!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data)
if ((!m_pSerum && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::Data) ||
(showNotColorizedFrames && m_pUpdateBufferQueue[bufferPosition]->mode == Mode::NotColorized))
{
if (memcmp(renderBuffer, m_pUpdateBufferQueue[bufferPosition]->data, length) != 0)
{
Expand Down