1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-22 18:06:40 +00:00

nyx: retry to dump imu cal and skip it failed

On devices with mangled cal0 imu calibration can now be skipped (still mandatory on Lite).
This commit is contained in:
CTCaer 2024-03-27 10:02:05 +02:00
parent 9567ba19c8
commit 06b7a38d47

View file

@ -842,6 +842,7 @@ static lv_res_t _joycon_info_dump_action(lv_obj_t * btn)
{
FIL fp;
int error = 0;
int cal_error = 0;
bool is_l_hos = false;
bool is_r_hos = false;
bool nx_hoag = fuse_read_hw_type() == FUSE_NX_HW_TYPE_HOAG;
@ -853,8 +854,17 @@ static lv_res_t _joycon_info_dump_action(lv_obj_t * btn)
if (!nx_hoag && !jc_pad)
error = 255;
// Try 2 times to get factory calibration data.
for (u32 i = 0; i < 2; i++)
{
if (!error)
error = hos_dump_cal0();
cal_error = hos_dump_cal0();
if (!cal_error)
break;
}
if (cal_error && nx_hoag)
error = cal_error;
if (error)
goto disabled_or_cal0_issue;
@ -919,6 +929,8 @@ save_data:
f_mkdir("switchroot");
// Save IMU Calibration data.
if (!error && !cal_error)
{
s_printf(data,
"imu_type=%d\n\n"
"acc_cal_off_x=0x%X\n"
@ -950,6 +962,7 @@ save_data:
f_close(&fp);
}
}
}
else
{
jc_calib_t *stick_cal_l = (jc_calib_t *)cal0->analog_stick_cal_l;
@ -1066,6 +1079,9 @@ disabled_or_cal0_issue:;
strcat(txt_buf,
"\n\n#FFDD00 Make sure that both Joy-Con are connected,#\n"
"#FFDD00 and that you paired them in HOS!#");
if (cal_error)
strcat(txt_buf, "\n\n#FF8000 Warning:# Failed to get full calibration data!");
}
else
{