Flashlight Firmware Repository

That is very cool. Our high school had apple computers in the mid 80’s and I could do the “if and then” statements with the best of them and ended up being the teachers assistant my senior year.

The first time I saw a computer was at my Mother’s job. She worked for a place in Saginaw Mi. that did the payroll for the City and a bunch of other large businesses. I remember going there to see the huge rolls of tape and all of that. I’m sure that was Fortran and probably some of the very earliest commercial use of computers. Time-cards turned into paychecks, I think the place was called Fullerton if I remember correctly.

Funny for me really, considering we are family of farmers. But farming is more and more high tech now. I sold feed for a while and we used a program out of Michigan State for figuring out the optimal feed requirements for dairy cows. We tested all of the feed grown on the farm and then balanced that with the stuff we sold. My Father sold fertilizer and they did the same thing for that. My Grandfather could do the math in his head faster though. LOL

In '78-early 80's, the job market was insane. I had multiple job offers coming out of the tech school - 6 month certificate in computer programming - oh boy... You switched jobs every 6-12 months to get a 10%-20% or greater bump each time. I got 20%+ counter offers just to stay at a couple of jobs.

All that doesn't make me an expert at Atmel/AVR programming though, so the learning never stops... It still blows me away that they can fit so many components/features into 1 tiny chip.

Here is one way to achieve customization of firmware without recompiling and only editing one hex file. The EEPROM can be loaded from a hex file. Configuration data can be put into the EEPROM hex file, edited, and programmed to the MCU. Since the EEPROM hex file is separate from the program hex file, it can be programmed by itself.

This would beneficial to those who have the equipment to program the MCU but not the software programming skills.

You don’t need software programming skills to change mode levels. All you need to do is change a few numbers. Star is basically written for easily defining modes, mode direction, memory, timeouts etc etc… It’s pretty easy to grasp.

Is there any idea of what the "OFF" current of momentary firmware can be? Any ideas whether the current is in the few microamp range? Or are we talking tens or hundreds. Do any of the mom. firmwares go to sleep mode when "OFF"? Would using the reset pin PB5 for the switch input allow for deep sleep? (It would probably remove the possibility of short/long press detection.)

I'd like to run from a single AAA cell where capacity is quite limited.

From what I recall, I measured the “off” current on Ferrero_Rocher to be about 0.36mA with the green indicator LED on (dimmed), or about 0.33mA with the indicator off. About 1.23mA with the indicator on full. So, anywhere from ~10 to ~45 days of standby time on a 10440 cell.

But that’s without seriously optimizing for standby power; IIRC it can get significantly lower with the right code. Atmel published the specs but I don’t recall the actual numbers.

What I want to know is how you fit an e-switch into a 1xAAA light.

This is very good!

Thanks!!

Oops LOL I didn't mean an e-switch AAA, like an EDC, that would be tricky (but possible). I was thinking of retrofitting a headlight driver as it already has the e-switch. What I'd like to design for is say 80% remaining capacity after 30days of standby. (or 90 days better yet) If you use all the capacity in standby time then its no good.

The tiny13a draws 2uA in power-down, but requires a reset or power cycle to recover (correct me if I'm wrong). That's why I wondered about using the reset pin for the e-switch input. I'd also need some way of disconnecting the ADC resistors to eliminate their current.

If I only had more time ...

Noob question. Would starry-offtime work on a standard Nanjg 105c? I'm thinking I need to make the following changes:

and/or zero out "#define MODES1x" so it reads

Am I at least in the ballpark? Thanks in advance.

A standard nanjg has no offtime capacitor (OTC) so starry-offtime wouldn’t work on it. However, basic STAR and STAR_noinit should work, and so should anything listed under “mem decay” or “ontime” in the INDEX file (as long as it’s also listed under attiny13a).

You should also make sure that the switch type matches — clicky or momentary. I’m guessing you have a clicky.

Sorry, I meant Nanjg 105c with an otc installed. I was just hoping to use some of the advanced features of starry-offtime but was unsure about the secondary channel bits. I'm currently running STAR offtime on the driver in question.

Ah, okay. It should work then. But if it has only one power channel, you’ll want to use only the primary PWM (MODESNx, not MODES1x, and swapping the fast/phase defines like you already did).

You might also get more mileage out of the blf-a6.c or tk-otc.c firmware, which are similar to starry-offtime but more mature. But you’ll need to adjust the ADC values for offtime and voltage (which can be measured with the firmwares in battcheck/* or copied from reference values).

It also currently requires changing a line of code in the battery check mode, but I’ve been meaning to fix that for easier use on single-channel drivers.

I appreciate it! I'll give the blf-a6 and tk-otc firmwares a shot. I presume I shouldn't try to use the battcheck mode on either firmware with a single-channel driver for the time being. (I'd change it myself if I had a clue what's going on... but I don't. )

Oh, it’s a simple change. Look for the “void blink” function and change its set_output(0,20) to set_output(20,0). This moves it from the second power channel to the first; otherwise it won’t light up at all.

But I have a few other improvements to make too…

I know it’s written in here somewhere, in several threads I guess… Anyway, when is phase correct PWM preferred over fast PWM? If I understand correctly, phase correct can produce some noise. But as the possibility to select it exists in a lot of firmwares there has to be a situation where it is beneficial. What would that situation be?

Phase mode is helpful to get moon modes between what fast mode provides. It also is required to make the emitters shut off completely in some cases on e-switch lights, because fast PWM still emits even at level 0 on some drivers. It is also less sensitive to low batteries, so the low modes won’t sag as much. And some people just prefer it, despite the whine and slower flashes.

Thanks for the explanation, I’ll test it someday. It makes sense except for one part. If one wants to shut off the emitter completely, why not just turn off the pin?

It would probably work, but it’s usually easier to just set PWM=0. Fast PWM will still output a brief spike even at zero though. IIRC, someone also tested a slight difference with PWM=255, where phase was slightly brighter than fast (fast has a brief downspike even at 255, I think). So as a general default, it’s usually a good idea to use phase at moon and turbo but use fast for everything else.

Adding pin logic is untested, I think, and would use a bit more room in an already-cramped space. It’s also redundant if there is already logic to put the MCU into sleep mode while “off”.

I suppose it’s a minor issue at worst, so nobody has spent much time on it.

To turn off the pin only one additional row of code is needed, but I guess your right with it being not needed. Thanks for taking the time to explain it.

Guys, Is there 1 mode-100% ( or star choosable 1 mode) 105c firmware awailable guys? Currently i am bypassing the atttiny13 in order to achieve this , and ofc warnings and cut-offf are lost this way