mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 11:21:23 +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:
parent
9567ba19c8
commit
06b7a38d47
1 changed files with 46 additions and 30 deletions
|
@ -842,6 +842,7 @@ static lv_res_t _joycon_info_dump_action(lv_obj_t * btn)
|
||||||
{
|
{
|
||||||
FIL fp;
|
FIL fp;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
int cal_error = 0;
|
||||||
bool is_l_hos = false;
|
bool is_l_hos = false;
|
||||||
bool is_r_hos = false;
|
bool is_r_hos = false;
|
||||||
bool nx_hoag = fuse_read_hw_type() == FUSE_NX_HW_TYPE_HOAG;
|
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)
|
if (!nx_hoag && !jc_pad)
|
||||||
error = 255;
|
error = 255;
|
||||||
|
|
||||||
|
// Try 2 times to get factory calibration data.
|
||||||
|
for (u32 i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
if (!error)
|
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)
|
if (error)
|
||||||
goto disabled_or_cal0_issue;
|
goto disabled_or_cal0_issue;
|
||||||
|
@ -919,6 +929,8 @@ save_data:
|
||||||
f_mkdir("switchroot");
|
f_mkdir("switchroot");
|
||||||
|
|
||||||
// Save IMU Calibration data.
|
// Save IMU Calibration data.
|
||||||
|
if (!error && !cal_error)
|
||||||
|
{
|
||||||
s_printf(data,
|
s_printf(data,
|
||||||
"imu_type=%d\n\n"
|
"imu_type=%d\n\n"
|
||||||
"acc_cal_off_x=0x%X\n"
|
"acc_cal_off_x=0x%X\n"
|
||||||
|
@ -950,6 +962,7 @@ save_data:
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jc_calib_t *stick_cal_l = (jc_calib_t *)cal0->analog_stick_cal_l;
|
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,
|
strcat(txt_buf,
|
||||||
"\n\n#FFDD00 Make sure that both Joy-Con are connected,#\n"
|
"\n\n#FFDD00 Make sure that both Joy-Con are connected,#\n"
|
||||||
"#FFDD00 and that you paired them in HOS!#");
|
"#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
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue