fix: map throttle to axis 3 (AETR layout)
Verified via hid_discover caps and live data dump. Throttle responds on axis 3 (HID usage 0x33 = Rx), not axis 5 or 6.
This commit is contained in:
@@ -14,16 +14,15 @@
|
||||
* bytes 18..19 : buttons bits 8..23
|
||||
* @endcode
|
||||
*
|
||||
* @par Active axes:
|
||||
* | Index | Usage | Physical control | Rest value |
|
||||
* |-------|-------|-----------------|------------|
|
||||
* | 0 | — | unused | always 0 |
|
||||
* | 1 | RX | right stick X | ~1024 |
|
||||
* | 2 | RY | right stick Y | ~1024 |
|
||||
* | 3 | — | unused | always 0 |
|
||||
* | 4 | Z | left stick Y | 0..2047 |
|
||||
* | 5 | VR | left stick X | ~1024 |
|
||||
* | 6..7 | — | unused | always 0 |
|
||||
* @par Active axes (AETR stick mapping):
|
||||
* | Index | Usage | HID name | Physical control | Rest value |
|
||||
* |-------|-------|----------|-----------------|------------|
|
||||
* | 0 | 0x30 | X | unused | always 0 |
|
||||
* | 1 | 0x31 | Y | right stick X | ~1024 |
|
||||
* | 2 | 0x32 | Z | right stick Y | ~1024 |
|
||||
* | 3 | 0x33 | Rx | throttle | ~0 |
|
||||
* | 4 | 0x34 | Ry | left stick X | ~1024 |
|
||||
* | 5..7 | — | unused | always 0 | always 0 |
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -56,8 +55,8 @@ typedef struct {
|
||||
// ---------------------------------------------------------------------------
|
||||
// Radio state
|
||||
//
|
||||
// axes[] holds all 8 HID axes (indices 0-7). Only indices 1, 2, 4, 5
|
||||
// are wired to physical controls. The rest stay at 0.
|
||||
// axes[] holds all 8 HID axes (indices 0-7). Only indices 1, 2, 3, 4
|
||||
// are wired to physical controls (AETR layout). The rest stay at 0.
|
||||
//
|
||||
// buttons is a 24-bit bitmask: bit N set = switch/button N+1 pressed.
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -83,11 +82,11 @@ static inline int16_t stk_right_y(stk_state_t const* s) {
|
||||
}
|
||||
|
||||
static inline int16_t stk_throttle(stk_state_t const* s) {
|
||||
return s->axes[4];
|
||||
return s->axes[3];
|
||||
}
|
||||
|
||||
static inline int16_t stk_left_x(stk_state_t const* s) {
|
||||
return s->axes[5];
|
||||
return s->axes[4];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user