User Tools

Site Tools


projects:advent

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
projects:advent [2016-02-10 21:11]
robert [Firmware]
projects:advent [2016-02-10 21:14] (current)
robert [Function]
Line 35: Line 35:
  
 As always, there are a few complications:​ As always, there are a few complications:​
-  * In order to prevent a "​ripping the advent calendar open and eating all the chocolate at once" incident (i.e. turning on LEDs early), the calendar keeps track of the time between ​button ​pressesOnly if there are more than 10 hours since the last button press, a new LED will come on. That time interval was chosen to account for the possibility of the button being pressed ​at any point during the working day (e.g. 17:00 on one day, and 07:00 on the next).  +  * In order to prevent a "​ripping the advent calendar open and eating all the chocolate at once" incident (i.e. turning on LEDs early), the calendar keeps track of the time elapsed sine the button ​has last been pushednew LED will only come on if the last successful push of the button was more than 10 hours ago. That time interval was chosen to account for the possibility of the button being pushed ​at any point during the working day (e.g. 17:00 on one day, and 07:00 on the next).  
-  * However, after weekends or days off it should be possible to catch up on the missed days without the 10-hour interval. For example, it should be possible to press the button thrice in a row for three LEDs to come on on a Monday morning - once for Saturday, once for Sunday, and once for Monday. In order to make this possible, LEDs can be lit successively ​if the previous button ​press is more than 24 hours in the past. In effect, every 24 hours since the time the button was last pressed ​allow an LED to come on without the 10-hour lockout time.+  * However, after weekends or days off it should be possible to catch up on the missed days without the 10-hour interval. For example, it should be possible to push the button thrice in a row for three LEDs to come on on a Monday morning - once for Saturday, once for Sunday, and once for Monday. In order to make this possible, ​several ​LEDs can be lit in succession ​if the previous ​push of the button is more than 24 hours in the past. In effect, every 24 hours since the time the button was last pushed ​allow an LED to come on without the 10-hour lockout time.
   * The current state of the advent calendar is stored in the mbed's flash memory, and is accessible through the file system. This is great for debugging and makes the firmware quite a bit simpler, but it does have the unfortunate side effect that pranksters can tamper with the files. Luckily, a "​feature"​ of the mbed's file system implementation means that it [[https://​developer.mbed.org/​handbook/​LocalFileSystem|won'​t show up as a USB mass storage device if there are any open file handles]]. In the case of tamper-proofing the advent calendar this can be used as an advantage - simply open a dummy file and keep it open, and it won't show up on the computer. This appeared to be enough of a hurdle to put an end to the mischievous deeds of the chief office prankster.   * The current state of the advent calendar is stored in the mbed's flash memory, and is accessible through the file system. This is great for debugging and makes the firmware quite a bit simpler, but it does have the unfortunate side effect that pranksters can tamper with the files. Luckily, a "​feature"​ of the mbed's file system implementation means that it [[https://​developer.mbed.org/​handbook/​LocalFileSystem|won'​t show up as a USB mass storage device if there are any open file handles]]. In the case of tamper-proofing the advent calendar this can be used as an advantage - simply open a dummy file and keep it open, and it won't show up on the computer. This appeared to be enough of a hurdle to put an end to the mischievous deeds of the chief office prankster.
  
projects/advent.1455135063.txt.gz · Last modified: 2016-02-10 21:11 by robert