Yeah I also added these checks everywhere, and as I said, the breakpoint never stops there.
It's in ready state before calling spi transmit.
It's in ready state when the spi transmit checks it.
And it's ready when it returns.
But then, at some point the return value randomly changes, by magic.
I will compare the oled routines against the older code, there's something weird going on.
The strange is that it fails very randomly.
Sometimes it works 20min, others just a few.
Or there's memory corruption by some wrong pointer or whatever, or I don't understand why.
It also happens with the graphics disabled, only updating the screen.
Edit:
I updated all the other boards. Ksger with software i2c should be ok, as they don't use the spi dma.
I don't know if the bug happens with the hardware i2c too.
I also added active power limitation. Before, it was a fixed value (0-100%) applied to the PWM duty.
Now it's limited in watts.
The iron routine takes the last power supply reading, the heater impedance (new option added in the menu) and the power limit setting, and adjust the max pwm duty.
This value is then applied to the PID calculation.
So, if you set 30W, the power will be always 30W, independently of the power supply voltage, as long as it's enough to apply that power into the load.
This wil be very useful, specially for low power tips. Each profile has its own power limit. By default: C245=150W, C210 and T12=80W
Edit 2:
Also made some changes in the graph so it will display temperatures between 200 and 500°C for better accuracy.
Showing lower temps is pretty useless. Also some other changes for increased stability/smoothness while not making it too laggy.
Now it's 7°C/pixel which should give enough precision to see oscillations.
About the iron detection: It's a shame, but hardware modding will be necessary in most cases.
The wake pin is usually not connected to an ADC pin
Edit 3:
Also, I don't know if it was a lucky shot or what, it's been running well for the whole night without crashing.
Latest build video: