@ -298,9 +298,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
}
void DevicePanel : : updateCalibDescription ( ) {
QString desc =
tr ( " openpilot requires the device to be mounted within 4° left or right and "
" within 5° up or 9° down. openpilot is continuously calibrating, resetting is rarely required. " ) ;
QString desc = tr ( " \n openpilot requires the device to be mounted within 4° left or right and within 5° up or 9° down. " ) ;
std : : string calib_bytes = params . get ( " CalibrationParams " ) ;
if ( ! calib_bytes . empty ( ) ) {
try {
@ -318,7 +316,46 @@ void DevicePanel::updateCalibDescription() {
qInfo ( ) < < " invalid CalibrationParams " ;
}
}
desc + = tr ( " Resetting calibration will restart openpilot if the car is powered on. " ) ;
int lag_perc = 0 ;
std : : string lag_bytes = params . get ( " LiveDelay " ) ;
if ( ! lag_bytes . empty ( ) ) {
try {
AlignedBuffer aligned_buf ;
capnp : : FlatArrayMessageReader cmsg ( aligned_buf . align ( lag_bytes . data ( ) , lag_bytes . size ( ) ) ) ;
lag_perc = cmsg . getRoot < cereal : : Event > ( ) . getLiveDelay ( ) . getCalPerc ( ) ;
} catch ( kj : : Exception ) {
qInfo ( ) < < " invalid LiveDelay " ;
}
}
if ( lag_perc < 100 ) {
desc + = tr ( " \n \n Steering lag calibration is %1% complete. " ) . arg ( lag_perc ) ;
} else {
desc + = tr ( " \n \n Steering lag calibration is complete. " ) ;
}
std : : string torque_bytes = params . get ( " LiveTorqueParameters " ) ;
if ( ! torque_bytes . empty ( ) ) {
try {
AlignedBuffer aligned_buf ;
capnp : : FlatArrayMessageReader cmsg ( aligned_buf . align ( torque_bytes . data ( ) , torque_bytes . size ( ) ) ) ;
auto torque = cmsg . getRoot < cereal : : Event > ( ) . getLiveTorqueParameters ( ) ;
// don't add for non-torque cars
if ( torque . getUseParams ( ) ) {
int torque_perc = torque . getCalPerc ( ) ;
if ( torque_perc < 100 ) {
desc + = tr ( " Steering torque response calibration is %1% complete. " ) . arg ( torque_perc ) ;
} else {
desc + = tr ( " Steering torque response calibration is complete. " ) ;
}
}
} catch ( kj : : Exception ) {
qInfo ( ) < < " invalid LiveTorqueParameters " ;
}
}
desc + = tr ( " \n \n openpilot is continuously calibrating, resetting is rarely required. "
" Resetting calibration will restart openpilot if the car is powered on. " ) ;
resetCalibBtn - > setDescription ( desc ) ;
}