Add isTipShorted() to warnings
This commit is contained in:
@@ -101,6 +101,8 @@ void setBuzzer(bool on);
|
||||
// For example, on the MHP30 this is used to figure out the resistance of the hotplate
|
||||
uint8_t preStartChecks();
|
||||
uint8_t preStartChecksDone();
|
||||
|
||||
bool isTipShorted();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -18,4 +18,5 @@ void power_check() {
|
||||
|
||||
bool getIsPoweredByDCIN() { return false; }
|
||||
|
||||
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
|
||||
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
|
||||
bool isTipShorted() { return false; }
|
||||
@@ -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) {
|
||||
|
||||
@@ -93,7 +93,7 @@ uint8_t preStartChecks() { return 1; }
|
||||
uint64_t getDeviceID() { return dbg_id_get(); }
|
||||
|
||||
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
|
||||
|
||||
bool isTipShorted() { return false; }
|
||||
uint8_t preStartChecksDone() { return 1; }
|
||||
|
||||
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -230,7 +230,7 @@ uint64_t getDeviceID() {
|
||||
}
|
||||
|
||||
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
|
||||
|
||||
bool isTipShorted() { return false; }
|
||||
uint8_t preStartChecksDone() { return 1; }
|
||||
|
||||
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
|
||||
|
||||
@@ -48,5 +48,9 @@ void showWarnings(void) {
|
||||
}
|
||||
}
|
||||
#endif /*POW_PD_EXT==1*/
|
||||
// If tip looks to be shorted, yell at user and dont auto dismiss
|
||||
if (isTipShorted()) {
|
||||
warnUser(translatedString(Tr->WarningTipShorted), portMAX_DELAY);
|
||||
}
|
||||
#endif /*NO_WARN_MISSING*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user