Skip to content

Commit

Permalink
fixed ini file default values, added dmdserver.ini example, reset ZeD…
Browse files Browse the repository at this point in the history
…MD after RGBOrder change
  • Loading branch information
mkalkbrenner committed Mar 16, 2024
1 parent 188e3e7 commit 8a9a8b1
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 51 deletions.
53 changes: 29 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,36 +170,41 @@ The "paused" connections aren't really paused. Their data is still accepted but
```ini
[DMDServer]
# The address (interface) to listen for TCP connections
Addr=localhost
# The port to listen for TCP connections
Port=6789
# Set to 1 if Serum colorization should be used
AltColor=
# Overwrite the AltColorPath sent by the client and set it to a fixed value
AltColorPath=
# The address (interface) to listen for TCP connections.
Addr = localhost
# The port to listen for TCP connections.
Port = 6789
# Set to 1 if Serum colorization should be used, 0 isf not.
AltColor = 1
# Overwrite the AltColorPath sent by the client and set it to a fixed value.
AltColorPath =
[ZeDMD]
# Set to 1 if ZeDMD is attached
Enabled=
# Disable auto-detection and provide a fixed serial port
Device=
# Enable ZeDMD debug mode
Debug=
# Overwrite ZeDMD internal RGB order setting
RGBOrder=
# Overwrite ZeDMD internal brightness setting
Brightness=
# Set to 1 to permantenly store the overwritten settings above in ZeDMD internally
SaveSettings=
# Set to 1 if ZeDMD is attached.
Enabled = 1
# Disable auto-detection and provide a fixed serial port.
Device =
# Set to 1 to enable ZeDMD debug mode.
Debug = 0
# Overwrite ZeDMD internal RGB order setting. Valid values are 0-5. -1 disables the setting.
# The RGB level could be set at any time, but since ZeDMD version 3.6.0, ZeDMD need to be
# rebooted to apply this the setting. So it is essential to set SaveSettings to 1 if a new
# RGBOrder should be applied.
RGBOrder = -1
# Overwrite ZeDMD internal brightness setting. Valid values are 0-15. -1 disables the setting.
# The brightness level could be adjust at runtime, SaveSettings set to 1 will save the setting
# in ZeDMD, too.
Brightness = -1
# Set to 1 to permantenly store the overwritten settings above in ZeDMD internally.
SaveSettings = 0
[Pixelcade]
# Set to 1 if Pixelcade is attached
Enabled=
Enabled = 1
# Disable auto-detection and provide a fixed serial port
Device=
# Set to 0 if rgb, 1 if rbg
Matrix=0
Device =
# Set to 0 if RGB, 1 if RBG.
Matrix = 0
```

## Building:
Expand Down
37 changes: 37 additions & 0 deletions dmdserver.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

[DMDServer]
# The address (interface) to listen for TCP connections.
Addr = localhost
# The port to listen for TCP connections.
Port = 6789
# Set to 1 if Serum colorization should be used, 0 isf not.
AltColor = 1
# Overwrite the AltColorPath sent by the client and set it to a fixed value.
AltColorPath =

[ZeDMD]
# Set to 1 if ZeDMD is attached.
Enabled = 1
# Disable auto-detection and provide a fixed serial port.
Device =
# Set to 1 to enable ZeDMD debug mode.
Debug = 0
# Overwrite ZeDMD internal RGB order setting. Valid values are 0-5. -1 disables the setting.
# The RGB level could be set at any time, but since ZeDMD version 3.6.0, ZeDMD need to be
# rebooted to apply this the setting. So it is essential to set SaveSettings to 1 if a new
# RGBOrder should be applied.
RGBOrder = -1
# Overwrite ZeDMD internal brightness setting. Valid values are 0-15. -1 disables the setting.
# The brightness level could be adjust at runtime, SaveSettings set to 1 will save the setting
# in ZeDMD, too.
Brightness = -1
# Set to 1 to permantenly store the overwritten settings above in ZeDMD internally.
SaveSettings = 0

[Pixelcade]
# Set to 1 if Pixelcade is attached
Enabled = 1
# Disable auto-detection and provide a fixed serial port
Device =
# Set to 0 if RGB, 1 if RBG.
Matrix = 0
2 changes: 1 addition & 1 deletion platforms/android/arm64-v8a/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f

Expand Down
2 changes: 1 addition & 1 deletion platforms/ios/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f

Expand Down
2 changes: 1 addition & 1 deletion platforms/linux/aarch64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f

Expand Down
2 changes: 1 addition & 1 deletion platforms/linux/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f

Expand Down
2 changes: 1 addition & 1 deletion platforms/macos/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f

Expand Down
2 changes: 1 addition & 1 deletion platforms/macos/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f

Expand Down
2 changes: 1 addition & 1 deletion platforms/tvos/arm64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f

Expand Down
2 changes: 1 addition & 1 deletion platforms/win/x64/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f

Expand Down
2 changes: 1 addition & 1 deletion platforms/win/x86/external.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251
LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775
LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c
LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5
SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f

Expand Down
25 changes: 20 additions & 5 deletions src/DMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,15 +435,30 @@ void DMD::FindDisplays()
if (pConfig->GetZeDMDDevice() != nullptr && pConfig->GetZeDMDDevice()[0] != '\0')
pZeDMD->SetDevice(pConfig->GetZeDMDDevice());

if (pZeDMD->Open())
bool open = false;
if (open = pZeDMD->Open())
{
if (pConfig->IsZeDMDDebug()) pZeDMD->EnableDebug();
if (pConfig->GetZeDMDRGBOrder() != -1) pZeDMD->SetRGBOrder(pConfig->GetZeDMDRGBOrder());
if (pConfig->GetZeDMDBrightness() != -1) pZeDMD->SetBrightness(pConfig->GetZeDMDBrightness());
if (pConfig->IsZeDMDSaveSettings()) pZeDMD->SaveSettings();
if (pConfig->IsZeDMDSaveSettings())
{
if (pConfig->GetZeDMDRGBOrder() != -1) pZeDMD->SetRGBOrder(pConfig->GetZeDMDRGBOrder());
pZeDMD->SaveSettings();
if (pConfig->GetZeDMDRGBOrder() != -1)
{
// Setting the RGBOrder requires a reboot.
pZeDMD->Reset();
std::this_thread::sleep_for(std::chrono::seconds(8));
pZeDMD->Close();
std::this_thread::sleep_for(std::chrono::seconds(1));
open = pZeDMD->Open();
}
}
}
if (open)
{
if (pConfig->IsZeDMDDebug()) pZeDMD->EnableDebug();
pZeDMD->EnablePreDownscaling();
pZeDMD->EnablePreUpscaling();

m_pZeDMDThread = new std::thread(&DMD::ZeDMDThread, this);
}
else
Expand Down
28 changes: 15 additions & 13 deletions src/dmdServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,23 @@ int main(int argc, char* argv[])
if (identifier == 'c')
{
inih::INIReader r{cag_option_get_value(&cag_context)};
pConfig->SetDMDServerAddr(r.Get<string>("DMDServer", "Addr").c_str());
pConfig->SetDMDServerPort(r.Get<int>("DMDServer", "Port"));
pConfig->SetAltColor(r.Get<bool>("DMDServer", "AltColor"));
pConfig->SetAltColorPath(r.Get<string>("DMDServer", "AltColorPath").c_str());
pConfig->SetDMDServerAddr(r.Get<string>("DMDServer", "Addr", "localhost").c_str());
pConfig->SetDMDServerPort(r.Get<int>("DMDServer", "Port", 6789));
pConfig->SetAltColor(r.Get<bool>("DMDServer", "AltColor", true));
pConfig->SetAltColorPath(r.Get<string>("DMDServer", "AltColorPath", "").c_str());
// ZeDMD
pConfig->SetZeDMD(r.Get<bool>("ZeDMD", "Enabled"));
pConfig->SetZeDMDDevice(r.Get<string>("ZeDMD", "Device").c_str());
pConfig->SetZeDMDDebug(r.Get<bool>("ZeDMD", "Debug"));
pConfig->SetZeDMDRGBOrder(r.Get<int>("ZeDMD", "RGBOrder"));
pConfig->SetZeDMDBrightness(r.Get<int>("ZeDMD", "Brightness"));
pConfig->SetZeDMDSaveSettings(r.Get<bool>("DMDServer", "SaveSettings"));
pConfig->SetZeDMD(r.Get<bool>("ZeDMD", "Enabled", true));
pConfig->SetZeDMDDevice(r.Get<string>("ZeDMD", "Device", "").c_str());
pConfig->SetZeDMDDebug(r.Get<bool>("ZeDMD", "Debug", false));
pConfig->SetZeDMDRGBOrder(r.Get<int>("ZeDMD", "RGBOrder", -1));
pConfig->SetZeDMDBrightness(r.Get<int>("ZeDMD", "Brightness", -1));
pConfig->SetZeDMDSaveSettings(r.Get<bool>("ZeDMD", "SaveSettings", false));
// Pixelcade
pConfig->SetPixelcade(r.Get<bool>("Pixelcade", "Enabled"));
pConfig->SetPixelcadeDevice(r.Get<string>("Pixelcade", "Device").c_str());
pConfig->SetPixelcadeMatrix(r.Get<int>("Pixelcade", "Matrix"));
pConfig->SetPixelcade(r.Get<bool>("Pixelcade", "Enabled", true));
pConfig->SetPixelcadeDevice(r.Get<string>("Pixelcade", "Device", "").c_str());
pConfig->SetPixelcadeMatrix(r.Get<int>("Pixelcade", "Matrix", -1));

if (opt_verbose) DMDUtil::Log("Loaded config file");
}
else if (identifier == 'o')
{
Expand Down

0 comments on commit 8a9a8b1

Please sign in to comment.