Sent my fix back to the original author, he suggested some further constant tweaks. I haven't checked with a live batch yet, but I can hold a sheet of paper in front of the camera to confirm that the signal no longer drops out when the coffee gets too bright, so I'll see how that goes. I still haven't done any proper calibration on the receiving end.