mirror of
https://github.com/preble/libpinproc
synced 2026-02-24 18:25:23 +01:00
Added code to set the polarity of driver group 18 and drivers 144-151 for WPC machineTypes to 1 for the 8-driver board.
This commit is contained in:
@@ -284,6 +284,8 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
|
|
||||||
const int mappedWPCDriverGroupEnableIndex[] = {0, 0, 0, 0, 0, 2, 4, 3, 1, 5, 7, 7, 7, 7, 7, 7, 7, 7, 8, 0, 0, 0, 0, 0, 0, 0};
|
const int mappedWPCDriverGroupEnableIndex[] = {0, 0, 0, 0, 0, 2, 4, 3, 1, 5, 7, 7, 7, 7, 7, 7, 7, 7, 8, 0, 0, 0, 0, 0, 0, 0};
|
||||||
const int mappedSternDriverGroupEnableIndex[] = {0, 0, 0, 0, 1, 0, 2, 3, 0, 0, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9};
|
const int mappedSternDriverGroupEnableIndex[] = {0, 0, 0, 0, 1, 0, 2, 3, 0, 0, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9};
|
||||||
|
const bool mappedWPCDriverGroupPolarity[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
const bool mappedSternDriverGroupPolarity[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
const int lastWPCCoilDriverGroup = 9;
|
const int lastWPCCoilDriverGroup = 9;
|
||||||
const int lastSternCoilDriverGroup = 7;
|
const int lastSternCoilDriverGroup = 7;
|
||||||
const int mappedWPCDriverGroupSlowTime[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 0, 0, 0, 0};
|
const int mappedWPCDriverGroupSlowTime[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 400, 400, 400, 400, 400, 400, 400, 400, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
@@ -294,6 +296,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
const int watchdogResetTime = 1000; // milliseconds
|
const int watchdogResetTime = 1000; // milliseconds
|
||||||
|
|
||||||
int mappedDriverGroupEnableIndex[kPRDriverGroupsMax];
|
int mappedDriverGroupEnableIndex[kPRDriverGroupsMax];
|
||||||
|
bool mappedDriverGroupPolarity[kPRDriverGroupsMax];
|
||||||
int mappedDriverGroupSlowTime[kPRDriverGroupsMax];
|
int mappedDriverGroupSlowTime[kPRDriverGroupsMax];
|
||||||
int mappedDriverGroupActivateIndex[kPRDriverGroupsMax];
|
int mappedDriverGroupActivateIndex[kPRDriverGroupsMax];
|
||||||
int rowEnableIndex1;
|
int rowEnableIndex1;
|
||||||
@@ -315,6 +318,8 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
{
|
{
|
||||||
memcpy(mappedDriverGroupEnableIndex,mappedWPCDriverGroupEnableIndex,
|
memcpy(mappedDriverGroupEnableIndex,mappedWPCDriverGroupEnableIndex,
|
||||||
sizeof(mappedDriverGroupEnableIndex));
|
sizeof(mappedDriverGroupEnableIndex));
|
||||||
|
memcpy(mappedDriverGroupPolarity,mappedWPCDriverGroupPolarity,
|
||||||
|
sizeof(mappedDriverGroupPolarity));
|
||||||
rowEnableIndex1 = 6; // Unused in WPC
|
rowEnableIndex1 = 6; // Unused in WPC
|
||||||
rowEnableIndex0 = 6;
|
rowEnableIndex0 = 6;
|
||||||
tickleSternWatchdog = false;
|
tickleSternWatchdog = false;
|
||||||
@@ -337,6 +342,8 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
{
|
{
|
||||||
memcpy(mappedDriverGroupEnableIndex,mappedSternDriverGroupEnableIndex,
|
memcpy(mappedDriverGroupEnableIndex,mappedSternDriverGroupEnableIndex,
|
||||||
sizeof(mappedDriverGroupEnableIndex));
|
sizeof(mappedDriverGroupEnableIndex));
|
||||||
|
memcpy(mappedDriverGroupPolarity,mappedSternDriverGroupPolarity,
|
||||||
|
sizeof(mappedDriverGroupPolarity));
|
||||||
rowEnableIndex1 = 6; // Unused in Stern
|
rowEnableIndex1 = 6; // Unused in Stern
|
||||||
rowEnableIndex0 = 10;
|
rowEnableIndex0 = 10;
|
||||||
tickleSternWatchdog = true;
|
tickleSternWatchdog = true;
|
||||||
@@ -361,7 +368,8 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
PRDriverState *driver = &drivers[i];
|
PRDriverState *driver = &drivers[i];
|
||||||
memset(driver, 0x00, sizeof(PRDriverState));
|
memset(driver, 0x00, sizeof(PRDriverState));
|
||||||
driver->driverNum = i;
|
driver->driverNum = i;
|
||||||
driver->polarity = globalPolarity;
|
driver->polarity = mappedDriverGroupPolarity[i/8];
|
||||||
|
DEBUG(PRLog(kPRLogInfo,"\nDriver Polarity for Driver: %d is %x.", i,driver->polarity));
|
||||||
if (resetFlags & kPRResetFlagUpdateDevice)
|
if (resetFlags & kPRResetFlagUpdateDevice)
|
||||||
res = DriverUpdateState(driver);
|
res = DriverUpdateState(driver);
|
||||||
}
|
}
|
||||||
@@ -370,7 +378,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
PRDriverGroupConfig *group = &driverGroups[i];
|
PRDriverGroupConfig *group = &driverGroups[i];
|
||||||
memset(group, 0x00, sizeof(PRDriverGroupConfig));
|
memset(group, 0x00, sizeof(PRDriverGroupConfig));
|
||||||
group->groupNum = i;
|
group->groupNum = i;
|
||||||
group->polarity = globalPolarity;
|
group->polarity = mappedDriverGroupPolarity[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
PRDriverGlobalConfig globals;
|
PRDriverGlobalConfig globals;
|
||||||
@@ -417,12 +425,14 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
group.rowActivateIndex = 0;
|
group.rowActivateIndex = 0;
|
||||||
group.rowEnableSelect = 0;
|
group.rowEnableSelect = 0;
|
||||||
group.matrixed = false;
|
group.matrixed = false;
|
||||||
group.polarity = globalPolarity;
|
group.polarity = mappedDriverGroupPolarity[i];
|
||||||
group.active = 1;
|
group.active = 1;
|
||||||
group.disableStrobeAfter = false;
|
group.disableStrobeAfter = false;
|
||||||
|
|
||||||
if (resetFlags & kPRResetFlagUpdateDevice)
|
if (resetFlags & kPRResetFlagUpdateDevice) {
|
||||||
res = DriverUpdateGroupConfig(&group);
|
res = DriverUpdateGroupConfig(&group);
|
||||||
|
DEBUG(PRLog(kPRLogInfo,"\nDriver Polarity for Group: %d is %x.", i,group.polarity));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
driverGroups[i] = group;
|
driverGroups[i] = group;
|
||||||
}
|
}
|
||||||
@@ -436,15 +446,39 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
group.rowActivateIndex = mappedDriverGroupActivateIndex[i];
|
group.rowActivateIndex = mappedDriverGroupActivateIndex[i];
|
||||||
group.rowEnableSelect = rowEnableSelect;
|
group.rowEnableSelect = rowEnableSelect;
|
||||||
group.matrixed = 1;
|
group.matrixed = 1;
|
||||||
group.polarity = globalPolarity;
|
group.polarity = mappedDriverGroupPolarity[i];
|
||||||
group.active = 1;
|
group.active = 1;
|
||||||
group.disableStrobeAfter = mappedDriverGroupSlowTime[i] != 0;
|
group.disableStrobeAfter = mappedDriverGroupSlowTime[i] != 0;
|
||||||
|
|
||||||
if (resetFlags & kPRResetFlagUpdateDevice)
|
if (resetFlags & kPRResetFlagUpdateDevice) {
|
||||||
res = DriverUpdateGroupConfig(&group);
|
res = DriverUpdateGroupConfig(&group);
|
||||||
|
DEBUG(PRLog(kPRLogInfo,"\nDriver Polarity for Group: %d is %x.", i,group.polarity));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
driverGroups[i] = group;
|
driverGroups[i] = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special case for WPC machines. Enable group 18 for the 8-driver board.
|
||||||
|
if (machineType == kPRMachineWPC) {
|
||||||
|
i = 18;
|
||||||
|
DriverGetGroupConfig(i, &group);
|
||||||
|
group.slowTime = 0;
|
||||||
|
group.enableIndex = mappedDriverGroupEnableIndex[i];
|
||||||
|
group.rowActivateIndex = 0;
|
||||||
|
group.rowEnableSelect = 0;
|
||||||
|
group.matrixed = false;
|
||||||
|
group.polarity = mappedDriverGroupPolarity[i];
|
||||||
|
group.active = 1;
|
||||||
|
group.disableStrobeAfter = false;
|
||||||
|
|
||||||
|
if (resetFlags & kPRResetFlagUpdateDevice) {
|
||||||
|
res = DriverUpdateGroupConfig(&group);
|
||||||
|
DEBUG(PRLog(kPRLogInfo,"\nDriver Polarity for Group: %d is %x.\n", i,group.polarity));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
driverGroups[i] = group;
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user