Skip to content

Commit

Permalink
fix version constants for 6 ch in and output modules so they dont hav…
Browse files Browse the repository at this point in the history
…e the same name
  • Loading branch information
SpieringsAE committed Jun 28, 2024
1 parent aa43a4c commit a1e2cff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ToolboxPackagingConfiguration.prj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<param.summary>A toolbox for working with the GOcontroll Moduline controllers</param.summary>
<param.description>This toolbox contains everything necessery to get started developping for the GOcontroll Moduline controllers, it will install the proper compiler and contains various blocks made to interact with the controllers hardware.</param.description>
<param.screenshot>${PROJECT_ROOT}/GOcontroll.png</param.screenshot>
<param.version>4.3.0.4</param.version>
<param.version>4.3.0.5</param.version>
<param.output>${PROJECT_ROOT}/GOcontroll-Simulink.mltbx</param.output>
<param.products.name>
<item>MATLAB</item>
Expand Down
12 changes: 6 additions & 6 deletions blockset/code/GocontrollInputModule.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ uint8_t resistorMatrix[4] = {0,3,1,2};
const uint8_t INPUTMODULE6CHANNELID[] = {20,10,1};
const uint8_t INPUTMODULE10CHANNELID[] = {20,10,2};

const uint32_t VERSIONSECONDSUPPLY_10CHANNEL = 4U;
const uint32_t VERSIONSPIPROTOCOLV2_6CHANNEL = 2 << 16;
const uint32_t VERSIONSECONDSUPPLY_10CHANNELIN = 4U;
const uint32_t VERSIONSPIPROTOCOLV2_6CHANNELIN = 2 << 16;

extern _hardwareConfig hardwareConfig;

Expand Down Expand Up @@ -82,7 +82,7 @@ void InputModule_Configuration(_inputModule *inputModule)
inputModuleDataTx[43] = inputModule->sensorSupply2;
inputModuleDataTx[44] = inputModule->sensorSupply3;

if (inputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNEL) {
if (inputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNELIN) {
GocontrollProcessorboard_SendSpi(inputModule->moduleSlot+1, INPUTMODULE6CHMESSAGELENGTH, 1,11,2,1, inputModule->moduleSlot, &inputModuleDataTx[0],0);
} else {
GocontrollProcessorboard_SendSpi(1, INPUTMODULE6CHMESSAGELENGTH, 1,0,0,0, inputModule->moduleSlot, &inputModuleDataTx[0],0);
Expand All @@ -101,7 +101,7 @@ void InputModule_Configuration(_inputModule *inputModule)

inputModuleDataTx[46] = inputModule->sensorSupply1;

if (inputModule->sw_version >= VERSIONSECONDSUPPLY_10CHANNEL) {
if (inputModule->sw_version >= VERSIONSECONDSUPPLY_10CHANNELIN) {
inputModuleDataTx[47] = inputModule->sensorSupply2;
}

Expand All @@ -117,7 +117,7 @@ void InputModule_ReceiveValues(_inputModule *inputModule)
int res = 0;
if(inputModule->moduleType == INPUTMODULE6CHANNEL)
{
if (inputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNEL) {
if (inputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNELIN) {
res = GocontrollProcessorboard_SendReceiveSpi(inputModule->moduleSlot+1, INPUTMODULE6CHMESSAGELENGTH, 2,11,3,1, inputModule->moduleSlot, &inputModuleDataTx[0], &inputModuleDataRx[0]);
} else {
res = GocontrollProcessorboard_SendReceiveSpi(1, INPUTMODULE6CHMESSAGELENGTH, 2,0,0,0, inputModule->moduleSlot, &inputModuleDataTx[0], &inputModuleDataRx[0]);
Expand Down Expand Up @@ -163,7 +163,7 @@ void InputModule_ResetPulsCounter(_inputModule *inputModule, uint8_t channel, in

if(inputModule->moduleType == INPUTMODULE6CHANNEL)
{
if (inputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNEL) {
if (inputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNELIN) {
GocontrollProcessorboard_SendSpi(inputModule->moduleSlot+1, INPUTMODULE6CHMESSAGELENGTH, 1,11,3,2, inputModule->moduleSlot, &inputModuleDataTx[0],0);
} else {
GocontrollProcessorboard_SendSpi(1, INPUTMODULE6CHMESSAGELENGTH, 3,0,0,0, inputModule->moduleSlot, &inputModuleDataTx[0],0);
Expand Down
8 changes: 4 additions & 4 deletions blockset/code/GocontrollOutputModule.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static uint8_t outputModuleDataRx[OUTPUTMODULE10CHMESSAGELENGTH+MESSAGEOVERLENGT
const uint8_t OUTPUTMODULE6CHANNELID[] = {20,20,2};
const uint8_t OUTPUTMODULE10CHANNELID[] = {20,20,3};

const uint32_t VERSIONSPIPROTOCOLV2_6CHANNEL = 2 << 16;
const uint32_t VERSIONSPIPROTOCOLV2_6CHANNELOUT = 2 << 16;

extern _hardwareConfig hardwareConfig;

Expand All @@ -70,7 +70,7 @@ void OutputModule_Configuration(_outputModule *outputModule)
*(uint16_t*) &outputModuleDataTx[channel*2+12] = outputModule->currentMax[channel];
}

if (outputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNEL) {
if (outputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNELOUT) {
GocontrollProcessorboard_SendSpi(outputModule->moduleSlot+1, OUTPUTMODULE6CHMESSAGELENGTH, 1,22,2,1, outputModule->moduleSlot, &outputModuleDataTx[0],0);
} else {
GocontrollProcessorboard_SendSpi(1, OUTPUTMODULE6CHMESSAGELENGTH, 101,0,0,0, outputModule->moduleSlot, &outputModuleDataTx[0],0);
Expand All @@ -83,7 +83,7 @@ void OutputModule_Configuration(_outputModule *outputModule)
}

/* The second initialization message is delayed by 500 us because the module needs to handle the first message */
if (outputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNEL) {
if (outputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNELOUT) {
GocontrollProcessorboard_SendSpi(outputModule->moduleSlot+1, OUTPUTMODULE6CHMESSAGELENGTH, 1,22,2,2, outputModule->moduleSlot, &outputModuleDataTx[0],500);
} else {
GocontrollProcessorboard_SendSpi(1, OUTPUTMODULE6CHMESSAGELENGTH, 111,0,0,0, outputModule->moduleSlot, &outputModuleDataTx[0],500);
Expand Down Expand Up @@ -127,7 +127,7 @@ void OutputModule_SendValues(_outputModule *outputModule)
*(uint16_t*) &outputModuleDataTx[(channel*6)+6] = outputModule->value[channel];
*(uint32_t*) &outputModuleDataTx[(channel*6)+8] = outputModule->syncCounter[channel];
}
if (outputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNEL) {
if (outputModule->sw_version >= VERSIONSPIPROTOCOLV2_6CHANNELOUT) {
res = GocontrollProcessorboard_SendReceiveSpi(outputModule->moduleSlot+1, OUTPUTMODULE6CHMESSAGELENGTH, 1,22,3,1, outputModule->moduleSlot, &outputModuleDataTx[0], &outputModuleDataRx[0]);
} else {
res = GocontrollProcessorboard_SendReceiveSpi(1, OUTPUTMODULE6CHMESSAGELENGTH, 102,0,0,0, outputModule->moduleSlot, &outputModuleDataTx[0], &outputModuleDataRx[0]);
Expand Down

0 comments on commit a1e2cff

Please sign in to comment.