Flashlight Firmware Repository

Ok. I don’t real know what I am doing, but I might as well jump in and learn to swim:)

Can the FET only be toggled? I got the attiny85 for the added pwm, so will the 85 go to waste with this firmware, or is there still benefit? Sorry if my questions sound like I don’t know what I’m talking about. please humor my ignorance:)

I don’t know how it works with anything other than a 13, or even if it will work at all. I personally have not left the 13

Don't think there's any added PWM (??). 25/45/85 all have the same PWM limits, as I understand it.

I was talking about the number of outputs, but clearly I don’t know enough to be asking questions yet. I will keep reading. :person_facepalming:

Oh, um, the attiny13a has one PWM counter and two PWM channels. A 3-channel driver will need to use a general I/O pin for one of the channels, which is useful if you want a super-bright turbo and don’t care about the levels between turbo and 100% 7135. So, like, you could use 7135s to go smoothly from moon to about 1000 lumens, then go directly to a 3000-lumen turbo, and you wouldn’t be able to access anything between 1000 and 3000 lumens.

The tiny25/45/85 have two PWM counters and four PWM channels. So, it should be able to go smoothly all the way from moon to turbo even on a 3-channel driver.

I got a tripledown attiny25 board yesterday and am hoping to get bistro working on it soon. So far all I’ve done is update the ramp calculator to support 3 channels, and haven’t gotten into the actual driver code yet. Bistro works on it in 2-channel mode (1x7135 and 6x7135), but the third channel (FET) is currently unused.

Ok. Thanks. I was just reading your posts in the tripledown thread. I mistakenly posted a question about the tripledown firmware here. Oh well.

I think you are working on exactly what I am looking for so I will continue to follow the tripledown thread anxiously awaiting your developments. For now I’m going to continue to practice flashing firmware with small customizations so hopefully I will advance my knowledge a bit.

After someone else confirms it works, and maybe the defaults are tweaked back to a more user-focused config, I should be able to merge the tripledown-bistro code into trunk. For now, it’s working but is only in the tiny25 development branch.

For tiny13-based tripledown drivers, that’s a different matter. It can’t do PWM on the FET pin, and it has only half as much space, so it’s significantly trickier to get working.

Dear ToyKeeper,

I have flashed your Baton FW for my light and it is great. I noticed that the green and the red indicators were turned on and off during the transition period when the voltage was dropping to the on/off threshold. Can you help me to make it turned on/off sharply.

Hi, um, what exactly is it doing, and what do you want it to do?

In my testing, the indicator tends to stay green above 3.9V or so, then starts to flicker orange occasionally, and the flicker gets longer and more frequent as it gets near the next voltage threshold. Eventually it goes fully orange and stays that way. Then as the cell voltage drops more, it eventually turns red. But I haven’t seen the same soft flickering transition effect between orange and red.

I think this is because the voltage measurement is made out of phase with the PWM signal. So, sometimes it measures with the main emitter off, sometimes with it on. And this results in pretty different readings depending on when exactly the measurement was taken. It was unintentional but I kind of like the result since it gives a finer resolution, more than just green/orange/red.

At lower voltages it doesn’t seem to matter as much. The emitter isn’t using as much power so it probably doesn’t vary as much.

If you want it to not flicker orange as it nears the orange threshold, it’ll need to sync the measurements to happen at a consistent part of the PWM cycle. I’m not sure how to do this though.

Thanks for your prompt reply.

What I want to do is that you have explained. I have modified the code that
FULL BATT indicator off
LOW BATT indicator on
ALMOST EMPTY indicator blink

As you have said, the led flickered before it was stably on. I try to get rid of the flickering. It seems that is not easy to be done by changing a few lines of the code.

ive been playing around with tk’s starry-offtime firmware(and others). Does anyone know where i can find the .h files that are referred to in the STAR firmware? Or do i not need them? Thanks for any help! These are the files i am talking about:

#include <avr/pgmspace.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <avr/eeprom.h>
#include <avr/sleep.h>
//#include <avr/power.h>

oops!

#include <avr/pgmspace.h
#include <avr/io.h
#include <avr/interrupt.h
#include <avr/wdt.h
#include <avr/eeprom.h
#include <avr/sleep.h
//#include <avr/power.h

PPDB22, they are installed with the “avr-libc” package on linux distributions. Not sure what the equivalent is on windows. If everything is installed correctly, they should be found automatically by the compiler.

hmm. ok so are they created when i build the hex? excuse my ignorance!

or are you saying they should be part of my avr software package? sounds like i should just build the file and give it a try then…

Yes, they should come installed with the compiler. You won’t be able to compile most firmware without them. They’re official atmel stuff: http://www.atmel.com/webdoc/AVRLibcReferenceManual/group\_*avr*\_eeprom.html

What are you using to compile? On which OS?

I’m on Windows 10. I’ve only flashed four drivers so far. I asked about these files because I compiled a different firmware with errors caused from missing files. I fumbled through fixing that so when I came to this firmware and saw it referenced some files I went looking for them. Thanks for you help. I’ll get to try it out tonight if my day goes well:)

In C, any include with <> symbols is assumed to be provided by the host system. Includes with quotes come from the specific project being built.

So, all those mentioned should be available by default if the AVR toolchain is installed correctly.

i have been preparing myself for using the triple down drivers for some lights to spot game at night. So I was thrown off a bit when I was asked to build some lights with red emitters. Anyway, I searched for some code for 7135 drivers that could be modified with an “off” mode as well as battery check mode. Ironically, the code I now have working is tk’s s7 firmware which is designed for advanced flashy modes. It now has five modes, off-low-med-high-battcheck, and memory is disabled. So from any mode I can turn the light off and then back on again without a “click”. I’ve found the click from a tailcap switch to carry quite far in the still of the night. I will be curious to see if this is helpful or not.
Thanks to tk and the other firmware builders!

I’m after a bit of help. I have a MTG2 light which is causing me a bit of a headache. The LVP kicks in really early, I have the right voltage dividers and I’ve tired getting the readings with TK’s firmware but they just don’t seem to be right. I suspect its down to the voltage drop when the light is pulling high currents. Is there anyway that I can get these readings while there is the voltage drop?
Thanks