mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-18 12:08:38 +00:00
A new controller no longer inherits the previous one's gyro bias, and a calibration where the pad moved is rejected
The bias reset in sensors_ready only ran when sensor_pad was nonzero, but scan_pads zeroes it on every disconnect, so a pad connected after another one kept the old pad's bias, and an attempt still collecting finished on the new pad under the old pad's name. The bias was also loaded only once, at the first StartSixAxisSensor. - input.c pad_bias_select runs for every pad the sensor code sees: it drops the old bias and attempt, then loads the saved bias when gyro_bias_pad names this pad. scan_pads drops them on disconnect. The bias loads with gyro_calibration off too, so turning the switch on mid-run applies it. - The pad identity is the name plus an FNV-1a hash of SDL's serial when the pad reports one, so two pads of one model no longer share a bias; the hash keeps the Bluetooth address out of totk.ini and the log. - An attempt skips 0.5 s of samples (the button press shakes the pad), then averages 1 s. It is rejected when the largest per-axis standard deviation exceeds 0.04 rad/s; a steady bias of any size passes. The row then says the controller moved (new UI_MENU_GYRO_CALIBRATE_MOVED in all four catalogs) and the bias in effect stays. - The timeout counts 5 s without a sample, not 5 s from the start. - Calibrate gyro starts the sensor thread when the game has not yet (title screen) instead of doing nothing. - Row states are an enum (MOTION_CALIB_*); motion_calibrate_start takes the clock, and only the gamepad's fusion instance writes totk.ini, so --probe-services now checks a measured bias, a rejected attempt and the timeout. - The duplicate copy_name in motion_fusion.c is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0a792f22c1
commit
0efa904d90
9 files changed
+267
-182
No files matched your search
+5
-3
@@ -967,12 +967,14 @@ static void tab_controls(float scale) {
|
||||
char pad[128] = "";
|
||||
int st = input_motion_calib_state(pad, sizeof pad);
|
||||
char status[192] = "";
|
||||
if (st == 1)
|
||||
if (st == MOTION_CALIB_COLLECTING)
|
||||
snprintf(status, sizeof status, "%s", menu_text(UI_MENU_GYRO_CALIBRATE_WAIT));
|
||||
else if (st == 2)
|
||||
else if (st == MOTION_CALIB_DONE)
|
||||
snprintf(status, sizeof status, menu_text(UI_MENU_GYRO_CALIBRATED), pad);
|
||||
else if (st == 3)
|
||||
else if (st == MOTION_CALIB_FAILED)
|
||||
snprintf(status, sizeof status, "%s", menu_text(UI_MENU_GYRO_CALIBRATE_FAILED));
|
||||
else if (st == MOTION_CALIB_MOVED)
|
||||
snprintf(status, sizeof status, "%s", menu_text(UI_MENU_GYRO_CALIBRATE_MOVED));
|
||||
if (opt_button("##gyro_calib", UI_MENU_GYRO_CALIBRATE, UI_MENU_GYRO_CALIBRATE_DESC, status))
|
||||
input_motion_calibrate();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user