-
Notifications
You must be signed in to change notification settings - Fork 0
MiP_Infrared
Manages MiP's infrared subsystem for robot detection and remote control.
Signature: void enableMiPDetectionMode(uint8_t id, uint8_t txPower)
Summary: Enables MiP detection mode (allows detecting other MiPs via IR).
Details:
Configures MiP to broadcast a unique ID over IR and listen for other nearby MiPs.
Parameters:
| Parameter | Description |
|---|---|
id |
Unique ID for this MiP (used in detection events broadcast to others). |
txPower |
Transmit power level (1-120). |
Signature: void disableMiPDetectionMode()
Summary: Disables MiP detection mode.
Details:
Stops broadcasting MiP's ID over IR.
Signature: bool isMiPDetectionModeEnabled()
Summary: Checks if MiP detection mode is currently enabled.
Returns: true if detection mode is active (broadcast ID > 0), false otherwise.
Signature: uint8_t readDetectedMiP()
Summary: Reads the next detected MiP event from the queue.
Details:
Processes pending serial data first. Pops the oldest detected MiP ID from the internal queue.
Returns: ID of the detected MiP (1-255), or 0 if no event is available.
Signature: uint8_t availableDetectedMiPEvents()
Summary: Returns the number of unread detected MiP events in the queue.
Details:
Processes pending serial data first to update the queue before checking.
Returns: Number of available MiP detection events in the queue.
Signature: void enableRemoteControl()
Summary: Enables IR remote control mode.
Details:
Verified operation: sends the enable command and reads back state with retry.
Signature: void disableRemoteControl()
Summary: Disables IR remote control mode.
Details:
Verified operation: sends the disable command and reads back state with retry.
Signature: bool isRemoteControlEnabled()
Summary: Checks if IR remote control mode is currently enabled.
Returns: true if IR remote control mode is active, false otherwise.
Signature: void sendDongleCode(const MiPIRDongleCode &irCode, uint8_t transmitPower)
Summary: Transmits a 2-, 3-, or 4-byte IR dongle code using a struct (fire and forget).
Details:
Transmits the IR payload stored in irCode at the specified transmit power. No read-back verification is performed as there is no feedback mechanism over IR.
Parameters:
| Parameter | Description |
|---|---|
irCode |
Struct containing code value and byte length (2, 3, or 4). |
transmitPower |
Transmit power level (1-120). |
Signature: void sendDongleCode(uint32_t code, uint8_t length, uint8_t transmitPower)
Summary: Transmits a variable-length IR dongle code using direct values (fire and forget).
Details:
Transmits the specified numerical code value at the given length and transmitPower. No read-back verification is performed as there is no feedback mechanism over IR.
Parameters:
| Parameter | Description |
|---|---|
code |
Up to 32-bit numerical IR code value. |
length |
Code length in bytes (2, 3, or 4). |
transmitPower |
Transmit power level (1-120). |
Signature: MiPIRDongleCode readDongleCode()
Summary: Reads the next received IR dongle code from the queue.
Details:
Processes pending serial data first. Pops the oldest IR dongle code from the queue.
Returns: MiPIRDongleCode struct containing the code value and its byte length. Returns an empty/invalid struct (length = 0, code = 0xFFFFFFFF) if no event is available.
Signature: uint8_t availableCodeEvents()
Summary: Returns the number of unread IR dongle code events in the queue.
Details:
Processes pending serial data first to update the queue before checking.
Returns: Number of available IR code events in the queue.
Signature: void processEvent(uint8_t command, const uint8_t *payload, size_t length)
Summary: Handles incoming infrared OOB event notifications from the transport layer.
Details:
Called by MiP::dispatchEvent() when an IR detection or received dongle code event arrives over UART. Parses the payload and pushes the event into the appropriate queue.
Parameters:
| Parameter | Description |
|---|---|
command |
Command byte indicating the specific IR notification type. |
payload |
Pointer to the raw response buffer. |
length |
Length of the payload in bytes. |
- MiP
- MiPChestLED
- MiPClapSettings
- MiPDebug
- MiPHardwareInfo
- MiPHeadLEDs
- MiPIRDongleCode
- MiPSoftwareVersion
- MiPStatus
- MiP_Battery
- MiP_ChestLED
- MiP_Clap
- MiP_EEPROM
- MiP_Gesture
- MiP_HeadLEDs
- MiP_Infrared
- MiP_Mode
- MiP_Motion
- MiP_Odometer
- MiP_Position
- MiP_Radar
- MiP_Serial
- MiP_Shake
- MiP_Sound
- MiP_Version
- MiP_Weight
- MiP_WiFi