CTRE Phoenix C++ 5.33.1
ErrorCode.h
Go to the documentation of this file.
1/* Copyright (C) Cross The Road Electronics 2024 */
2#pragma once
3
4#include <stdint.h>
5
6namespace ctre {
7namespace phoenix {
8
10#ifdef __cplusplus
11 : int32_t
12#endif
13{
14 OK = 0,
15 OKAY = 0, //!< No Error - Function executed as expected
16
17 //CAN-Related
20 TxFailed = -1, //!< Could not transmit the CAN frame.
21 InvalidParamValue = -2, //!< Caller passed an invalid param
23 RxTimeout = -3, //!< CAN frame has not been received within specified period of time.
25 TxTimeout = -4, //!< Not used.
27 UnexpectedArbId = -5, //!< Specified CAN Id is invalid.
29 BufferFull = +6,//!< Caller attempted to insert data into a buffer that is full.
31 SensorNotPresent = -7, //!< Sensor is not present
36
37 //General
38 GeneralError = -100, //!< User Specified General Error
40
41 //Signal
43 SigNotUpdated = -200, //!< Have not received an value response for signal.
45
46 //Gadgeteer Port Error Codes
47 //These include errors between ports and modules
50
51 //Gadgeteer Module Error Codes
52 //These apply only to the module units themselves
56
57 //API
65
66 //Higher Level
68 InvalidHandle = -601, //!< Handle does not match stored map of handles
69
70 //Firmware Versions
78
79 //Operating system centric
83
84 //MIDI and Orchestra centric
93
95 kInvalidGuid = -1001,
98 kInvalidPath = -1004,
102 kSendFailed = -1008,
110
111 //CAN Related
112 PulseWidthSensorNotPresent = +10, //!< Special Code for "isSensorPresent"
113
114 //General
116 FeatureNotSupported = 101, // feature not implement in the API or firmware
117 NotImplemented = 102, // feature not implement in the API
119 FeaturesNotAvailableYet = 104, // feature will be release in an upcoming release
120 ControlModeNotValid = 105, // Current control mode of motor controller not valid for this call
127
128 //Simulation
132};
134public:
136 _firstError = OK;
137 }
138 void NewError(ErrorCode err) {
139 _firstError = FirstOne(_firstError, err);
140 }
141 void NewError(int err) {
142 _firstError = FirstOne(_firstError, (ErrorCode) err);
143 }
145 {
146 return _firstError;
147 }
148private:
149
150 static ErrorCode FirstOne(ErrorCode errorCode1, ErrorCode errorCode2) {
151 if (errorCode1 != OK)
152 return errorCode1;
153 return errorCode2;
154 }
155
156 ErrorCode _firstError;
157};
158
159} // namespace phoenix
160} // namespace ctre
Definition: ErrorCode.h:133
void NewError(int err)
Definition: ErrorCode.h:141
ErrorCode GetFirstNonZeroError()
Definition: ErrorCode.h:144
ErrorCollection()
Definition: ErrorCode.h:135
void NewError(ErrorCode err)
Definition: ErrorCode.h:138
ErrorCode
Definition: ErrorCode.h:13
@ kInvalidProtocol
Definition: ErrorCode.h:97
@ TalonFXFirmwarePreVBatDetect
Definition: ErrorCode.h:76
@ CANdleAnimationsRequireHigherFirm
Definition: ErrorCode.h:77
@ GeneralError
User Specified General Error.
Definition: ErrorCode.h:38
@ kWinUsbQueryFailed
Definition: ErrorCode.h:106
@ CANdleAnimSlotOutOfBounds
Definition: ErrorCode.h:64
@ SigNotUpdated
Have not received an value response for signal.
Definition: ErrorCode.h:43
@ OK
Definition: ErrorCode.h:14
@ kInvalidGuid
Definition: ErrorCode.h:95
@ CouldNotChangePeriod
Definition: ErrorCode.h:33
@ GENERAL_ERROR
Definition: ErrorCode.h:39
@ FirmwareTooOld
Definition: ErrorCode.h:32
@ GEN_PORT_ERROR
Definition: ErrorCode.h:48
@ MusicFileTooNew
Definition: ErrorCode.h:87
@ kReceiveFailed
Definition: ErrorCode.h:103
@ kWinUsbGeneralError
Definition: ErrorCode.h:107
@ ConfigMotionSCurveRequiresHigherFirm
Definition: ErrorCode.h:75
@ InvalidOrchestraAction
Definition: ErrorCode.h:89
@ MusicFileNotFound
Definition: ErrorCode.h:85
@ MissingRoutineInLibrary
Definition: ErrorCode.h:81
@ SimDeviceNotFound
Definition: ErrorCode.h:129
@ kGeneralWinUsbError
Definition: ErrorCode.h:99
@ PORT_MODULE_TYPE_MISMATCH
Definition: ErrorCode.h:49
@ SimDeviceAlreadyExists
Definition: ErrorCode.h:131
@ kWinUsbInitFailed
Definition: ErrorCode.h:105
@ BufferFull
Caller attempted to insert data into a buffer that is full.
Definition: ErrorCode.h:29
@ CAN_OVERFLOW
Definition: ErrorCode.h:30
@ UnexpectedArbId
Specified CAN Id is invalid.
Definition: ErrorCode.h:27
@ GEN_MODULE_ERROR
Definition: ErrorCode.h:53
@ TicksPerRevZero
Definition: ErrorCode.h:59
@ TxFailed
Could not transmit the CAN frame.
Definition: ErrorCode.h:20
@ kFailedSetup
Definition: ErrorCode.h:100
@ TxTimeout
Not used.
Definition: ErrorCode.h:25
@ MusicFileInvalid
Definition: ErrorCode.h:88
@ MotProfFirmThreshold2
Definition: ErrorCode.h:126
@ FeaturesNotAvailableYet
Definition: ErrorCode.h:119
@ IncompatibleMode
Definition: ErrorCode.h:67
@ GainsAreNotSet
Definition: ErrorCode.h:61
@ CAN_NO_SESSIONS_AVAIL
Definition: ErrorCode.h:28
@ CAN_MSG_NOT_FOUND
Definition: ErrorCode.h:24
@ InvalidHandle
Handle does not match stored map of handles.
Definition: ErrorCode.h:68
@ BufferFailure
Definition: ErrorCode.h:34
@ RxTimeout
CAN frame has not been received within specified period of time.
Definition: ErrorCode.h:23
@ ConfigFactoryDefaultRequiresHigherFirm
Definition: ErrorCode.h:74
@ MODULE_NOT_INIT_GET_ERROR
Definition: ErrorCode.h:55
@ ResourceNotAvailable
Definition: ErrorCode.h:82
@ kInvalidRespFormat
Definition: ErrorCode.h:104
@ MotProfFirmThreshold
Definition: ErrorCode.h:125
@ MotorControllerFeatureRequiresHigherFirm
Definition: ErrorCode.h:72
@ RemoteSensorsNotSupportedYet
Definition: ErrorCode.h:124
@ CAN_TX_FULL
Definition: ErrorCode.h:19
@ MusicNotSupported
Definition: ErrorCode.h:92
@ WheelRadiusTooSmall
Definition: ErrorCode.h:58
@ MusicInterrupted
Definition: ErrorCode.h:91
@ kFirmwareInvalidResponse
Definition: ErrorCode.h:109
@ DoubleVoltageCompensatingWPI
Definition: ErrorCode.h:63
@ DistanceBetweenWheelsTooSmall
Definition: ErrorCode.h:60
@ NotImplemented
Definition: ErrorCode.h:117
@ CascadedPIDNotSupporteYet
Definition: ErrorCode.h:122
@ TalonFeatureRequiresHigherFirm
Definition: ErrorCode.h:73
@ kAccessDenied
Definition: ErrorCode.h:108
@ ControlModeNotSupportedYet
Definition: ErrorCode.h:121
@ GeneralWarning
Definition: ErrorCode.h:115
@ FirmVersionCouldNotBeRetrieved
Definition: ErrorCode.h:118
@ SIG_NOT_UPDATED
Definition: ErrorCode.h:42
@ MusicFileWrongSize
Definition: ErrorCode.h:86
@ NotAllPIDValuesUpdated
Definition: ErrorCode.h:44
@ SimPhysicsTypeNotSupported
Definition: ErrorCode.h:130
@ WrongRemoteLimitSwitchSource
Definition: ErrorCode.h:62
@ CAN_INVALID_PARAM
Definition: ErrorCode.h:22
@ kInvalidInterface
Definition: ErrorCode.h:94
@ kSendFailed
Definition: ErrorCode.h:102
@ LibraryCouldNotBeLoaded
Definition: ErrorCode.h:80
@ MODULE_NOT_INIT_SET_ERROR
Definition: ErrorCode.h:54
@ MusicFileTooOld
Definition: ErrorCode.h:90
@ AuxiliaryPIDNotSupportedYet
Definition: ErrorCode.h:123
@ kInvalidClass
Definition: ErrorCode.h:96
@ SensorNotPresent
Sensor is not present.
Definition: ErrorCode.h:31
@ CAN_NO_MORE_TX_JOBS
Definition: ErrorCode.h:26
@ FeatureRequiresHigherFirm
Definition: ErrorCode.h:71
@ CAN_MSG_STALE
Definition: ErrorCode.h:18
@ InvalidParamValue
Caller passed an invalid param.
Definition: ErrorCode.h:21
@ ControlModeNotValid
Definition: ErrorCode.h:120
@ PulseWidthSensorNotPresent
Special Code for "isSensorPresent".
Definition: ErrorCode.h:112
@ OKAY
No Error - Function executed as expected.
Definition: ErrorCode.h:15
@ FeatureNotSupported
Definition: ErrorCode.h:116
@ kInvalidPath
Definition: ErrorCode.h:98
@ FirwmwareNonFRC
Definition: ErrorCode.h:35
@ kListenFailed
Definition: ErrorCode.h:101
namespace ctre
Definition: paramEnum.h:5