/* compute nearest (signed) distance to calibrated value in 1024 circle  */
int to_calibrated(const int calibrated, const int value)
/* compute nearest (signed) distance to calibrated value in 1024 circle  */
int to_calibrated(const int calibrated, const int value)
{
        return diff;
    }
    if (diff < 0) {
        return 1024 + diff;
    }
    return diff - 1024;
}