hx71x: Avoid base classes to improve python2 compatibility
Also, add a load_cell regression test case. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -14,7 +14,7 @@ SAMPLE_ERROR_DESYNC = -0x80000000
|
||||
SAMPLE_ERROR_LONG_READ = 0x40000000
|
||||
|
||||
# Implementation of HX711 and HX717
|
||||
class HX71xBase():
|
||||
class HX71xBase:
|
||||
def __init__(self, config, sensor_type,
|
||||
sample_rate_options, default_sample_rate,
|
||||
gain_options, default_gain):
|
||||
@@ -145,23 +145,21 @@ class HX71xBase():
|
||||
'overflows': self.ffreader.get_last_overflows()}
|
||||
|
||||
|
||||
class HX711(HX71xBase):
|
||||
def __init__(self, config):
|
||||
super(HX711, self).__init__(config, "hx711",
|
||||
# HX711 sps options
|
||||
{80: 80, 10: 10}, 80,
|
||||
# HX711 gain/channel options
|
||||
{'A-128': 1, 'B-32': 2, 'A-64': 3}, 'A-128')
|
||||
def HX711(config):
|
||||
return HX71xBase(config, "hx711",
|
||||
# HX711 sps options
|
||||
{80: 80, 10: 10}, 80,
|
||||
# HX711 gain/channel options
|
||||
{'A-128': 1, 'B-32': 2, 'A-64': 3}, 'A-128')
|
||||
|
||||
|
||||
class HX717(HX71xBase):
|
||||
def __init__(self, config):
|
||||
super(HX717, self).__init__(config, "hx717",
|
||||
# HX717 sps options
|
||||
{320: 320, 80: 80, 20: 20, 10: 10}, 320,
|
||||
# HX717 gain/channel options
|
||||
{'A-128': 1, 'B-64': 2, 'A-64': 3,
|
||||
'B-8': 4}, 'A-128')
|
||||
def HX717(config):
|
||||
return HX71xBase(config, "hx717",
|
||||
# HX717 sps options
|
||||
{320: 320, 80: 80, 20: 20, 10: 10}, 320,
|
||||
# HX717 gain/channel options
|
||||
{'A-128': 1, 'B-64': 2, 'A-64': 3,
|
||||
'B-8': 4}, 'A-128')
|
||||
|
||||
|
||||
HX71X_SENSOR_TYPES = {
|
||||
|
||||
Reference in New Issue
Block a user