Skip to content

Commit

Permalink
fixed ZeDMD impact on RS485
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner committed Nov 17, 2023
1 parent 78a8a62 commit 2580232
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions src/ppuc/ppuc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,43 @@ int main(int argc, char *argv[])
opt_serial = ppuc->GetSerial();
}

// Initialize displays.
// ZeDMD messes with USB ports. when searching for the DMD.
// So it is important to start that search before PIN2DMD
// or the RS485 BUS get initialized.
std::thread t_zedmd;
#if defined(ZEDMD_SUPPORT)
zedmd.IgnoreDevice(opt_serial);
// zedmd_connected = (int)zedmd.OpenWiFi("192.168.178.125", 3333);
zedmd_connected = (int)zedmd.Open();
if (opt_debug)
printf("ZeDMD: %d\n", zedmd_connected);
if (zedmd_connected)
{
if (opt_debug)
zedmd.EnableDebug();
// zedmd.EnablePreUpscaling();
t_zedmd = std::thread(ZeDmdThread);
}
#endif

pin2dmd_connected = Pin2dmdInit();
if (opt_debug)
printf("PIN2DMD: %d\n", pin2dmd_connected);
std::thread t_pin2dmd;
if (pin2dmd_connected)
{
t_pin2dmd = std::thread(Pin2DmdThread);
}

std::thread t_consoledmd;
if (opt_console_display)
{
t_consoledmd = std::thread(ConsoleDmdThread);
}

std::thread t_resetdmd(ResetDmdThread);

if (!opt_no_serial && !ppuc->Connect())
{
printf("Unable to open serial communication to PPUC boards.\n");
Expand Down Expand Up @@ -683,40 +720,6 @@ int main(int argc, char *argv[])
}
#endif

// Initialize displays.
pin2dmd_connected = Pin2dmdInit();
if (opt_debug)
printf("PIN2DMD: %d\n", pin2dmd_connected);
std::thread t_pin2dmd;
if (pin2dmd_connected)
{
t_pin2dmd = std::thread(Pin2DmdThread);
}

std::thread t_zedmd;
#if defined(ZEDMD_SUPPORT)
zedmd.IgnoreDevice(opt_serial);
// zedmd_connected = (int)zedmd.OpenWiFi("192.168.178.125", 3333);
zedmd_connected = (int)zedmd.Open();
if (opt_debug)
printf("ZeDMD: %d\n", zedmd_connected);
if (zedmd_connected)
{
if (opt_debug)
zedmd.EnableDebug();
// zedmd.EnablePreUpscaling();
t_zedmd = std::thread(ZeDmdThread);
}
#endif

std::thread t_consoledmd;
if (opt_console_display)
{
t_consoledmd = std::thread(ConsoleDmdThread);
}

std::thread t_resetdmd(ResetDmdThread);

// Initialize the sound device
const ALCchar *defaultDeviceName = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
ALCdevice *device = alcOpenDevice(defaultDeviceName);
Expand Down

0 comments on commit 2580232

Please sign in to comment.