Bed temperature command going to 0 °C with no obvious reason when print is started Configuration


Printrun/Pronterface 
Slic3r 1.3.0
Windows 10
Arduino Mega + RAMPS 1.4 
Marlin 1.1.9
Prusa i3 -- Hephestos BQ with following modifications:


450W PSU (230V to 12V)
heatbed
3D touch
led stripe
ps_on with relay on the PSU



Issue conditions

I was printing fine until something happened, do not know what.
What I can tell is I can reach any bed temperature with Pronterface, and for any duration. (my little 450&nbsp;W PSU provides enough power for my needs, like 60, 70 or 80 °C, a bit hard for 85 °C though)

But as soon as start the print (when the temperature is already ready extruder and bed -- and as I always did), the motors move the extruder in the bed center and then I get the following error :

Error:Heating failed, system stopped! Heater_ID: 0
[ERROR] Error:Heating failed, system stopped! Heater_ID: 0

Error:Printer halted. kill() called!
[ERROR] Error:Printer halted. kill() called!


If I check the temperature with M105 ; temp report, the printer gives me:


before I press the "start print" button >> T:245/245 , B:80/80
after I press the "start print" button >> T:245/245, B:80/0


so bed temp command is fine.....until I start the print

Temp command set to 0

What causes the printer to be halted is a huge temp difference between command and sensor.
In the provided G-code, the bed temp was lowered to 30 °C, which helps :


running the test faster
this shows that the problem is still going on (bed temp command to 0 °C)
I can "print" (move the nozzle without error but the PETG won't stick to the bed) and I don't get temp error.


See the full log here.

So, what does cause the bed temp command to get to 0?

Not from G-CODE

I checked in the G-code, and there is no M140 *0 nor M190 *0 until the end of the G-code, and I'm sure the problem is not comming from the slice/G-code because I ran some previously successfully run G-code/config and they fail the same.

Not COM related

I ran the same gcode on sd card (to see if the USB was involved), but the behavior is the same: as soon as the bed temp is reached and print started, the bed temp command is set to 0 (I can see command on LCD screen).

Hardware related?

I did not change the firmware, and print were going fine, before the printer was doing this, so I guess the root cause is Hardware.

Firmware involved

Because of the "0 °C command", the firmware react to something but I could not understand what is happening here.

when checking the firmware code, the only reasons why bed temp is set to 0 when print is running without asking for it would be 


gcode_M140()/gcode_M190(): it could be bad interpretation of ascii command.
_lcd_preheat() ?
PID_autotune() : PID algo error?
ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED : maybe but it would also put the extruder temp command to 0


nothing that would really explain this...

Any hints?
I tried, by instrumenting code, to know where/when the temp bed is modified.

I found that it is called in the gcode M81 when starting the print.

Wait M81? isn't it M80 to switch on the PSU?

What I did in fact was both wiring this up side down and mixing M80 with M81.

But what I didn't know is that M80 and M81 are not strictly opposite functions.

Indeed, M81 puts the PS_ON signal to PS_ASLEEP != PS_AWAKE but also disable all heaters.
I couldn't see it without serial trace because the extruder temp is set back after the M81, but not the bed temp.

Problem solved.

Hope this can help people in the future to spend less time than me on that simple mistake.

Note: What remains a mystery, though, is: why was it working before on previous prints and then, suddenly, broke?!!