Read FPGA D6 status once at top of D6 if statement into a local var and use that in these if conditions so you don't have to keep calling the fpga function.
I prefer boolean conditions be explicit (e.g. TRUE == isThisLastDrain). This way, if value gets corrupted to a garbage value (like 5) it will be same as FALSE.
Function name is confusing. Change to something like failHeatDisinfection(). Also, this state handler will return DG_HEAT_DISINFECT_STATE_DRAIN_R1 - overriding the complete state being set in your function.