Skip to content

Releases: jbaumann/attiny_daemon

Limit number of restarts

30 Mar 13:54
Compare
Choose a tag to compare

New/Added

Nothing.

Changed/Enhancements

When the ATTiny_Daemon decides that the RPi has to be restarted, then beginning with this release the RPi will only be restarted once (in the past it tried to restart until the RPi was alive again). When the restart has failed, the ATTiny_Daemon blinks 5 times instead of 10 times whenever a timeout is reached. Pressing the button resets this, effectively triggering another restart.

Fixed Bugs

Nothing.

Minor fixes

22 Nov 18:16
Compare
Choose a tag to compare

New/Added

Nothing.

Changed/Enhancements

Turning on the UPS now triggers reinitialization of the I2C implementation. This ensures that on restarting the RPi the I2C bus is clean.

Added a new warning message in case the system cannot be shut down by the daemon. This can happen if the sudoers configuration doesn't allow sudo without password.

Fixed Bugs

Fixed a theoretical edge case for writing a wrong value for primed to the EEPROM.

Fixed a small bug with the user button when pressed while the RPi is shut down. Now should restart always as soon as the timeout period has elapsed.

More Robust I2C Communication

24 Jan 10:29
Compare
Choose a tag to compare

New/Added

Nothing.

Changed/Enhancements

Cosmetic

Changed const variables to static const.

Robust I2C

The combination of the following measures should allow for a faster recovery if the I2C bus is locked. This happens only infrequently, but is part of the I2C protocol (problems). We try to detect and react to this faster.

Daemon

Introduced a fast_exit mode to the daemon to support a faster restart in case of an I2C lockup.

Firmware

Added a call to Wire.end() to the initialization of the I2C bus. This allows to re-init the bus at any time with the same call.

After half of the configured timeout period the ATTiny starts to re-initialize the I2C bus every second as long as there is no new communication with the RPi. This does not change any semantics.

Fixed Bugs

Nothing.

Safe UPS control

17 Dec 09:39
Compare
Choose a tag to compare

New/Added

Added serial debug ability. By #def'ing SERIAL_DEBUG (see ATTiny_Daemon.h) the button and normal LED functionality is turned off and the pin is instead used as a serial debug line with 115200 baud. This needs an additional library "ATtinySerialOut" (can be downloaded using the library manager of the Arduino IDE) and changing the pin defined in ATtinySerialOut.h to PB4.

Changed/Enhancements

Changed default low voltage level to better reflect typical UPSs.
Moved Pictures to Wiki.
Removed USI-Wire from the dependencies. We now use the Wire-Implementation provided by ATTinyCore.
Changed the value used to determine whether the eeprom should be initialized from a const value to a combination of major and minor version number. This way the values will be kept (if the eeprom is retained) as long as only the patch level is changed. As soon as minor or major version are changed the eeprom will be re-initialized.
Changed the implementation of MyEEPROM so that put() returns the old value like the parent class.
Changed all comparisons of primed to ensure that it compares against the value 1. This ensures that even if values are read from the eeprom that are totally wrong, that the ATTiny_Daemon is not primed.

Fixed Bugs

The ATTiny85 turns off the pull-up on deep sleep and furthermore pulls input pins without interrupts to ground. This could lead to problems with UPSs. The code is changed so that the high state is now reflected as active high output. Needs more power, but is the only safe way to guarantee the high state.

Minor Fixes and Enhancements

07 Oct 10:54
Compare
Choose a tag to compare

New/Added

Added a message for the daemon running on the Raspberry stating that the merging has completed. This makes it clearer when it has finished its initialization and switches to regular operation.

Changed

Changed the constant and the coefficient for the external voltage to more conservative values

Fixed Bugs

Added atomic blocks to all I/O operations on the ATTiny to guarantee that switching the pins is not interrupted by anything.

