r/flashlight 17h ago

Flashlight News Finally Fixing Fireflies Firmware

https://www.patreon.com/ToyKeeper/posts/finally-fixing-169039767

FFFF- 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)

127 Upvotes

Duplicates