Skip to content

Commit

Permalink
Fix advatek max number of ports and report errors due to too many pix…
Browse files Browse the repository at this point in the history
…els which varies in expanded mode.
  • Loading branch information
keithsw1111 committed Jun 6, 2020
1 parent cf005d4 commit 2468305
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/advatek.xcontroller
Expand Up @@ -41,7 +41,7 @@
<SupportsPixelPortAllSettings/>
<SupportsUpload/>
<MaxInputUniverses>96</MaxInputUniverses>
<MaxPixelPort>4</MaxPixelPort>
<MaxPixelPort>8</MaxPixelPort>
<MaxSerialPort>1</MaxSerialPort>
<MaxSerialPortChannels>512</MaxSerialPortChannels>
<MaxPixelPortChannels>3060</MaxPixelPortChannels>
Expand Down Expand Up @@ -115,7 +115,7 @@
<SupportsPixelPortAllSettings/>
<SupportsUpload/>
<MaxInputUniverses>96</MaxInputUniverses>
<MaxPixelPort>16</MaxPixelPort>
<MaxPixelPort>32</MaxPixelPort>
<MaxSerialPort>4</MaxSerialPort>
<MaxSerialPortChannels>512</MaxSerialPortChannels>
<MaxPixelPortChannels>3060</MaxPixelPortChannels>
Expand Down
27 changes: 27 additions & 0 deletions xLights/controllers/Pixlite16.cpp
Expand Up @@ -889,6 +889,28 @@ bool Pixlite16::SetOutputs(ModelManager* allmodels, OutputManager* outputManager

logger_base.debug(check);

// Handle varying maximum pixels based on expansion mode
int maxPixels = 0;
if (_config._numOutputs == 4 || _config._numOutputs == 8) {
// 4 board
if (cud.GetMaxPixelPort() > 4) {
maxPixels = 510;
}
else {
maxPixels = 1020;
}
}
else if (_config._numOutputs == 16 || _config._numOutputs == 32)
{
// 16 board
if (cud.GetMaxPixelPort() > 16) {
maxPixels = 510;
}
else {
maxPixels = 1020;
}
}

std::list<Output*> outputs = controller->GetOutputs();
if (success && cud.GetMaxPixelPort() > 0) {
for (int pp = 1; pp <= rules->GetMaxPixelPort(); pp++) {
Expand All @@ -899,6 +921,11 @@ bool Pixlite16::SetOutputs(ModelManager* allmodels, OutputManager* outputManager

UDControllerPort* port = cud.GetControllerPixelPort(pp);

if (port->Pixels() > maxPixels) {
check += wxString::Format("ERR: String port %d has more pixels than this controller supports (%d when maximum is %d).\n", pp, port->Pixels(), maxPixels);
success = false;
}

// update the data
_config._currentDriver = DecodeStringPortProtocol(port->GetProtocol());

Expand Down

0 comments on commit 2468305

Please sign in to comment.