Skip to content

Commit

Permalink
feat(thermocycler-gen2): ignore thermistor uniformity checks below 7.…
Browse files Browse the repository at this point in the history
…5 degrees (#428)

* Add some leniency to uniformity checks below 7.5 degrees C
  • Loading branch information
fsinapi authored Nov 17, 2022
1 parent 5f63649 commit 043804b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ class PlateControl {
static constexpr double TARGET_ADJUST_FOR_COLD_TARGET = -5.0F;
/** Extra factor to multiply the proportioal band by */
static constexpr double PROPORTIONAL_BAND_EXTRA_FACTOR = 2.0F;
/**
* When performing the thermistor drift check, this is the max point
* below which errors are ignored. This is added to prevent unnecesary
* error messages during long periods below 8º where temperature may
* drift more than our normal spec BUT will not affect the samples.
*/
static constexpr double DRIFT_CHECK_IGNORE_MAX_TEMP = 7.5;

PlateControl() = delete;
/**
Expand Down
3 changes: 2 additions & 1 deletion stm32-modules/thermocycler-gen2/src/plate_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ auto PlateControl::reset_control(thermal_general::HeatsinkFan &fan) -> void {
min = std::min(temperature, min);
max = std::max(temperature, max);
}
return std::abs(max - min) <= THERMISTOR_DRIFT_MAX_C;
return (std::abs(max - min) <= THERMISTOR_DRIFT_MAX_C) ||
(max <= DRIFT_CHECK_IGNORE_MAX_TEMP);
}

[[nodiscard]] auto PlateControl::get_peltier_temps() const
Expand Down
22 changes: 22 additions & 0 deletions stm32-modules/thermocycler-gen2/tests/test_plate_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,28 @@ TEST_CASE("PlateControl drift error check") {
THEN("the result is false") { REQUIRE(result == false); }
}
}
GIVEN("uniform cold temperature across thermistors") {
constexpr double target = 4;
set_temp(thermistors, target);
WHEN("checking for thermistor drift") {
auto result = plateControl.thermistor_drift_check();
THEN("the result is true") { REQUIRE(result == true); }
}
AND_GIVEN("thermistors out of spec BUT under 7.5") {
thermistors.at(THERM_BACK_LEFT).temp_c = 0.5;
thermistors.at(THERM_BACK_RIGHT).temp_c = 7;
THEN("thermistor drift error does not occur") {
REQUIRE(plateControl.thermistor_drift_check());
}
}
AND_GIVEN("thermistors out of spec and a resistor exceeds 7.5") {
thermistors.at(THERM_BACK_LEFT).temp_c = 0.5;
thermistors.at(THERM_BACK_RIGHT).temp_c = 8;
THEN("thermistor drift error occurs") {
REQUIRE(!plateControl.thermistor_drift_check());
}
}
}
}
}

Expand Down

0 comments on commit 043804b

Please sign in to comment.