|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
JVS wheel and pedal calibration More...
Data Structures | |
| struct | mie_analog_axis_calib_t |
| Per-axis JVS analog calibration data. More... | |
| struct | mie_analog_calib_t |
| Wheel and pedal calibration set. More... | |
Enumerations | |
| enum | mie_analog_calib_step_t { MIE_ANALOG_CALIB_IDLE = 0 , MIE_ANALOG_CALIB_WHEEL , MIE_ANALOG_CALIB_WHEEL_CENTER , MIE_ANALOG_CALIB_ACCEL , MIE_ANALOG_CALIB_BRAKE } |
| Interactive calibration step. More... | |
Functions | |
| const mie_analog_calib_t * | mie_analog_calib_get (void) |
| Get the active driver calibration. | |
| void | mie_analog_calib_set (const mie_analog_calib_t *calib) |
| Install a calibration set. | |
| bool | mie_analog_calib_valid (void) |
| Check whether the active calibration has usable ranges. | |
| void | mie_analog_calib_reset (void) |
| Clear the active calibration and any running session. | |
| void | mie_analog_calib_start (void) |
| Start the interactive calibration session. | |
| void | mie_analog_calib_cancel (void) |
| Cancel a running calibration session. | |
| bool | mie_analog_calib_active (void) |
| Check whether a calibration session is running. | |
| mie_analog_calib_step_t | mie_analog_calib_current (void) |
| Query the current calibration step. | |
| bool | mie_analog_calib_capture (void) |
| Confirm the current step and advance the session. | |
| int | mie_analog_norm_wheel (uint16_t raw) |
| Normalize a raw JVS wheel value. | |
| int | mie_analog_norm_accel (uint16_t raw) |
| Normalize a raw JVS accelerator value. | |
| int | mie_analog_norm_brake (uint16_t raw) |
| Normalize a raw JVS brake value. | |
JVS wheel and pedal calibration
The driver maps the JVS wheel and pedal channels into mie_state_t::cont (joyx, rtrig, ltrig). With a valid calibration installed the values are normalized (joyx -128 to 127, triggers 0 to 255); otherwise a built-in legacy mapping is used. While an interactive calibration session is running, the raw channel values are passed through to cont unchanged.
Use mie_analog_calib_start() and mie_analog_calib_capture() to run the interactive flow, then persist the result obtained with mie_analog_calib_get() and restore it later with mie_analog_calib_set().
For raw mie_jvs_inputs_t values use mie_analog_norm_wheel(), mie_analog_norm_accel(), and mie_analog_norm_brake().
Interactive calibration step.
Returned by mie_analog_calib_current() to drive the UI prompts. Each step is confirmed with mie_analog_calib_capture().
| bool mie_analog_calib_active | ( | void | ) |
Check whether a calibration session is running.
| true | A session is active. |
| false | No session is running. |
Referenced by main(), and ui_build().
| void mie_analog_calib_cancel | ( | void | ) |
Cancel a running calibration session.
The previously active calibration is left untouched.
| bool mie_analog_calib_capture | ( | void | ) |
Confirm the current step and advance the session.
For the wheel and pedal range steps the tracked extremes are kept. For the center step the latest raw wheel value is stored. On the final step the result is validated and, when valid, installed as the active calibration.
| true | The session finished. Inspect mie_analog_calib_get() for the result (unchanged if invalid). |
| false | Advanced to the next step. |
Referenced by main().
| mie_analog_calib_step_t mie_analog_calib_current | ( | void | ) |
Query the current calibration step.
Referenced by ui_build().
| const mie_analog_calib_t * mie_analog_calib_get | ( | void | ) |
Get the active driver calibration.
| void mie_analog_calib_reset | ( | void | ) |
Clear the active calibration and any running session.
| void mie_analog_calib_set | ( | const mie_analog_calib_t * | calib | ) |
Install a calibration set.
| calib | Calibration to copy into the driver. Invalid ranges fall back to the legacy mapping. |
| void mie_analog_calib_start | ( | void | ) |
Start the interactive calibration session.
Begins at MIE_ANALOG_CALIB_WHEEL. While a session runs the driver tracks channel extremes automatically and feeds raw values to mie_state_t::cont.
Referenced by main().
| bool mie_analog_calib_valid | ( | void | ) |
Check whether the active calibration has usable ranges.
| true | Wheel and pedal ranges are valid. |
| false | At least one axis range is invalid. |
Referenced by ui_build().
| int mie_analog_norm_accel | ( | uint16_t | raw | ) |
Normalize a raw JVS accelerator value.
| int mie_analog_norm_brake | ( | uint16_t | raw | ) |
Normalize a raw JVS brake value.
| int mie_analog_norm_wheel | ( | uint16_t | raw | ) |
Normalize a raw JVS wheel value.
Uses the active calibration when valid, otherwise the built-in legacy mapping. Does not pass raw values through during a calibration session; use mie_state_t::jvs or mie_state_t::cont for live capture.