Add isTipShorted() to warnings

This commit is contained in:
Ben V. Brown
2023-07-28 19:59:54 +10:00
parent 13e1c24152
commit 344068d480
7 changed files with 25 additions and 13 deletions

View File

@@ -284,6 +284,7 @@ void performTipResistanceSampleReading() {
tipResistanceReadingSlot++;
}
bool tipShorted = false;
void FinishMeasureTipResistance() {
// Otherwise we now have the 4 samples;
@@ -303,6 +304,8 @@ void FinishMeasureTipResistance() {
// return; // Change nothing as probably disconnected tip
tipResistanceReadingSlot = lastTipResistance = 0;
return;
} else if (reading < 200) {
tipShorted = true;
} else if (reading < 800) {
newRes = 62;
} else {
@@ -372,7 +375,7 @@ uint64_t getDeviceID() {
uint8_t preStartChecksDone() {
#ifdef TIP_RESISTANCE_SENSE_Pin
return (lastTipResistance == 0 || tipResistanceReadingSlot < numTipResistanceReadings || tipMeasurementOccuring) ? 0 : 1;
return (lastTipResistance == 0 || tipResistanceReadingSlot < numTipResistanceReadings || tipMeasurementOccuring || tipShorted) ? 0 : 1;
#else
return 1;
#endif
@@ -387,7 +390,11 @@ uint8_t getTipResistanceX10() {
return TIP_RESISTANCE;
#endif
}
#ifdef TIP_RESISTANCE_SENSE_Pin
bool isTipShorted() { return tipShorted; }
#else
bool isTipShorted() { return false; }
#endif
uint8_t getTipThermalMass() {
#ifdef TIP_RESISTANCE_SENSE_Pin
if (lastTipResistance >= 80) {