Skip to content

Commit a1562c7

Browse files
committed
Correcting merge
1 parent 574fb58 commit a1562c7

2 files changed

Lines changed: 41 additions & 16 deletions

File tree

src/devices/eeprom.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def __init__(self):
1313
The constructor function for the EEPROM class
1414
"""
1515
self._google_sheet_interval = 20
16+
self._ignore_bad_ph_slope = False
1617
self._kd_value = 36.0
1718
self._ki_value = 28.0
1819
self._kp_value = 20.0
@@ -26,6 +27,14 @@ def get_google_sheet_interval(self, default):
2627
return default
2728
return self._google_sheet_interval
2829

30+
def get_ignore_bad_ph_slope(self, default):
31+
"""
32+
Get the ignore bad pH slope setting from EEPROM
33+
"""
34+
if self._ignore_bad_ph_slope is None:
35+
return default
36+
return self._ignore_bad_ph_slope
37+
2938
def get_kd(self, default):
3039
"""
3140
Get the Kd value from EEPROM
@@ -64,6 +73,12 @@ def set_google_sheet_interval(self, value):
6473
"""
6574
self._google_sheet_interval = value
6675

76+
def set_ignore_bad_ph_slope(self, value):
77+
"""
78+
Set the ignore bad pH slope setting in EEPROM
79+
"""
80+
self._ignore_bad_ph_slope = value
81+
6782
def set_kd(self, value):
6883
"""
6984
Set the Kd value in EEPROM

tests/devices/eeprom_test.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,32 @@ def test_set_google_sheet_interval():
3131
assert eeprom.get_google_sheet_interval(65535) == 60
3232

3333

34+
def test_default_ignore_bad_ph_slope_value():
35+
"""
36+
The function to test the default ignore_bad_ph_slope value
37+
"""
38+
eeprom = EEPROM()
39+
assert eeprom.get_ignore_bad_ph_slope(True) is False
40+
41+
42+
def test_save_ignore_bad_ph_slope_value():
43+
"""
44+
The function to test setting the ignore_bad_ph_slope value
45+
"""
46+
eeprom = EEPROM()
47+
eeprom._ignore_bad_ph_slope = True
48+
assert eeprom.get_ignore_bad_ph_slope(False) is True
49+
50+
51+
def test_set_ignore_bad_ph_slope():
52+
"""
53+
The function to test setting the ignore_bad_ph_slope via setter
54+
"""
55+
eeprom = EEPROM()
56+
eeprom.set_ignore_bad_ph_slope(True)
57+
assert eeprom.get_ignore_bad_ph_slope(False) is True
58+
59+
3460
def test_pid_values():
3561
"""
3662
The function to test the PID values
@@ -92,19 +118,3 @@ def test_set_tank_id():
92118
eeprom.set_tank_id(10)
93119
assert eeprom.get_tank_id(0) == 10
94120

95-
96-
def test_thermal_correction_value():
97-
"""
98-
The function to test the default thermal_correction_address value
99-
"""
100-
eeprom = EEPROM()
101-
assert eeprom.get_thermal_correction(0.0) == 12
102-
103-
104-
def test_save_thermal_correction_value():
105-
"""
106-
The function to test setting the thermal_correction_address value
107-
"""
108-
eeprom = EEPROM()
109-
eeprom._thermal_correction = 2.5
110-
assert eeprom.get_thermal_correction(0.0) == 2.5

0 commit comments

Comments
 (0)