Initial draft, mostly-working code for the wrong current sensor.