psyfood / pyqmix

Qmix pump and valve interface
GNU General Public License v3.0
2 stars 1 forks source link

is_calibrating incoherent behaviour #4

Open lorrandal opened 7 years ago

lorrandal commented 7 years ago

is_calibrating property exhibits an incoherent behaviour: it gives different results if it is called before or after the first calibration. eg:

In [3]: b.is_calibrating
Out[3]: True

In [4]: b.calibrate()

In [5]: b.is_calibrating
Out[5]: False

Function:

    @property #TODO: after the first calibration, different resultss
    def is_calibrating(self):
#        r = self._dll.LCP_IsCalibrationFinished(self._handle[0])
#        return bool(r)
        r = self._call('LCP_IsCalibrationFinished', self._handle[0])
        if r == 0:
            return True
        else:
            return False
hoechenberger commented 7 years ago

In fact, QmixPump.is_calibrating is always Trueafter powering on the system, as reported by LCP_IsCalibrationFinished(); we should ask Cetoni about this, it appears to be a bug in their code.

hoechenberger commented 7 years ago

I assume it's a documentation problem on Cetoni's side: LCP_IsCalibrationFinished() would naturally produce a negative response right after powering up the system, because no calibration has been carried out at this point. After a successful calibration, the response would be positive.

So while Cetoni's docs say,

0 - Device is calibrating
1 - Device calibration has finished
<0 - Error code

I believe the first line should rather read 0 | - Device has not yet been calibrated or is currently calibrating.