summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Yi <byi@google.com>2018-11-28 18:33:37 -0800
committerBill Yi <byi@google.com>2018-11-28 18:33:37 -0800
commit531ab3f21452317396c35ea14a543148aa052769 (patch)
tree25d2e75375e27d744b5ca3d6646d952303f30867
parentbe7bebf53140a3e908aed14724debc41befa4fa1 (diff)
parente37bcfce975a2243f7ed4328d703642a48d70819 (diff)
downloadcontexthub-pie-cuttlefish-testing.tar.gz
Merge pi-qpr1-release PQ1A.181105.017.A1 to pi-platform-releasepie-platform-releasepie-cuttlefish-testing
Change-Id: Id93b604b4cbe547deef8f1d5e809253ba658fa50
-rw-r--r--firmware/os/algos/calibration/over_temp/over_temp_cal.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/os/algos/calibration/over_temp/over_temp_cal.c b/firmware/os/algos/calibration/over_temp/over_temp_cal.c
index 04a9c924..84d7411f 100644
--- a/firmware/os/algos/calibration/over_temp/over_temp_cal.c
+++ b/firmware/os/algos/calibration/over_temp/over_temp_cal.c
@@ -1444,10 +1444,13 @@ bool isValidOtcLinearModel(const struct OverTempCal *over_temp_cal,
float temp_sensitivity, float sensor_intercept) {
ASSERT_NOT_NULL(over_temp_cal);
+ // Simple check to ensure that the linear model parameters are:
+ // 1. Within the valid range, AND
+ // 2. At least one model parameter is considered non-zero.
return NANO_ABS(temp_sensitivity) < over_temp_cal->temp_sensitivity_limit &&
NANO_ABS(sensor_intercept) < over_temp_cal->sensor_intercept_limit &&
- NANO_ABS(temp_sensitivity) > OTC_MODELDATA_NEAR_ZERO_TOL &&
- NANO_ABS(sensor_intercept) > OTC_MODELDATA_NEAR_ZERO_TOL;
+ (NANO_ABS(temp_sensitivity) > OTC_MODELDATA_NEAR_ZERO_TOL ||
+ NANO_ABS(sensor_intercept) > OTC_MODELDATA_NEAR_ZERO_TOL);
}
bool isValidOtcOffset(const float *offset, float offset_temp_celsius) {