I would have a separate safety task that just looks if things makes sense or not. It can catch malfunctions. The PID algo seems to not be working.
That is easy to say.. Add more functions, more checks ... but it's not that easy.
Maybe the internal PID is getting a wrong temp, or the PWM value is getting corrupted, or I wrong typed a variable name.
This is developing. Everything is often being modified and you can't check absolutely everything.
Specially now adding support for new boards, there were some big changes.
Yes, there are safety checks, but assuming the programs works.
If you copy a random value somewhere, that is a bug, and totally unpredictable.
For protection there's already the no iron detection and it works very well. Lower the limit to something you would consider a limit.
Set you iron to the max temp you wil use it, go to debug screen and take note of the ADC value. If it's ex. 3800, set the ADC limit a little higher, ex. 3900 o 4000.
So if the temp rises too much it will trigger the detection and force PWM to 0.1%. There's no way the PID works if the detectign is triggered, the PWM is always 0.1%.
What I don't understand is why it doesn't trigger the no iron detection.
Have you disabled it by setting it to 4100? That is ouside the ADC range and will never be detected. Max is 4095.
At first I deleted the problematic DFLT profile, but then I decided to reset everything to approximate values, with the idea in mind to calibrate your own.
All the calibration were wrong, some people even reported -100ºC. So there's no sense of storing these calibrated values.
This were the default profiles:
All by default (including DFLT):
calADC_At_200 = 1300;
calADC_At_300 = 2000;
calADC_At_400 = 3000;
"B "
calADC_At_200 = 1221;
calADC_At_300 = 1904;
calADC_At_400 = 2586;
"BC2"
calADC_At_200 = 1463;
calADC_At_300 = 2313;
calADC_At_400 = 3162;
"D24"
calADC_At_200 = 900;
calADC_At_300 = 1932;
calADC_At_400 = 3598;
Now all by default:
calADC_At_200 = 1300;
calADC_At_300 = 2200;
calADC_At_400 = 3000;
Maybe I set some value wrong.
After successful calibration, let me know the cal values to note as reference!
My tip does:
CAL200:1468
CAL300:2373
CAL400:3379
Setpoint to 480:4000
So the detection is really close to limit on mine, but setting it to 4080 works.
Below that it triggers due the slight overshoot (reaches 4050 during 1/2 second when heating from cold).
As I say, I don't have T12 anymore, so I can't test it myself.
Also I won't spend money on something I don't need!
Maybe I should lower it even more, ex. 2500 at 400ºC