1
0
forked from me/IronOS

Merge pull request #1729 from alextrical/Short-Detection

Pinecil v2 short detection at boot
This commit is contained in:
discip
2023-08-04 13:31:07 +02:00
committed by GitHub
45 changed files with 266 additions and 68 deletions

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Некантралюемае\nразаграванне"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Пераканайцеся, што пры наступнай загрузцы наканечнік і ручка маюць пакаёвую тэмпературу!"
},
@@ -313,4 +316,4 @@
"description": ""
}
}
}
}

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},
@@ -313,4 +316,4 @@
"description": ""
}
}
}
}

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Teplotní\nOchrana"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Před restartem se ujistěte, že hrot a držák mají pokojovou teplotu!"
},
@@ -313,4 +316,4 @@
"description": ""
}
}
}
}

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Vor dem Neustart bitte sicherstellen, dass Lötspitze & Gerät Raumtemperatur haben!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Θερμική\nΦυγή"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Πριν την επανεκκίνηση, βεβαιωθείτε ότι η μύτη και η συσκ. είναι σε θερμ. δωματίου!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Térmico\nFuera de control"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "¡Antes de reiniciar, asegúrese de que la punta y el mango estén a temperatura ambiente!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Emballement\nthermique"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Avant de redémarrer, assurez-vous que la panne et la poignée sont à température ambiante !"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Neispravan\ngrijač"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Prije restarta provjerite da su vrh i ručka na sobnoj temperaturi!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Kontrollálatlan\nhőmérséklet!"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Újraindítás előtt a hegy és az eszköz legyen szobahőmérsékletű!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Temperatura\nfuori controllo"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Prima di riavviare assicurati che la punta e l'impugnatura siano a temperatura ambiente!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "過熱"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Perkaitimo\npavojus"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Termisk\nrømling"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Verwarming\nOncontroleerbaar"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Ucieczka\ntermiczna"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Upewnij się, że końcówka i uchwyt mają temperaturę pokojową podczas następnego rozruchu!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Antes de reiniciar certifique-se que o ferro está à temperatura ambiente!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Încălzire\nEşuată"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Înainte de repornire, asiguraţi-vă că vârful şi mânerul sunt la temperatura camerei!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Неуправляемый\nРазогрев"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Пожалуйста, убедитесь, что жало и корпус имеют комнатную температуру при следующей загрузке!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Únik\nTepla"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Thermal\nRunaway"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Некерований\nрозігрів"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Під час наступного завантаження переконайтеся, що жало і ручка мають кімнатну температуру!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "Nhiet\nTat gia nhiet"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "加熱失控"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "加热失控"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},
@@ -313,4 +316,4 @@
"description": ""
}
}
}
}

View File

@@ -30,6 +30,9 @@
"WarningThermalRunaway": {
"message": "加熱失控"
},
"WarningTipShorted": {
"message": "!Tip Shorted!"
},
"SettingsCalibrationWarning": {
"message": "Before rebooting, make sure tip & handle are at room temperature!"
},
@@ -313,4 +316,4 @@
"description": ""
}
}
}
}

View File

