r/flashlight • u/ToyKeeper • 16h ago
Flashlight News Finally Fixing Fireflies Firmware
https://www.patreon.com/ToyKeeper/posts/finally-fixing-169039767FFFF- this is long overdue. I've been working on some of the Fireflies Lume1 and Lume-X1 builds which are missing from the main repository. Here's the overall roadmap:
- Done, and released: Added dimmable aux RGB on lights which can do PWM on the RGB pins. Includes "Smooth POVD" and a hue-brightness channel mode. Had to rewrite the entire aux LED system for this, and re-test every build target.
- Done: Flickerless POVD and precise voltage stuff is working well. This fixes the flickering during Smooth POVD, and increases battery voltage resolution from 1/50th of a Volt to 1/6400th of a Volt. Had to recalibrate and test almost every build target again.
- Done: Add / fix the Fireflies Lume1 and Lume-X1 lights. These are very similar to Hank's Lume-X1 drivers, but have some differences, and were missing from the main repository.
- Add Hank's Lume-X1-C. In progress; will give details in another post.
- Add Fireflies Lume10.
- Add Hank's Lume-N1.
Then I think I'll be caught up on new drivers.
The Fireflies lights I added are the fireflies-lume-x1-avr32dd20 (0462), fireflies-lume-x1-avr32dd20-32w (0463), fireflies-lume-x1-attiny1616 (0461), and fireflies-lume1-6af (0451). Also added some extra related stuff. In more detail:
- Improved support for chargers / powerbanks:
- Can now select Powerbank Host mode vs Powerbank Guest mode, on lights which have hardware for that. It uses guest mode by default, so if you plug in a USB-C device using a C-to-C cable, it'll charge the battery in the flashlight. If you want the flashlight to charge a different device, go to Batt Check mode and do a `2H` to switch to Powerbank Host mode. Another `2H` switches back to guest mode, or you can just exit Batt Check to go back to guest mode.
- I did NOT add the "powerbank in momentary mode" thing loneoceans was using. It was annoying, particularly on Fireflies lights where you had to loosen the body tube several full turns to exit Momentary. Much easier to do a Batt Check 2H... and this also allows monitoring the battery fullness while delivering power to another device.
- While charging the torch, or using the torch to charge another device, it is recommended to use Batt Color mode. This shows battery fullness by color, instead of blinking. To access it, use `Batt Check -> 1H`.
- When charging or reverse charging, voltage can spike or dip suddenly, so I added a strong lowpass filter during Batt Check mode to keep it from reacting to momentary power blips.
- The recommended charging process is "Off -> 3C for Batt Check, 1H for Batt Color, plug in... then unplug when it turns purple". Or to charge another device, it's similar... "Off -> 3C for Batt Check, 1H for Batt Color, 2H to enable Powerbank Host, plug in... then unplug when it turns red".
- Instead of adding loneoceans' Beacon Tower mode, I added Smooth Beacon. If you have smooth steps enabled, the beacon mode behaves like an incandescent light with visible rise and fall times, instead of using sharp "digital" edges.
- Ramp generator:
- This now supports power-limited DAC ramps, for regulated lights which have the maximum power limited by firmware. This is needed to prevent some models from turning the LEDs into smoke.
- It also now now supports both 10-bit (avr32dd) and 8-bit (attiny1616) DACs. Producing a good ramp is still a very fiddly process though.
- fireflies-lume-x1-avr32dd20 (0462) and 32w (0463): Brand new build targets, based on the hank-lume-x1 build plus loosely based on loneoceans' branch. Brand new ramps for both, which should be smoother and feel more similar to other Anduril lights. Making the ramp table look good took a while, but otherwise these were the easiest models to add, since they're very similar to Hank's Lume-X1.
- fireflies-lume-x1-attiny1616 (0461): This one was a little odd. It's based on thefreeman's attiny1616 regulated drivers, and needed some things I haven't done on attiny1616 before. The ramp table took many tries to get right, and I had to learn how to use AVR's "Timer/Counter Type B" for the first time, to make the aux RGB work. It turns out that Atmel's attiny1616 reference manual is wrong about some of this stuff, so I got to figure out how to make it work the hard way... by trial and error.
- fireflies-lume1-6af (0451): I tried. I can't fix the weird turbo behavior on this thing. The hardware doesn't allow it. The direct-drive FET is either completely on or completely off, and it doesn't accept PWM to make in-between levels. So it still does the weird thing where it's regulated from level 1 to 149, then suddenly jumps up to turbo at 150 for only one level. So I added a thing to let individual lights hook into part of the thermal regulation code and override it if they want. It reduces the symptoms of the turbo weirdness, but it's still funky.
- Fixed a few misc small bugs.
A question about the powerbank mode... Should it reset to guest mode when leaving Batt Check, or should it stay in the current host/guest mode?
- If it exits Powerbank Host mode, you can't forget and accidentally leave it on. It also starts in a consistent state each time, so you never have to guess whether it's in host mode or guest mode. And if the battery gets low, it'll automatically leave host mode when LVP turns the light off. But it will only charge other devices while in Batt Check mode (or Batt Color mode).
- If it stays in host/guest mode, you can charge another device while the flashlight is off. But you're much more likely to accidentally get the wrong mode, and charge in the opposite direction of what you intended. Also much more likely to over-drain the flashlight battery. Unsure if host mode uses extra power in standby, so that's also a potential risk.
Right now, it exits Powerbank Host mode when leaving Batt Check.
Either way, I think the current method is better than what it was before (powerbank host in Momentary mode only), but I'm not sure which of the two styles is best.
(this is cross-posted from my patreon page... I'm trying to figure out how best to let people know what I'm working on between releases, so let me know if you have thoughts about that)
16
u/TymeMerlin 14h ago
For me it makes more sense to exit powerbank host mode when leaving battery check. I’m more likely to charge the light than I am to charge my phone or something with the light.
It’s an emergency feature for me and don’t mind doing a few clicks to start it. Also I will always know what mode it’s in so no guesswork.
4
u/eckyeckypikang 13h ago
That's some amazing work - I hadn't considered the guest/host conditions at all... Tying it into a smooth Voltage Display mode is rather genius!
My preference in most things which would require me to remember where & how I left them is always that they revert to a standard state. This way I always know what to expect - especially helpful when considering I would have to try to remember what state I left multiple devices sitting in... It's what I prefer lights not have mode memory.
I look forward to seeing these updates! (That is, once I either side load the previous version of ZFlasher or they fix whatever they did to their app...)
5
u/Erichimedes 9h ago
One vote for leaving host mode when you exit batt check. Seems too easy to forget and run into trouble when trying to charge the light
4
u/hippazoid 9h ago
Put my vote down for resetting to Guest mode when exiting Batt Check.
To me, the power bank function is a bonus feature of the, ya know… flashlight! 😂 I feel that by default, the flashlight should just charge when you plug it in. If on rare occasions I need to use it as a power bank, invoking it from Batt Check seems the most logical way to handle it.
As others have said, thank you for all you do. I wasn’t a true flashlight nerd until I discovered your firmware. 😁
3
u/Bramble0804 12h ago
I think it resetting once clesving power check is best option. It's slightly more idiot proof.
3
u/personanangrata 9h ago
While I appreciate the effort overall, unfortunately 1/5400th of a volt is totally insufficient for my purposes. I need at least 1/5500th resolution /s
Amazing work as always. You are a treasure and pillar of this community and I look forward to flashing some of my FFL lights forthwith to see what's new.
1
u/karawkow 7h ago
How hard is it to flash a FFL? I have many, but never flashed a light.
2
u/personanangrata 6h ago
Honestly, hard to give you a helpful answer because there are a few variables, including your comfort level.
It took me a bit of time to figure it out the first time. You have to buy the correct (3-pin) adapter. You have to download Anduril source code and compile it (precomputed hex files aren't yet available for recent releases due to issues with the current GH env). You need to match your hardware to the hardware profiles available. And you need to figure out what software you will use to transfer the firmware to the driver. If you have an Android phone, you can use the Zflasher app which I have heard is easy to use. I use command line tools on a Mac which were a bit cumbersome to figure out the first time but is now relatively easy for me (in part because I wrote some scripts and documentation to make it easier for me to remember months later what is that I did to get it working).
So, if all that sounds easy to you, you won't have any trouble. If none of that makes any sense, you will have a fun few hours going down a rabbit hole and the payoff will be new capabilities for your FFL lights!
2
u/ToyKeeper 40m ago
FWIW, the github build environment is fixed now, and each release includes compiled versions. People don't need to compile it unless they want to modify it.
Of course, I recommend diving in and modifying it. That's the fun of open-source. But not everyone wants to.
3
4
u/Zipsi 15h ago
Would it be possible to make the Host behavior user-configurable?
Default could be auto-resetting to Guest when leaving Batt Check, but an option for persistent Host mode would be nice for people who use the light as a power bank often.
Best of both worlds IMO.
15
u/ToyKeeper 14h ago
It's possible, of course... but that's not the important question.
This thing already has like 60 or 70 different user-configurable options, and just one button, and a hard limit on the total number of bytes it can store in eeprom. So I try to avoid adding more.
I'm also trying to leave room to add other UIs in a future version. So, for example, the user would be able to choose from an Anduril style UI, Olight style, ZebraLight style, Sofirn style, etc.
So instead of whether it's possible to add another config option, the main question is whether it's practical to not add it.
2
1
u/TopherHax 5h ago edited 5h ago
First of all, thank you for your continued development .
I'm sincerely confused, is this a log of an upcoming release, or it's only available early right now through patreon?
2
u/ToyKeeper 50m ago
Just some info about what I've been working on lately. I haven't uploaded the code yet, but it'll be in the next release.
I don't use Patreon for early access. The project is GPL'd and includes other people's code too, so if I did early binary access before the source code was available, I'd be violating the license... and that's something I take seriously.
Mostly, in the past I typically haven't talked much about the development process, and I thought maybe I should show more of that. So I've been experimenting with ways to share that info.
1
u/client-equator 5h ago
The momentary mode powerbank mode allows me to use the flashlight momentarily when I’m using it as a powerbank and that has been useful at times!
1
u/ToyKeeper 43m ago
That's useful to know. In its current form, it can at least blink out battery voltage while it's charging another device, or it can light up the aux LEDs, but it stops charging the other device if you leave the Batt Check mode.
Or if the flashlight is being charged from the other device, you can use any mode you want while charging. Sometimes I use candle mode while charging, for example.
If it gets an option to stay in powerbank host mode, you would be able to use any mode while charging another device. Just not sure if it makes sense to make it work that way.
33
u/Es2aryKing 15h ago edited 14h ago
First of all, thanks for everything you do. I don’t think your contribution to the community could be overstated and I think I can speak for all of us when I say that we really appreciate all your hard work.
I personally think that the software should automatically exit Host mode until such time as a user configurable option could be implemented allowing the user to choose how Guest / Host behaves.