Skip to content

Commit

Permalink
set configs for WIP Serum projects after Serum load
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner committed Feb 23, 2024
1 parent 53ef6a9 commit b85a0df
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions include/DMDUtil/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class DMDUTILAPI Config
bool IsAltColor() const { return m_altColor; }
void SetAltColor(bool altColor) { m_altColor = altColor; }
void SetAltColorPath(const char* path) { m_altColorPath = path; }
void SetIgnoreUnknownFramesTimeout(int framesTimeout) { m_framesTimeout = framesTimeout; }
void SetMaximumUnknownFramesToSkip(int framesToSkip) { m_framesToSkip = framesToSkip; }
int GetIgnoreUnknownFramesTimeout() { return m_framesTimeout; }
int GetMaximumUnknownFramesToSkip() { return m_framesToSkip; }
bool IsZeDMD() const { return m_zedmd; }
void SetZeDMD(bool zedmd) { m_zedmd = zedmd; }
const char* GetZeDMDDevice() const { return m_zedmdDevice.c_str(); }
Expand Down Expand Up @@ -50,6 +54,8 @@ class DMDUTILAPI Config
static Config* m_pInstance;
bool m_altColor;
std::string m_altColorPath;
int m_framesTimeout;
int m_framesToSkip;
bool m_zedmd;
std::string m_zedmdDevice;
bool m_zedmdDebug;
Expand Down
2 changes: 2 additions & 0 deletions src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Config::Config()
{
m_altColor = true;
m_altColorPath.clear();
m_framesTimeout = 0;
m_framesToSkip = 0;
m_zedmd = true;
m_zedmdDevice.clear();
m_zedmdDebug = false;
Expand Down
9 changes: 7 additions & 2 deletions src/DMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,11 @@ void DMD::DmdFrameReadyResetThread()
strcpy(name, m_updateBuffer[m_updateBufferPosition]->name);

m_pSerum = (Config::GetInstance()->IsAltColor() && name[0] != '\0') ? Serum::Load(name) : nullptr;
if (m_pSerum)
{
m_pSerum->SetIgnoreUnknownFramesTimeout(Config::GetInstance()->GetIgnoreUnknownFramesTimeout());
m_pSerum->SetMaximumUnknownFramesToSkip(Config::GetInstance()->GetMaximumUnknownFramesToSkip());
}
}

std::this_thread::sleep_for(std::chrono::milliseconds(1));
Expand Down Expand Up @@ -648,7 +653,7 @@ void DMD::PixelcadeDMDThread()
for (int i = 0; i < length; i++)
{
int pos = i * 3;
uint32_t r = rgb24Data[pos ];
uint32_t r = rgb24Data[pos];
uint32_t g = rgb24Data[pos + 1];
uint32_t b = rgb24Data[pos + 2];

Expand Down Expand Up @@ -960,7 +965,7 @@ void DMD::AdjustRGB24Depth(uint8_t* pData, uint8_t* pDstData, int length, uint8_
level = (uint8_t)(v >> 4);

int pos2 = level * 3;
pDstData[pos ] = palette[pos2];
pDstData[pos] = palette[pos2];
pDstData[pos + 1] = palette[pos2 + 1];
pDstData[pos + 2] = palette[pos2 + 2];
}
Expand Down

0 comments on commit b85a0df

Please sign in to comment.