@@ -17,7 +17,9 @@
},
{
"id": "NoPowerDeliveryMessage",
"include": ["POW_PD"],
"include": [
"POW_PD"
],
"description": "The IC required for USB-PD could not be communicated with. This is an error warning that USB-PD WILL NOT FUNCTION. Generally indicative of either a hardware or software issues."
},
{
@@ -35,7 +37,12 @@
{
"id": "WarningThermalRunaway",
"description": "Warning text shown when the software has disabled the heater as a safety precaution as the temperature reading didn't react as expected."
}, {
},
{
"id": "WarningTipShorted",
"description": "Warning text shown when the software has detected that the users tip is likely shorted."
},
{
"id": "SettingsCalibrationWarning",
"description": "Confirmation message shown before performing an offset calibration. Should warn the user to make sure tip and handle are at the same temperature."
},
@@ -50,50 +57,66 @@
{
"id": "UVLOWarningString",
"maxLen": 8,
"include": ["POW_DC"],
"include": [
"POW_DC"
],
"description": "Warning text shown when the unit turns off due to undervoltage in simple mode."
},
{
"id": "UndervoltageString",
"maxLen": 15,
"include": ["POW_DC"],
"include": [
"POW_DC"
],
"description": "Warning text shown when the unit turns off due to undervoltage in advanced mode."
},
{
"id": "InputVoltageString",
"maxLen": 11,
"note": "Preferably end with a space",
"include": ["POW_DC"],
"include": [
"POW_DC"
],
"description": "Prefix text for 'Input Voltage' shown before showing the input voltage reading."
},
{
"id": "ProfilePreheatString",
"maxLen": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Shown in profile mode while preheating"
},
{
"id": "ProfileCooldownString",
"maxLen": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Shown in profile mode while cooling down"
},
{
"id": "SleepingSimpleString",
"maxLen": 4,
"exclude": ["NO_SLEEP_MODE"],
"exclude": [
"NO_SLEEP_MODE"
],
"description": "The text shown to indicate the unit is in sleep mode when the advanced view is NOT on."
},
{
"id": "SleepingAdvancedString",
"maxLen": 15,
"exclude": ["NO_SLEEP_MODE"],
"exclude": [
"NO_SLEEP_MODE"
],
"description": "The text shown to indicate the unit is in sleep mode when the advanced view is turned on."
},
{
"id": "SleepingTipAdvancedString",
"maxLen": 6,
"exclude": ["NO_SLEEP_MODE"],
"exclude": [
"NO_SLEEP_MODE"
],
"description": "The prefix text shown before tip temperature when the unit is sleeping with advanced view on."
},
{
@@ -109,11 +132,14 @@
{
"id": "TooHotToStartProfileWarning",
"default": "Too hot to\nstart profile",
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Shown when profile mode is started while the device is too hot."
}
],
"characters": [{
"characters": [
{
"id": "SettingRightChar",
"len": 1,
"description": "Shown for fixed Right-handed display rotation."
@@ -187,11 +213,15 @@
"description": "Shown when the locking mode is set to lock all buttons."
}
],
"menuGroups": [{
"menuGroups": [
{
"id": "PowerMenu",
"maxLen": 5,
"maxLen2": 11,
"include": ["POW_DC", "POW_QC"],
"include": [
"POW_DC",
"POW_QC"
],
"description": "Menu for settings related to power. Main settings to do with the input voltage."
},
{
@@ -219,39 +249,50 @@
"description": "Advanced settings. Misc catchall for settings that don't fit anywhere else or settings that require some thought before use."
}
],
"menuOptions": [{
"menuOptions": [
{
"id": "DCInCutoff",
"maxLen": 5,
"maxLen2": 11,
"include": ["POW_DC"],
"include": [
"POW_DC"
],
"description": "When the device is powered by a battery, this adjusts the low voltage threshold for when the unit should turn off the heater to protect the battery."
},
{
"id": "MinVolCell",
"maxLen": 4,
"maxLen2": 9,
"include": ["POW_DC"],
"include": [
"POW_DC"
],
"description": "When powered by a battery, this adjusts the minimum voltage per cell before shutdown. (This is multiplied by the cell count.)"
},
{
"id": "QCMaxVoltage",
"maxLen": 8,
"maxLen2": 15,
"include": ["POW_QC"],
"include": [
"POW_QC"
],
"description": "This adjusts the maximum voltage the QC negotiation will adjust to. Does NOT affect USB-PD. Should be set safely based on the current rating of your power supply."
},
{
"id": "PDNegTimeout",
"maxLen": 8,
"maxLen2": 15,
"include": ["POW_PD"],
"include": [
"POW_PD"
],
"description": "How long until firmware stops trying to negotiate for USB-PD and tries QC instead. Longer times may help dodgy / old PD adapters, faster times move onto PD quickly. Units of 100ms. Recommended to keep small values."
},
{
"id": "PDVpdo",
"maxLen": 7,
"maxLen2": 15,
"include": ["POW_PD"],
"include": [
"POW_PD"
],
"description": "Enabled PPS & EPR modes."
},
{
@@ -288,98 +329,126 @@
"id": "ProfilePhases",
"maxLen": 6,
"maxLen2": 13,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "set the number of phases for profile mode."
},
{
"id": "ProfilePreheatTemp",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Preheat to this temperature at the start of profile mode."
},
{
"id": "ProfilePreheatSpeed",
"maxLen": 5,
"maxLen2": 11,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "How fast the temperature is allowed to rise during the preheat phase at the start of profile mode."
},
{
"id": "ProfilePhase1Temp",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Target temperature for the end of phase 1 of profile mode."
},
{
"id": "ProfilePhase1Duration",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Duration of phase 1 of profile mode. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfilePhase2Temp",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Target temperature for the end of phase 2 of profile mode."
},
{
"id": "ProfilePhase2Duration",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Duration of phase 2 of profile mode. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfilePhase3Temp",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Target temperature for the end of phase 3 of profile mode."
},
{
"id": "ProfilePhase3Duration",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Duration of phase 3 of profile mode. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfilePhase4Temp",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Target temperature for the end of phase 5 of profile mode."
},
{
"id": "ProfilePhase4Duration",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Duration of phase 5 of profile mode. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfilePhase5Temp",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Target temperature for the end of phase 5 of profile mode."
},
{
"id": "ProfilePhase5Duration",
"maxLen": 4,
"maxLen2": 9,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "Duration of phase 5 of profile mode. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfileCooldownSpeed",
"maxLen": 5,
"maxLen2": 11,
"include": ["PROFILE_SUPPORT"],
"include": [
"PROFILE_SUPPORT"
],
"description": "How fast the temperature is allowed to drop during the cooldown phase at the end of profile mode."
},
{
@@ -392,14 +461,18 @@
"id": "SleepTemperature",
"maxLen": 4,
"maxLen2": 9,
"exclude": ["NO_SLEEP_MODE"],
"exclude": [
"NO_SLEEP_MODE"
],
"description": "Temperature the device will drop down to while asleep. Typically around halfway between off and soldering temperature."
},
{
"id": "SleepTimeout",
"maxLen": 4,
"maxLen2": 9,
"exclude": ["NO_SLEEP_MODE"],
"exclude": [
"NO_SLEEP_MODE"
],
"description": "How long of a period without movement / button-pressing is required before the device drops down to the sleep temperature."
},
{
@@ -412,7 +485,9 @@
"id": "HallEffSensitivity",
"maxLen": 6,
"maxLen2": 13,
"include": ["HALL_SENSOR"],
"include": [
"HALL_SENSOR"
],
"description": "If the unit has a hall effect sensor (Pinecil), this adjusts how sensitive it is at detecting a magnet to put the device into sleep mode."
},
{
@@ -425,7 +500,9 @@
"id": "DisplayRotation",
"maxLen": 6,
"maxLen2": 13,
"exclude": ["NO_DISPLAY_ROTATE"],
"exclude": [
"NO_DISPLAY_ROTATE"
],
"description": "If the display should rotate automatically or if it should be fixed for left- or right-handed mode."
},
{
@@ -492,7 +569,9 @@
"id": "BluetoothLE",
"maxLen": 7,
"maxLen2": 15,
"include": ["BLE_ENABLED"],
"include": [
"BLE_ENABLED"
],
"description": "Should BLE be enabled at boot time."
},
{
@@ -544,4 +623,4 @@
"description": "Changes the device language on multi-lingual builds."
}
]
}
}

View File

@@ -102,6 +102,8 @@ void setBuzzer(bool on);
uint8_t preStartChecks();
uint8_t preStartChecksDone();
// Check if the tip or output mosfet is shorted (if possible)
bool isTipShorted();
// Show the boot logo
void showBootLogo(void);
#ifdef __cplusplus

View File

@@ -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; }

View File

@@ -285,6 +285,7 @@ void performTipResistanceSampleReading() {
tipResistanceReadingSlot++;
}
bool tipShorted = false;
void FinishMeasureTipResistance() {
// Otherwise we now have the 4 samples;
@@ -304,6 +305,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 {
@@ -373,7 +376,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
@@ -388,7 +391,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) {

View File

@@ -94,7 +94,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; }

View File

@@ -189,7 +189,7 @@ void performTipResistanceSampleReading() {
gpio_write(TIP_RESISTANCE_SENSE, tipResistanceReadingSlot == 0);
tipResistanceReadingSlot++;
}
bool tipShorted = false;
void FinishMeasureTipResistance() {
// Otherwise we now have the 4 samples;
@@ -208,6 +208,8 @@ void FinishMeasureTipResistance() {
uint8_t newRes = 0;
if (reading > 8000) {
// return; // Change nothing as probably disconnected tip
} else if (reading < 500) {
tipShorted = true;
} else if (reading < 4000) {
newRes = 62;
} else {
@@ -217,8 +219,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)) {
@@ -240,7 +242,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() {

View File

@@ -231,7 +231,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; }

View File

@@ -116,6 +116,7 @@ struct TranslationIndexTable {
uint16_t UnlockingKeysString;
uint16_t WarningKeysLockedString;
uint16_t WarningThermalRunaway;
uint16_t WarningTipShorted;
uint16_t SettingsCalibrationWarning;
uint16_t CJCCalibrating;

View File

@@ -8,9 +8,11 @@
#ifndef GUI_HPP_
#define GUI_HPP_
#include "BSP.h"
#include "FreeRTOS.h"
#include "Settings.h"
#include "Translation.h"
#define PRESS_ACCEL_STEP (TICKS_100MS / 3)
#define PRESS_ACCEL_INTERVAL_MIN TICKS_100MS
#define PRESS_ACCEL_INTERVAL_MAX (TICKS_100MS * 3)
@@ -35,7 +37,7 @@ typedef struct {
} menuitem;
void enterSettingsMenu();
void warnUser(const char *warning, const int timeout);
void warnUser(const char *warning, const TickType_t timeout);
extern const menuitem rootSettingsMenu[];
#endif /* GUI_HPP_ */

View File

@@ -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*/
}

View File

@@ -3,16 +3,16 @@
#include "OLED.hpp"
#include <stdbool.h>
void GUIDelay(); //
bool checkForUnderVoltage(void); //
uint32_t getSleepTimeout(void); //
bool shouldBeSleeping(bool inAutoStart); //
bool shouldShutdown(void); //
void gui_drawTipTemp(bool symbol, const FontStyle font); //
void printVoltage(void); //
void warnUser(const char *warning, const int timeout); //
void gui_drawBatteryIcon(void); //
bool checkForUnderVoltage(void); //
uint16_t min(uint16_t a, uint16_t b); //
void printCountdownUntilSleep(int sleepThres); //
void GUIDelay(); //
bool checkForUnderVoltage(void); //
uint32_t getSleepTimeout(void); //
bool shouldBeSleeping(bool inAutoStart); //
bool shouldShutdown(void); //
void gui_drawTipTemp(bool symbol, const FontStyle font); //
void printVoltage(void); //
void warnUser(const char *warning, const TickType_t timeout); //
void gui_drawBatteryIcon(void); //
bool checkForUnderVoltage(void); //
uint16_t min(uint16_t a, uint16_t b); //
void printCountdownUntilSleep(int sleepThres); //
#endif

View File

@@ -1,6 +1,6 @@
#include "Buttons.hpp"
#include "OperatingModeUtilities.h"
void warnUser(const char *warning, const int timeout) {
void warnUser(const char *warning, const TickType_t timeout) {
OLED::clearScreen();
OLED::printWholeScreen(warning);
OLED::refresh();