Skip to content

Commit c54cf0c

Browse files
committed
Changed the meaning and type of led_off_mode. It is now an integer. When
0, it always blinks, larger than 0, blinks only in warn state, larger than 8 (numerical value of the warn state), blinks never. Generally, if the number is higher than the current state's value, don't blink.
1 parent bbedeb1 commit c54cf0c

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

daemon/attiny_daemon.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[attinydaemon]
22
button function = nothing
3-
ups configuration = 3
3+
ups configuration = 0x3
44
primed = 0
55
external voltage constant = 500
66
external voltage coefficient = 1818
@@ -20,5 +20,5 @@ battery voltage coefficient = 1000
2020
force shutdown = 0
2121
switch recovery delay = 1000
2222
loglevel = DEBUG
23-
led off mode = false
23+
led off mode = 0
2424

daemon/attiny_daemon.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
# Version information
1919
major = 2
20-
minor = 11
21-
patch = 11
20+
minor = 12
21+
patch = 0
2222

2323
# config file is in the same directory as the script:
2424
_configfile_default = str(Path(__file__).parent.absolute()) + "/attiny_daemon.cfg"
@@ -213,7 +213,7 @@ class Config(Mapping):
213213
T_COEFFICIENT: str(MAX_INT),
214214
T_CONSTANT: str(MAX_INT),
215215
FORCE_SHUTDOWN: 'True',
216-
LED_OFF_MODE: 'False',
216+
LED_OFF_MODE: '0',
217217
WARN_VOLTAGE: str(MAX_INT),
218218
UPS_SHUTDOWN_VOLTAGE: str(MAX_INT),
219219
RESTART_VOLTAGE: str(MAX_INT),
@@ -273,12 +273,12 @@ def read_config(self):
273273
self._storage[self.T_COEFFICIENT] = self.parser.getint(self.DAEMON_SECTION, self.T_COEFFICIENT)
274274
self._storage[self.T_CONSTANT] = self.parser.getint(self.DAEMON_SECTION, self.T_CONSTANT)
275275
self._storage[self.FORCE_SHUTDOWN] = self.parser.getboolean(self.DAEMON_SECTION, self.FORCE_SHUTDOWN)
276-
self._storage[self.LED_OFF_MODE] = self.parser.getboolean(self.DAEMON_SECTION, self.LED_OFF_MODE)
276+
self._storage[self.LED_OFF_MODE] = self.parser.getint(self.DAEMON_SECTION, self.LED_OFF_MODE)
277277
self._storage[self.WARN_VOLTAGE] = self.parser.getint(self.DAEMON_SECTION, self.WARN_VOLTAGE)
278278
self._storage[self.UPS_SHUTDOWN_VOLTAGE] = self.parser.getint(self.DAEMON_SECTION, self.UPS_SHUTDOWN_VOLTAGE)
279279
self._storage[self.RESTART_VOLTAGE] = self.parser.getint(self.DAEMON_SECTION, self.RESTART_VOLTAGE)
280280
self._storage[self.BUTTON_FUNCTION] = self.parser.get(self.DAEMON_SECTION, self.BUTTON_FUNCTION)
281-
self._storage[self.UPS_CONFIG] = self.parser.getint(self.DAEMON_SECTION, self.UPS_CONFIG)
281+
self._storage[self.UPS_CONFIG] = int(self.parser.get(self.DAEMON_SECTION, self.UPS_CONFIG), 0)
282282
self._storage[self.VEXT_SHUTDOWN] = self.parser.getboolean(self.DAEMON_SECTION, self.VEXT_SHUTDOWN)
283283
self._storage[self.PULSE_LENGTH] = self.parser.getint(self.DAEMON_SECTION, self.PULSE_LENGTH)
284284
self._storage[self.PULSE_LENGTH_ON] = self.parser.getint(self.DAEMON_SECTION, self.PULSE_LENGTH_ON)

daemon/useATTiny.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@
4040
logging.info("Current ups shutdown voltage is " + str(attiny.get_ups_shutdown_voltage() / 1000) + "V.")
4141
logging.info("Current restart voltage is " + str(attiny.get_restart_voltage() / 1000) + "V.")
4242

43-
logging.info("Current ups configuration is " + str(attiny.get_ups_configuration()))
43+
logging.info("Current ups configuration is " + hex(attiny.get_ups_configuration()))
4444
logging.info("Current pulse length is " + str(attiny.get_pulse_length()))
4545
logging.info("Current pulse length on is " + str(attiny.get_pulse_length_on()))
4646
logging.info("Current pulse length off is " + str(attiny.get_pulse_length_off()))
4747
logging.info("Current switch recovery delay is " + str(attiny.get_switch_recovery_delay()))
4848

49+
logging.info("Current led off mode is " + str(attiny.get_led_off_mode()))
4950

5051
logging.info("Low fuse is " + hex(attiny.get_fuse_low()))
5152
logging.info("High fuse is " + hex(attiny.get_fuse_high()))

0 commit comments

Comments
 (0)