Skip to content

Commit

Permalink
Don't treat alarmData.usErrorNo as an amount
Browse files Browse the repository at this point in the history
It's actually just the error code itself.

MAX_ERROR_COUNT is always 1 (on supported generations of controllers), but let's still treat it as something that can change, to facilitate future updates.
  • Loading branch information
gavanderhoorn committed Aug 1, 2023
1 parent 483cd61 commit e8e66c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ControllerStatusIO.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ int Ros_Controller_GetAlarmCode()
return -1;
}

int Ros_Controller_GetActiveAlarmCodes(USHORT active_alarms[MAX_ALARM_COUNT + 1])
int Ros_Controller_GetActiveAlarmCodes(USHORT active_alarms[MAX_ALARM_COUNT + MAX_ERROR_COUNT])
{
MP_ALARM_CODE_RSP_DATA alarmData;
bzero(&alarmData, sizeof(alarmData));
Expand All @@ -736,7 +736,7 @@ int Ros_Controller_GetActiveAlarmCodes(USHORT active_alarms[MAX_ALARM_COUNT + 1]

// if the output array is too small, we can't do anything either. This
// should not happen, but best check for it.
if (alarmData.usAlarmNum + alarmData.usErrorNo > MAX_ALARM_COUNT + 1)
if (alarmData.usAlarmNum + MAX_ERROR_COUNT > MAX_ALARM_COUNT + MAX_ERROR_COUNT)
return -2;

// add all alarms to the output array
Expand Down
2 changes: 1 addition & 1 deletion src/ControllerStatusIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ extern void Ros_Controller_SetIOState(ULONG signal, BOOL status);
extern int Ros_Controller_GetAlarmCode();

//retrieve all active alarms (and a possible error) and store them in 'active_alarms'
extern int Ros_Controller_GetActiveAlarmCodes(USHORT active_alarms[MAX_ALARM_COUNT + 1]);
extern int Ros_Controller_GetActiveAlarmCodes(USHORT active_alarms[MAX_ALARM_COUNT + MAX_ERROR_COUNT]);


//#define DUMMY_SERVO_MODE 1 // Dummy servo mode is used for testing with Yaskawa debug controllers
Expand Down

0 comments on commit e8e66c7

Please sign in to comment.