Modifying BLF-VLD
This is a page that is being worked on to help modify the BLF-VLD code.
The code is written without any brownout detection. In other words, the program has no idea how long the light has been off. Because the program has no warning when you will turn off the light, it has to store information in permanent memory as it goes. The "watchdog" monitors what is going on every 250 milliseconds. So at first it writes down that the light has only been on for an instant (in case the light is turned off immediately thereafter). Then after the light has been on for a second, it records that the light has been left on for a long dash (this is important programming the light), and once the light has been on for more than 2 seconds, any attempt at programming is abandoned and the mode the light is currently in is memorized.
Once the light is turned back on, the program checks to see if it was on for more than 2 seconds last time, and if so, comes on in the stored mode. If it was on for less than 2 seconds, a couple of things could happen. First, you could be in programming mode. So it checks to see if variables have been stored that indicate that is the case. If that is not the case, then you are probably changing modes, so it will go ahead and change modes, and store the value of the new mode in case you do another blink and change modes again.