diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-02-15 20:58:18 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-02-15 20:58:18 (GMT) |
commit | 0f3df9c9e4c2adf41071d7e50645758fd0382a4f (patch) | |
tree | efcdeaad9c30b00471fbec801d4f2418986030d3 | |
parent | 726d2ad7558e0dfb141989280b77c770b3104bcb (diff) |
fixed regression in XO1.75 resistance calibration
-rw-r--r-- | plugins/audio_sensors/audio_sensors.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/plugins/audio_sensors/audio_sensors.py b/plugins/audio_sensors/audio_sensors.py index b168e05..1cea2ce 100644 --- a/plugins/audio_sensors/audio_sensors.py +++ b/plugins/audio_sensors/audio_sensors.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -#Copyright (c) 2011 Walter Bender +#Copyright (c) 2011, 2012 Walter Bender # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -342,17 +342,16 @@ class Audio_sensors(Plugin): if len(buf) > 0: # See <http://bugs.sugarlabs.org/ticket/552#comment:7> # TODO: test this calibration on XO 1.5, XO 1.75 + avg_buf = float(_avg(buf)) if self.hw == XO1: - resistance = 2.718 ** ((float(_avg(buf)) * 0.000045788) + \ - 8.0531) + resistance = 2.718 ** ((avg_buf * 0.000045788) + 8.0531) elif self.hw == XO15: - avg_buf = float(_avg(buf)) if avg_buf > 0: resistance = (420000000 / avg_buf) - 13500 else: resistance = 420000000 else: # XO 1.75, 3.0 - return (46000000 / (30514 - avg_buffer)) - 1150 + return (46000000 / (30514 - avg_buf)) - 1150 if channel == 0: self._parent.lc.update_label_value('resistance', resistance) else: |