1
0
forked from me/IronOS

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

@@ -187,7 +187,7 @@ void performTipResistanceSampleReading() {
gpio_write(TIP_RESISTANCE_SENSE, tipResistanceReadingSlot == 0);
tipResistanceReadingSlot++;
}
bool tipShorted = false;
void FinishMeasureTipResistance() {
// Otherwise we now have the 4 samples;
@@ -207,10 +207,7 @@ void FinishMeasureTipResistance() {
if (reading > 8000) {
// return; // Change nothing as probably disconnected tip
} else if (reading < 500) {
for (;;) /* Tip shorted, wait until reset */
{
__NOP();
}
tipShorted = true;
} else if (reading < 4000) {
newRes = 62;
} else {
@@ -220,8 +217,8 @@ void FinishMeasureTipResistance() {
}
volatile bool tipMeasurementOccuring = true;
volatile TickType_t nextTipMeasurement = 100;
void performTipMeasurementStep() {
bool isTipShorted() { return tipShorted; }
void performTipMeasurementStep() {
// Wait 100ms for settle time
if (xTaskGetTickCount() < (nextTipMeasurement)) {
@@ -243,7 +240,8 @@ uint8_t preStartChecks() {
performTipMeasurementStep();
return preStartChecksDone();
}
uint8_t preStartChecksDone() { return (lastTipResistance == 0 || tipResistanceReadingSlot < numTipResistanceReadings || tipMeasurementOccuring) ? 0 : 1; }
// If we are still measuring the tip; or tip is shorted; prevent heating
uint8_t preStartChecksDone() { return (lastTipResistance == 0 || tipResistanceReadingSlot < numTipResistanceReadings || tipMeasurementOccuring || tipShorted) ? 0 : 1; }
// Return hardware unique ID if possible
uint64_t getDeviceID() {