Flashlight Firmware Repository

I think this can be adapted to any 13A driver because typically pin3 (Star3) is unused. Unfortunately, that pin is not in a convenient location to make this mod easy (but where is the fun in easy?). Even E-switch drivers can benefit from this mod. In fact they would have the most to gain because they are always drawing some current. But I don't have any to test this out on... Likewise, any driver using any micro-controller should be able to adapt this technique to reduce current.

Somewhat off topic…
Does 112uA = +/-1A per year?
So a typical 3000mAh 18650 would drain a third of its capacity in a year with a 112uA parasitic drain?

You are joking right?! As I said before CC shouldn’t be used for software and even CC itself has it in its faq:

https://wiki.creativecommons.org/Frequently_Asked_Questions#Can_I_apply_a_Creative_Commons_license_to_software.3F

Anyway, to sum it up. Tido use GPLv2 for BLF-VLD and JonnyC use Public Domain for Star. And then you use GPLv3 for blf-a6. Those are the ones that you can safely use then.

With CC-BY-NC-SA, you should be safe to use the code for your own use, and to publish modifications you make of it, as long as it’s under the same license and you give credit to DrJones. Selling a light with a version of that software is likely not allowed, and as a guess no selling of it is DrJones intent. I don’t know of a software license that allows that sort of use, CC-BY-NC-SA does.

From some random page I pulled up with a quick Google search:

AFAIK the GPL also allows commercial distribution, and doesn’t specifically require attribution. TK can tell us, as she works with this stuff all the time. But, I doubt those things would be hard to add if they were important to you. I think the GPL does require re-distributors provide a link to the unmodified original code, though. That would probably count as attribution. Like I said, ask TK.

Well yes, your math is correct (if you ignore self discharge), but why would the light will be in LVP mode if the cell has a full charge?

This mod helps protect the cell once it is depleted. At that point there is very little reserve capacity to feed that 112uA drain. Dropping that current to 2uA gives you 50X more time to realize that you left the switch ON. Is this a solution to all the world's problems? No, but it is a small step in the right direction.

The GPL requires re-distributors to provide the source code for whatever they are distributing. If they modified it, they need to include their modified version. If it’s unmodified, they should include the original version. Aside from just guaranteeing that everyone can use and mod it, it is also intended to make sure that people share the improvements they make.

This can be inconvenient for vendors though. It would mean, for example, that if RMM sold drivers with the BLF-A6 firmware, he would need to include a link to (or copy of) the BLF-A6 source code or at least provide it to anyone who asked for it. With the public-domain(ish) STAR firmware, he doesn’t need to do this.

Some people prefer BSD-style licenses, which make virtually no demands on anyone. One can modify BSD-licensed code and sell products using it with no need to share their code or improvements. In fact, this is where much of Microsoft’s code came from; it’s based on old BSD code. There is an ancient and ongoing debate about whether “share” or “share and share alike” is more “free”.

Regardless, I’m happy about contributions people share under any open license. You’re helping people you may never even know about. :slight_smile:

A few noob questions, what does this line do?

#define F_CPU 4800000 // CPU: 4.8MHz PWM: 9.4kHz ####### use low fuse: 0x75 #######

And these two?

#define pwminit() do{ TCCR0A=0b00100001; TCCR0B=0b00000001; }while(0 ) //chan A, phasePWM, clk/1 ->2.35kHz@1.2MHz
// #define pwminit() do{ TCCR0A=0b00100011; TCCR0B=0b00000001; }while(0 ) //fastPWM

The two last ones look like two different ways of running pwm. And the first one seems to be somehow related.

Edit: And this one?

#define PWM OCR0B

It sets the CPU clock speed and pulse generator options. It’s a little easier to read the parts of STAR which do the same thing, or the attiny13a reference manual has full details on which bits do what.

The most common options are whether to use “fast” PWM (18.75 kHz sawtooth wave) or “phase-correct” PWM (9 kHz triangle wave), and single channel or dual-channel PWM. In single-channel mode one can also select whether to use variable PFM (pulse frequency modulation) or stick with the default speed.

Ok, good to know. I didn’t know that pin3 was equivalent to star3.

Anyway as i see it, i hope this improvement will be picked up as a standard feature in the LVP in future revisions of the attiny13a drivers.

Seems like the obvious next step, for extending the protection of the LVP in single battery applications & multi battery LDO drivers.

I started on some ideas I had knocking around in the back of my head, and ended up with a FET+1 firmware which works like the diagram below… I’m curious what people think. It basically has a regular mode group, a secondary group for the most useful blinkies, and a tertiary group for a full set of blinkies.

You can fit all that on the attiny? Nice!

ToyKeeper is one of our most valued players. He She is one who is nice enough to share with EVERYONE. :bigsmile:
Puts a lot of effort into this for us. A BIG thumbs up for him her!

Corrected.

Thank you, my sincere apologies. :8)

How does one exit from tertiary mode if mode memory is enabled?

(I know I'd get lost ... )

There is no memory. :slight_smile:

Got it, I think, it’s the default pwm pin on the 105c. Just out of curiosity, how many pwm channels do the attiny13 got? Yeah I know rtfm, there must be at least two, so much I know. :slight_smile:

The attiny13a has two PWM channels which share a counter.

Got it, thanks for answering. :slight_smile: And looking at that page, I understand how flash and eeprom works but what about ram? It says 64 byte available. Should I start counting variables? Basically one byte integers I guess.