Skip to content

Commit

Permalink
Merge pull request #46 from auscompgeek/fix-limit-switch-sim
Browse files Browse the repository at this point in the history
Fix limit switch sim for Talon SRX data port
  • Loading branch information
virtuald committed Feb 13, 2018
2 parents 9fc47f6 + 155ac5e commit 9ec92b9
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions gen/MotController_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ c_MotController_Create1:
'limit_switch_closed_rev': False,
# Remote limit switches?
'limit_switch_remote_for': LimitSwitchSource.Deactivated,
'limit_switch_remote_rev': LimitSwitchSource.Deactivated,
'limit_switch_source_for': LimitSwitchSource.Deactivated,
'limit_switch_source_rev': LimitSwitchSource.Deactivated,
'limit_switch_follow_for': deviceId,
'limit_switch_follow_rev': deviceId,
Expand Down Expand Up @@ -576,19 +576,21 @@ c_MotController_ConfigVelocityMeasurementWindow:
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigForwardLimitSwitchSource:
code: |
self.hal_data['limit_switch_remote_for'] = type
self.hal_data['limit_switch_source_for'] = type
self.hal_data['limit_switch_follow_for'] = deviceID
doc: |
Configures the forward limit switch for a remote source. For example, a
CAN motor controller may need to monitor the Limit-F pin of another Talon
or CANifier.
Configures the forward limit switch for a local/remote source. For example,
a CAN motor controller may need to monitor the Limit-F pin of another Talon,
CANifier, or local Gadgeteer feedback connector.
:param type:
Remote limit switch source. User can choose between a remote
Talon SRX, CANifier, or deactivate the feature.
Limit switch source. User can choose between the feedback connector,
a remote Talon SRX, CANifier, or deactivate the feature.
:type type: :class:`LimitSwitchSource`
:param normalOpenOrClose:
Setting for normally open, normally closed, or disabled. This
setting matches the web-based configuration drop down.
:type normalOpenOrClose: :class:`LimitSwitchNormal`
:param deviceID:
Device ID of remote source (Talon SRX or CANifier device ID).
:param timeoutMs:
Expand All @@ -598,19 +600,21 @@ c_MotController_ConfigForwardLimitSwitchSource:
:returns: Error Code generated by function. 0 indicates no error.
c_MotController_ConfigReverseLimitSwitchSource:
code: |
self.hal_data['limit_switch_remote_rev'] = type
self.hal_data['limit_switch_source_rev'] = type
self.hal_data['limit_switch_follow_rev'] = deviceID
doc: |
Configures the reverse limit switch for a remote source. For example, a
CAN motor controller may need to monitor the Limit-R pin of another Talon
or CANifier.
Configures the reverse limit switch for a local/remote source. For example,
a CAN motor controller may need to monitor the Limit-R pin of another Talon,
CANifier, or local Gadgeteer feedback connector.
:param type:
Remote limit switch source. User can choose between a remote
Talon SRX, CANifier, or deactivate the feature.
Limit switch source. User can choose between the feedback connector,
a remote Talon SRX, CANifier, or deactivate the feature.
:type type: :class:`LimitSwitchSource`
:param normalOpenOrClose:
Setting for normally open, normally closed, or disabled. This
setting matches the web-based configuration drop down.
:type normalOpenOrClose: :class:`LimitSwitchNormal`
:param deviceID:
Device ID of remote source (Talon SRX or CANifier device ID).
:param timeoutMs:
Expand Down Expand Up @@ -1349,13 +1353,13 @@ c_MotController_GetPinStateQuadIdx:
c_MotController_IsFwdLimitSwitchClosed:
code: |
data = self.hal_data
if self.hal_data['limit_switch_remote_for'] != LimitSwitchSource.Deactivated:
if self.hal_data['limit_switch_source_for'] not in (LimitSwitchSource.Deactivated, LimitSwitchSource.FeedbackConnector):
data = hal_data['CAN'][self.hal_data['limit_switch_follow_for']]
retval = 1 if data['limit_switch_closed_for'] else 0
c_MotController_IsRevLimitSwitchClosed:
code: |
data = self.hal_data
if self.hal_data['limit_switch_remote_rev'] != LimitSwitchSource.Deactivated:
if self.hal_data['limit_switch_source_rev'] not in (LimitSwitchSource.Deactivated, LimitSwitchSource.FeedbackConnector):
data = hal_data['CAN'][self.hal_data['limit_switch_follow_rev']]
retval = 1 if data['limit_switch_closed_rev'] else 0
c_MotController_GetFaults:
Expand Down Expand Up @@ -1414,9 +1418,9 @@ c_MotController_GetQuadPinStates:
c_MotController_GetLimitSwitchState:
code: |
fwd_data = rev_data = self.hal_data
if self.hal_data['limit_switch_remote_for'] != LimitSwitchSource.Deactivated:
if self.hal_data['limit_switch_source_for'] not in (LimitSwitchSource.Deactivated, LimitSwitchSource.FeedbackConnector):
fwd_data = hal_data['CAN'][self.hal_data['limit_switch_follow_for']]
if self.hal_data['limit_switch_remote_rev'] != LimitSwitchSource.Deactivated:
if self.hal_data['limit_switch_source_rev'] not in (LimitSwitchSource.Deactivated, LimitSwitchSource.FeedbackConnector):
rev_data = hal_data['CAN'][self.hal_data['limit_switch_follow_rev']]
retval = fwd_data['limit_switch_closed_for'], rev_data['limit_switch_closed_rev']
doc: |
Expand Down

0 comments on commit 9ec92b9

Please sign in to comment.