special_linconv(precord,after)
This routine is called
whenever any of the fields LINR, EGUF, EGUL or ROFF is
modified. To support linear conversion, EOFF and ESLO must be
set accordingly. The record support sets EOFF to EGUL before
calling this routine, which is the very common case when RAWL
is zero below.
A useful formula for
calculating EOFF and ESLO is this one:
EOFF = (RAWF * EGUL - RAWL * EGUF) / (RAWF - RAWL)
ESLO = (EGUF - EGUL) / (RAWF - RAWL)
Here, RAWL and RAWF are the lowest resp.
highest possible raw value. For instance, a 16 bit bipolar ADC
might have RAWL=-0x7fff, RAWF=0x7fff.