I think I understand Lars' PI loop now. It's not weird, it's actually a quite clever optimization, though I'm not sure if he didn't make a mistake somewhere with scaling.
This is a standard PI computation in pseudo-C (loop time 1 second):
error = target - measurement;
Integrator += error;
P = error;
I = Integrator / TimeConstant;
dac_out = bias + ( P + I ) * gain;
The multiplication with gain is what scales the PI result to DAC units, bias is in DAC units by definition.
Now, Integrator and bias are the same thing and bias can be in fact become the integrator, by adding the following code after each loop:
bias += Integrator * gain / TimeConstant;
Integrator = 0;
So, after each loop you move the content of the integrator into bias and reset it to 0. Now, of course Integrator now doesn't sum anything any more, so, logically, this becomes:
error = target - measurement;
P = error;
I = error / TimeConstant;
dac_out = bias + ( P + I ) * gain;
bias += I * gain;
Now, dac_out is of course:
dac_out = bias + P * gain + I * gain;
That means you can rewrite the loop as follows:
error = target - measurement;
P = error * gain;
I = P / TimeConstant;
dac_out = bias + P + I;
bias += I;
And a final, clever optimization brings us to Lars' PI loop:
error = target - measurement;
P = error * gain;
I = P / TimeConstant;
bias += I;
dac_out = bias + P;
Really, Lars' was quite a smart guy.
PS: no, there's no scaling error in Lars' code.
PS2: edited for clarity