Corrected the switch pin operation. Until now it was driven high by the input pullup. Now it simply goes to tri-state thus leaving the UPS to pull the switch line upi (thanks to deHarro for pointing this out and helping to fix it).

Multi-pulse support for even more UPS types

26 Sep 10:32
Compare
Choose a tag to compare

New / Added

Added the option to have multiple pulses to turn the UPS off or on. The number of additional pulses is configured in the high 4 bits of the option „ups configuration“. Bits 4-5 contain the value of pulse repeats for turning the ups off, bits 6-7 the value of pulse repeats for turning the ups on. The delay between the repeated pulses is a switch_recovery_delay / 4.

Changed

Refactoring to communicate the intent of some configuration options clearer.

  • "shutdown voltage" is now "ups shutdown voltage"
  • "reset configuration" is now "ups configuration"
  • "reset pulse length" is now "pulse length"

Changed the meaning of config option led_off_mode. Now takes an integer that decides in which state to signal by comparing the number to the current state. 0 is always, 1 is in any state but running, 8 is turned off (higher than warn_state i.e., shutdown in which the LED is turned off anyway). Generally, if the number is higher than the current state's value, don't blink.

Optimized parameter size for function blink_led() leads to 30 bytes less code and smaller stack allocation

Fixed Bugs

In voltage_dependent_state_change() some values were not saved from change during an interrupt. Fixed

The Return of the Blinkenlight

19 Sep 12:23
Compare
Choose a tag to compare

New/Added

Nothing

Changed

Refactored the blinkenlight functionality. this was overdue after the refactoring of the state machine and gets rid of some edge cases in which the LED continuted blinking.

Fixed Bugs

Blinkenlight edge cases fixed.

More options, new registers and State machine fixes

09 Sep 14:50
Compare
Choose a tag to compare

New/Added

Add new register vext_off_is_shutdown. When set, the ATTiny checks Vext instead of the number of seconds since the last access to ensure that the RPi is still running.
Add symbolic values for the ResetConfiguration.
Added config option "i2c bus" allowing to choose the bus for the I2C communication. This is needed if a bit-banged alternative implementation for the I2C bus is used.

Changed

Changed function act_on_state_change() so that the correct state is reflected even if primed is not set. This makes the function of the state machine clearer (but needs a bit more flash).

Fixed Bugs

Fixed bug that, after a state change to shutdown allowed a state change directly back to warn, leading to possible oscillations between the states.
Fixed bug that led to repeated calls to shutting down the UPS, effectively turning it on again in some situations.

Stability improvement, cleanup, provide cause for last reset

19 Jul 10:38
Compare
Choose a tag to compare

New/Added

Added an I2C command to read the last reset cause (the register MCUSR).

Changed

Moved the EEPROM update from the I2C receive_event() function to the main loop to reduce the time spent in the interrupt. This should further reduce communication errors.

Changed all variables that can be accessed via interrupt (i.e., which are I2C registers) to volatile. Only variables that remain unchanged after setup() are exempt from this.

Moved all eeprom writes from the I2C callback into the main loop, thus shortening the time in the interrupt considerably.

Added a type that allows to read/write volatile data from/to EEPROM.

Added atomic blocks for every access to variables that are larger than 8bit and might be changed during I2C access.

Changed to my own version of USIWire until my pull request is accepted. This allows us to turn off the watchdog as soon as the interrupt is called.

Fixed Bugs

Fixed a bug that led to resetting the ATTiny after some time. The underlying cause was that the callback that actually did the I2C communication in some seldom cases took to long and this led to a reset. Now the first thing in the callback is to disable the watchdog (the same that happens after a normal wakeup).

Bug Fix Release for spurious button presses

06 Jun 10:35
Compare
Choose a tag to compare

New/Added

Nothing.

Changed

Nothing.

Fixed Bugs

The change introduced in v2.9.15 to further reduce power consumption introduces spurious
interrupts that are recognized as false button presses. This update rolls back that change.