This commit is contained in:
2025-07-05 17:17:50 -04:00
parent 0b86a2bb05
commit a04b090e1b
9 changed files with 84 additions and 3 deletions

View File

@@ -26,4 +26,18 @@ Struct Walkthrough
*x_axis* and *y_axis* fields capture analog input from a joystick, determining direction and speed.
*nav_bttn* represents a joystick push-button.
*led* allows the transmitter to toggle an onboard LED and is used for status indication (e.g. pairing, battery warning, etc).
*led* allows the transmitter to toggle an onboard LED and is used for status indication (e.g. pairing, battery warning, etc).
*motor1_rpm_pwm* to *motor4_rpm_pwm* provide individual PWM signals to four DC motors.
This enables fine-grained speed control, supports differential drive configurations, and even allows for maneuvering in multi-directional platforms like omni-wheel robots.
Why Use __attribute((packed))?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The packed attribute tells the compiler not to add any padding between fields in memory. This makes the struct:
- Compact
- Predictable for serialization over protocols like UART or ESP-NOW
- Ideal for low-latency transmission in embedded systems
This ensures the receiver interprets the exact byte layout you expect, minimizing bandwidth and maximizing compatibility across platforms.