You cannot prevent 100% of hotend runaway scenarios (scenarios in which the hotend continues to heat far past its setpoint) in firmware, but there are a few things that firmware can watch for:
abrupt thermistor temperature changes or invalid temperature readings ( < absolute 0) - often indicates a loose connection
thermistor not reacting as expected (e.g. feeding full power to hotend, but thermistor says temperature is falling) - can indicate that the thermistor fell out of its socket (unlikely) or was electrically disconnected.
There are some other things too, such as using algorithms based upon power delivered to the hotend, rather than simple PID controls.
According to this thread, Marlin has a "Thermal Runaway Protection" feature to reference.
So these thermal runaway protection features need to be researched and then implemented in some form.
You cannot prevent 100% of hotend runaway scenarios (scenarios in which the hotend continues to heat far past its setpoint) in firmware, but there are a few things that firmware can watch for:
There are some other things too, such as using algorithms based upon power delivered to the hotend, rather than simple PID controls.
According to this thread, Marlin has a "Thermal Runaway Protection" feature to reference.
So these thermal runaway protection features need to be researched and then implemented in some form.