diff --git a/README.md b/README.md index f58c4d8..56ed1ec 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/dmdserver.ini b/dmdserver.ini new file mode 100644 index 0000000..ef5b9b7 --- /dev/null +++ b/dmdserver.ini @@ -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 diff --git a/platforms/android/arm64-v8a/external.sh b/platforms/android/arm64-v8a/external.sh index e095397..594bef6 100755 --- a/platforms/android/arm64-v8a/external.sh +++ b/platforms/android/arm64-v8a/external.sh @@ -3,7 +3,7 @@ set -e CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251 -LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775 +LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5 SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f diff --git a/platforms/ios/arm64/external.sh b/platforms/ios/arm64/external.sh index b8122ac..157ef46 100755 --- a/platforms/ios/arm64/external.sh +++ b/platforms/ios/arm64/external.sh @@ -3,7 +3,7 @@ set -e CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251 -LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775 +LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5 SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f diff --git a/platforms/linux/aarch64/external.sh b/platforms/linux/aarch64/external.sh index 2c00f26..414a79f 100755 --- a/platforms/linux/aarch64/external.sh +++ b/platforms/linux/aarch64/external.sh @@ -3,7 +3,7 @@ set -e CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251 -LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775 +LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5 SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f diff --git a/platforms/linux/x64/external.sh b/platforms/linux/x64/external.sh index 106f901..50f7541 100755 --- a/platforms/linux/x64/external.sh +++ b/platforms/linux/x64/external.sh @@ -3,7 +3,7 @@ set -e CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251 -LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775 +LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5 SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f diff --git a/platforms/macos/arm64/external.sh b/platforms/macos/arm64/external.sh index 5d6a34d..3b07299 100755 --- a/platforms/macos/arm64/external.sh +++ b/platforms/macos/arm64/external.sh @@ -3,7 +3,7 @@ set -e CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251 -LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775 +LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5 SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f diff --git a/platforms/macos/x64/external.sh b/platforms/macos/x64/external.sh index e35051f..7704ad3 100755 --- a/platforms/macos/x64/external.sh +++ b/platforms/macos/x64/external.sh @@ -3,7 +3,7 @@ set -e CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251 -LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775 +LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5 SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f diff --git a/platforms/tvos/arm64/external.sh b/platforms/tvos/arm64/external.sh index 8780c31..3c5cbaf 100755 --- a/platforms/tvos/arm64/external.sh +++ b/platforms/tvos/arm64/external.sh @@ -3,7 +3,7 @@ set -e CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251 -LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775 +LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5 SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f diff --git a/platforms/win/x64/external.sh b/platforms/win/x64/external.sh index 99ac6ca..baec120 100755 --- a/platforms/win/x64/external.sh +++ b/platforms/win/x64/external.sh @@ -3,7 +3,7 @@ set -e CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251 -LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775 +LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5 SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f diff --git a/platforms/win/x86/external.sh b/platforms/win/x86/external.sh index e5b7651..f847f38 100755 --- a/platforms/win/x86/external.sh +++ b/platforms/win/x86/external.sh @@ -3,7 +3,7 @@ set -e CARGS_SHA=5949a20a926e902931de4a32adaad9f19c76f251 -LIBZEDMD_SHA=317070d7b5e344f58f966caccf1bc9c2979cb775 +LIBZEDMD_SHA=42d95ed6f1fe2065ecbd247502d177d7e5eb7e4c LIBSERUM_SHA=b69d2b436bc93570a2e7e78d0946cd3c43f7aed5 SOCKPP_SHA=e6c4688a576d95f42dd7628cefe68092f6c5cd0f diff --git a/src/DMD.cpp b/src/DMD.cpp index 7760e05..5b12610 100644 --- a/src/DMD.cpp +++ b/src/DMD.cpp @@ -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 diff --git a/src/dmdServer.cpp b/src/dmdServer.cpp index b96b9c3..2d6a854 100644 --- a/src/dmdServer.cpp +++ b/src/dmdServer.cpp @@ -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("DMDServer", "Addr").c_str()); - pConfig->SetDMDServerPort(r.Get("DMDServer", "Port")); - pConfig->SetAltColor(r.Get("DMDServer", "AltColor")); - pConfig->SetAltColorPath(r.Get("DMDServer", "AltColorPath").c_str()); + pConfig->SetDMDServerAddr(r.Get("DMDServer", "Addr", "localhost").c_str()); + pConfig->SetDMDServerPort(r.Get("DMDServer", "Port", 6789)); + pConfig->SetAltColor(r.Get("DMDServer", "AltColor", true)); + pConfig->SetAltColorPath(r.Get("DMDServer", "AltColorPath", "").c_str()); // ZeDMD - pConfig->SetZeDMD(r.Get("ZeDMD", "Enabled")); - pConfig->SetZeDMDDevice(r.Get("ZeDMD", "Device").c_str()); - pConfig->SetZeDMDDebug(r.Get("ZeDMD", "Debug")); - pConfig->SetZeDMDRGBOrder(r.Get("ZeDMD", "RGBOrder")); - pConfig->SetZeDMDBrightness(r.Get("ZeDMD", "Brightness")); - pConfig->SetZeDMDSaveSettings(r.Get("DMDServer", "SaveSettings")); + pConfig->SetZeDMD(r.Get("ZeDMD", "Enabled", true)); + pConfig->SetZeDMDDevice(r.Get("ZeDMD", "Device", "").c_str()); + pConfig->SetZeDMDDebug(r.Get("ZeDMD", "Debug", false)); + pConfig->SetZeDMDRGBOrder(r.Get("ZeDMD", "RGBOrder", -1)); + pConfig->SetZeDMDBrightness(r.Get("ZeDMD", "Brightness", -1)); + pConfig->SetZeDMDSaveSettings(r.Get("ZeDMD", "SaveSettings", false)); // Pixelcade - pConfig->SetPixelcade(r.Get("Pixelcade", "Enabled")); - pConfig->SetPixelcadeDevice(r.Get("Pixelcade", "Device").c_str()); - pConfig->SetPixelcadeMatrix(r.Get("Pixelcade", "Matrix")); + pConfig->SetPixelcade(r.Get("Pixelcade", "Enabled", true)); + pConfig->SetPixelcadeDevice(r.Get("Pixelcade", "Device", "").c_str()); + pConfig->SetPixelcadeMatrix(r.Get("Pixelcade", "Matrix", -1)); + + if (opt_verbose) DMDUtil::Log("Loaded config file"); } else if (identifier == 'o') {