Skip to content

Commit

Permalink
Changed the meaning and type of led_off_mode. It is now an integer. When
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jbaumann committed Sep 26, 2020
1 parent bbedeb1 commit c54cf0c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions daemon/attiny_daemon.cfg
@@ -1,6 +1,6 @@
[attinydaemon]
button function = nothing
ups configuration = 3
ups configuration = 0x3
primed = 0
external voltage constant = 500
external voltage coefficient = 1818
Expand All @@ -20,5 +20,5 @@ battery voltage coefficient = 1000
force shutdown = 0
switch recovery delay = 1000
loglevel = DEBUG
led off mode = false
led off mode = 0

10 changes: 5 additions & 5 deletions daemon/attiny_daemon.py
Expand Up @@ -17,8 +17,8 @@

# Version information
major = 2
minor = 11
patch = 11
minor = 12
patch = 0

# config file is in the same directory as the script:
_configfile_default = str(Path(__file__).parent.absolute()) + "/attiny_daemon.cfg"
Expand Down Expand Up @@ -213,7 +213,7 @@ class Config(Mapping):
T_COEFFICIENT: str(MAX_INT),
T_CONSTANT: str(MAX_INT),
FORCE_SHUTDOWN: 'True',
LED_OFF_MODE: 'False',
LED_OFF_MODE: '0',
WARN_VOLTAGE: str(MAX_INT),
UPS_SHUTDOWN_VOLTAGE: str(MAX_INT),
RESTART_VOLTAGE: str(MAX_INT),
Expand Down Expand Up @@ -273,12 +273,12 @@ def read_config(self):
self._storage[self.T_COEFFICIENT] = self.parser.getint(self.DAEMON_SECTION, self.T_COEFFICIENT)
self._storage[self.T_CONSTANT] = self.parser.getint(self.DAEMON_SECTION, self.T_CONSTANT)
self._storage[self.FORCE_SHUTDOWN] = self.parser.getboolean(self.DAEMON_SECTION, self.FORCE_SHUTDOWN)
self._storage[self.LED_OFF_MODE] = self.parser.getboolean(self.DAEMON_SECTION, self.LED_OFF_MODE)
self._storage[self.LED_OFF_MODE] = self.parser.getint(self.DAEMON_SECTION, self.LED_OFF_MODE)
self._storage[self.WARN_VOLTAGE] = self.parser.getint(self.DAEMON_SECTION, self.WARN_VOLTAGE)
self._storage[self.UPS_SHUTDOWN_VOLTAGE] = self.parser.getint(self.DAEMON_SECTION, self.UPS_SHUTDOWN_VOLTAGE)
self._storage[self.RESTART_VOLTAGE] = self.parser.getint(self.DAEMON_SECTION, self.RESTART_VOLTAGE)
self._storage[self.BUTTON_FUNCTION] = self.parser.get(self.DAEMON_SECTION, self.BUTTON_FUNCTION)
self._storage[self.UPS_CONFIG] = self.parser.getint(self.DAEMON_SECTION, self.UPS_CONFIG)
self._storage[self.UPS_CONFIG] = int(self.parser.get(self.DAEMON_SECTION, self.UPS_CONFIG), 0)
self._storage[self.VEXT_SHUTDOWN] = self.parser.getboolean(self.DAEMON_SECTION, self.VEXT_SHUTDOWN)
self._storage[self.PULSE_LENGTH] = self.parser.getint(self.DAEMON_SECTION, self.PULSE_LENGTH)
self._storage[self.PULSE_LENGTH_ON] = self.parser.getint(self.DAEMON_SECTION, self.PULSE_LENGTH_ON)
Expand Down
3 changes: 2 additions & 1 deletion daemon/useATTiny.py
Expand Up @@ -40,12 +40,13 @@
logging.info("Current ups shutdown voltage is " + str(attiny.get_ups_shutdown_voltage() / 1000) + "V.")
logging.info("Current restart voltage is " + str(attiny.get_restart_voltage() / 1000) + "V.")

logging.info("Current ups configuration is " + str(attiny.get_ups_configuration()))
logging.info("Current ups configuration is " + hex(attiny.get_ups_configuration()))
logging.info("Current pulse length is " + str(attiny.get_pulse_length()))
logging.info("Current pulse length on is " + str(attiny.get_pulse_length_on()))
logging.info("Current pulse length off is " + str(attiny.get_pulse_length_off()))
logging.info("Current switch recovery delay is " + str(attiny.get_switch_recovery_delay()))

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

logging.info("Low fuse is " + hex(attiny.get_fuse_low()))
logging.info("High fuse is " + hex(attiny.get_fuse_high()))
Expand Down

0 comments on commit c54cf0c

Please sign in to comment.