Flashlight Firmware Repository

Sounds nice. It doesn’t like like RMM makes any 22mm FET+1 drivers though.

The FET+1 I’ve been using for clicky-switch development has a place to add an e-switch wire, and I’ve got a switch to hook up… the pad is awfully tiny though. I’ll have to see if I can possibly find a tiny wire and get it connected without blocking SOIC8 clip access… It’s the little copper dot next to the “3” here:

It would be easier to use the OTC pads, but then I wouldn’t have an OTC… and that might be important for a dual-switch light.

I thought I posted the details somewhere… Oh well, can post some here.

I use the E-switch, off time cap and voltage divider on the same pin.

The voltage divider resistors must be a lot higher that normally used because R2 becomes a bleed resistor for the off-time cap. I use 1300K for R1 and 300K for R2.
When the light gets turned on, the first thing to do is read the ADC for off time cap result. When that is done, start the WDT interrupt. In the WDT interrupt a voltage check is done. If the result is 0, or very close to it, the E-switch is pressed. If not, it’s a cell voltage reading.

The firmware has to work a little differently than for example Star. I haven’t looked at any other firmware so I wouldn’t know what’s been going lately. I run the WDT interupt at the highest speed so E-switch presses can be detected instantly. Consideration must be taken so the ADC readings from pressed E-switch are not interpreted as low voltage readings by the voltage monitor.

I’ve been working with this setup for a while now on a few different drivers and it’s fairly reliable. The off-time cap values can vary depending on cell voltage and heat, but so far I’ve had no issues detecting short and long off presses. However, I have had consistency issues when attempting to detect short, medium and long off presses. I can post code snips of certain parts of interest but the concept itself is very simple.

Yea, that pad is really tiny. More intended as a “star” connection for soldering to ground. I doubt there was any e-switch use in mind.

Personally, rather than force you to solder up that tiny pad, I think we should send you different driver designed for an e-switch on that pin. One with a nice tiny85 for max code room. To help support firmware development. Considering that some people are more hardware people, others just more software. What do you think? Iirc Comfy sent you the Roche F6 “Ferrero Rocher” driver. If I may ask, are you in the US? I once had the feeling you were in the UK instead, but I don’t recall anymore where it came from! :smiley: Or if you would rather not give your address to some random forum user (which I would certainly understand!), perhaps RMM would be willing to assemble and send a driver based on a board he doesn’t normally carry.

I would also be interested in such a firmware.
I am using STAR_dual_switch atm in a Yezl Y3 with a FET driver but I would like to upgrade to a FET+1 driver so I also need to control two pwm channels.

Most of the current momentary firmwares use pin 2 for the switch… As such most of the boards have pin 3 hidden, or a few boards use it for something else

That’s very interesting. I would like to see this implemented on more boards and firmware. Would free up some pins for extra outputs :wink:

ToyKeeper is looking to do a dual switch firmware though. Tail clicky + momentary side button. You need to keep the OTC (normally pin2) to distinguish between tail clicks.
Also ToyKeeper’s newer firmwares use a separate tk-attiny.h header file to define the pin arrangement. Feels easier to define a different arrangement if needed for a particular board.

I'm keeping the e-switch on pin #2 for now. I'm working on indicator LED support on pin #3 (locator and low voltage indicator).

Why not just use 1 pin to control 2 colors? A high on the pin will trigger 1 side of an LED and a low can trigger the other side of the same dual color led. I have not looked into the amount of current this chip can source and sink, but 30 ma should be enough. I have not tried this with the tiny13 but have done it on the Pi and Arduino several times.

Matt

Well, that’s one kind of dual-switch arrangement. I thought people would just use brown out for click sensing. My main worry is that she will make this great firmware that won’t work with most of the driver pcb’s we have. Then if we make pcb’s for that firmware, we won’t be able to use Pin3 for other things, like indicator led’s or extra outputs (TripleDown)

I have a couple of dual-switch lights sitting around that are just empty shells because I don’t have a firmware I like for them. Like was posted a little earlier today, I would be very excited if we could add dual-pwm support to star-dual-switch or added memory support to Star-momentary. I’d literally freak out and jump up and down if that happened and if it could work with the extra output for my TripleDown board like DEL helped with on blf-a6 a couple weeks ago.

I’ve mentioned it before, but there doesn’t seem to be a lot of interest, so I silently keep working on my boards and firmware :slight_smile:

That’s what I had in mind, sort of, I guess.

I found a nice explanation of how it could work that even a dumb dumb like me could understand. I thought maybe someone could make something useful out of it, that’s why I asked…

@Mike C, the things you do are both very impressing and over my head at the same time. Looks genius from my point of view! I’m sure it looks genius not only from my dumb-dumb point of view… :slight_smile:

Well, that… and I’m hoping to be able to use one dev board for both clicky firmwares and e-switch firmwares, and for both single-channel and dual-channel firmwares. It’s nice having a few bits of versatile hardware instead of a lot of single-purpose pieces. I’ve got a growing pile of decapitated light heads with drivers hanging out on long wires.

It doesn’t have to require OTC for a dual-switch project.

RMM’s FET+1 SRK board looks really nice, but I don’t know if he still sells it. My SRK might make a decent all-in-one dev host, and it’s not really getting used for anything else now that there’s a Meteor…

I’m interested! :slight_smile:

Even without the hardware, the code would be a great source of ideas and reference material. Like the 3-way-overloaded pin. That’s brilliant!

I’m a big fan of release early, release often.

I assume it would be pretty difficult to add the battery monitoring code from Ferrero Rocher into a clicky firmware like star-offtime?

Realtime battery status on a clicky shouldn’t be terribly difficult. Of course, it can’t display anything while it’s off. :slight_smile:

Details aren’t worked out, of course. And it’s hard to add more to STAR because it doesn’t leave a lot of extra room… but after removing things we don’t need any more (like solderable star support), there’s enough room to add other stuff.

Well I have a special use in mind. The driver will (almost) always be powered, but quick interrupts will be used to change modes.

I swear I knew you’d come up with something like this when I read your post #742. Must be a special kind of tailcap board again or some sort of on-on-clicky?

hey,

I’d appreciate some help. I played around with bistro, wanted to make a single channel version for a p60-drop-in with 105C-based-driver, that’s working so far. I know it’s also quite easy to make a 2-channel-driver out of a 105C by rearranging the traces a bit, that’s easier in fact. But with this Nichia I wanted to prioritize best as possible tint over efficiency, and a smooth as possible ramp. And that’s where my lack of knowledge comes to play. If I were to increase RAMP_SIZE to 128, would that cause any trouble? I tried to adjust both attiny.h and bistro; https://www.diffchecker.com/ow8bdznq; https://www.diffchecker.com/7rr33hvf. But that doesn’t seem to work right… What am I doing wrong?

To increase the ramp size, you’ll need to turn off something else to make room. The ramp itself can be calculated by level_calc.py. I’m not sure right now how hard it’d be to disable dual PWM entirely, but if there’s room you can always just leave the second channel at all zeroes.

I’m on a phone at the moment, so I can’t really do much with the code…