KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Analog Calibration

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_tmie_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.
 

Detailed Description

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().

Enumeration Type Documentation

◆ mie_analog_calib_step_t

Interactive calibration step.

Returned by mie_analog_calib_current() to drive the UI prompts. Each step is confirmed with mie_analog_calib_capture().

Enumerator
MIE_ANALOG_CALIB_IDLE 

No session running.

MIE_ANALOG_CALIB_WHEEL 

Turn the wheel fully both ways.

MIE_ANALOG_CALIB_WHEEL_CENTER 

Hold the wheel centered.

MIE_ANALOG_CALIB_ACCEL 

Release then fully press accelerator.

MIE_ANALOG_CALIB_BRAKE 

Release then fully press brake.

Function Documentation

◆ mie_analog_calib_active()

bool mie_analog_calib_active ( void )

Check whether a calibration session is running.

Return values
trueA session is active.
falseNo session is running.

Referenced by main(), and ui_build().

◆ mie_analog_calib_cancel()

void mie_analog_calib_cancel ( void )

Cancel a running calibration session.

The previously active calibration is left untouched.

◆ mie_analog_calib_capture()

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.

Return values
trueThe session finished. Inspect mie_analog_calib_get() for the result (unchanged if invalid).
falseAdvanced to the next step.

Referenced by main().

◆ mie_analog_calib_current()

mie_analog_calib_step_t mie_analog_calib_current ( void )

Query the current calibration step.

Returns
The active mie_analog_calib_step_t.

Referenced by ui_build().

◆ mie_analog_calib_get()

const mie_analog_calib_t * mie_analog_calib_get ( void )

Get the active driver calibration.

Returns
Pointer to the current calibration. Use mie_analog_calib_valid() to check whether it is usable.

◆ mie_analog_calib_reset()

void mie_analog_calib_reset ( void )

Clear the active calibration and any running session.

◆ mie_analog_calib_set()

void mie_analog_calib_set ( const mie_analog_calib_t * calib)

Install a calibration set.

Parameters
calibCalibration to copy into the driver. Invalid ranges fall back to the legacy mapping.

◆ mie_analog_calib_start()

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().

◆ mie_analog_calib_valid()

bool mie_analog_calib_valid ( void )

Check whether the active calibration has usable ranges.

Return values
trueWheel and pedal ranges are valid.
falseAt least one axis range is invalid.

Referenced by ui_build().

◆ mie_analog_norm_accel()

int mie_analog_norm_accel ( uint16_t raw)

Normalize a raw JVS accelerator value.

Returns
Normalized pedal position (0 to 255).

◆ mie_analog_norm_brake()

int mie_analog_norm_brake ( uint16_t raw)

Normalize a raw JVS brake value.

Returns
Normalized pedal position (0 to 255).

◆ mie_analog_norm_wheel()

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.

Returns
Normalized wheel position (-128 to 127).