Flashlight Firmware Repository

Hi, please help. I flashed an a6 firmware. I removed the hidden modes and put the strobe to the highest mode like this

#define NUM_MODES1 5
// PWM levels for the big circuit (FET or Nx7135)
#define MODESNx1 0,0,80,255,STROBE
// PWM levels for the small circuit (1x7135)
#define MODES1x1 2,70,0,0,STROBE

Now the problem is I want the turbo timeout to work on the 4th mode (FET 255) not on STROBE mode. How do I edit the firmware so that when I am in the 4th mode it will step down to 3rd mode at turbo timeout?

maybe try the following:

search for

#ifdef NON_WDT_TURBO

change
mode_idx = solid_modes - 2;
to
mode_idx = solid_modes - 3;

Thanks, I’ll try that.

You are a genius :smiley: it works :+1:
Thanks

I built another blf a6 driver. I disabled the med press. I want the mode direction from turbo to low and always start at turbo. How do I make it it?
Here are my modes

#define NUM_MODES1 4
#define MODESNx1 0,10,100,255
#define MODES1x1 10,255,0,0

If I make it like this

#define NUM_MODES1 4
#define MODESNx1 255,100,10,0
#define MODES1x1 0,0,255,10

How do I edit it so that the turbo timeout will step down from first mode to 2nd mode?

This should do it:

change
mode_idx = solid_modes - 2; // step down to second-highest mode

to
mode_idx = 1; // step down to second-highest mode

Thanks, it works.

I started digging thru different codes in search for smooth ramping, idea is to have 1-mode flashlight that would, when switched on, started ramping from no light to max light in set period of time.
When reaching max light it would stay there.
Anything similar here?

This works but there is a problem at low voltage ramping down.

#define NUM_MODES1 4
#define MODESNx1 255,100,10,0
#define MODES1×1 0,0,255,10

mode_idx = 1; // step down to second-highest mode

If I am on the 4th mode and low voltage kicks in, it ramp down to 3rd mode but the 3rd mode is brighter and 2nd mode and 1st mode. How do I make it ramp up at low voltage so that when I am on the first mode when low voltage kick in it will go to 2nd mode? And when I am on the 4th mode it will just turn off.

Sounds like you will need to re-work the LVP logic to continue down this path.
Alternatively, it might be easier to put everything back to original and just tweak mode_idx to default to turbo instead of moon. Then the modes would still be in ascending order, but it would just turn on to turbo.
Or even easier yet, you can just activate memory. No mods needed.
I only offer alternatives in case re-working LVP is not worth it to you.

Not that I’m aware of, but I doubt it would be difficult to create.

The main questions are what type of driver, and what type of switch?

There are already some smooth-ramping projects for e-switch lights, but I’m not aware of any for clicky switches. It seems like it should be easy to create something like this though:

  • If the button was long-pressed, start at moon and ramp up over several seconds. Save the level to a “noinit” variable every time it changes.
  • If the button was short-pressed, start at the last-used level and stay there.

So, if you pick it up and turn it on, it’ll ramp up from zero to max. If you quickly tap the button during that ramp, it’ll stop and stay at the current level.

When you say back to original you mean this?

How do you tweak mode_idx to default to turbo?
I really don’t know about programming, all I know is just a simple how to edit modes.

Also when the modes are like this

It doesn’t shut off at ADC_CRIT. Maybe because the 1st mode is turbo?

Try this:

Search for
#ifdef VOLTAGE_MON
change

to

That way LVP step down and shut-off should work with your mode set, at least I hope it does.

Wow! Chouster, you did it again. It works. Thank you very much. :+1:

Glad I could help. :slight_smile:

Isn't blf A6 bistro? Why reverse the ramps? Why not just set reversemodes to 1 by default instead? Or if you want, reverse the modegroups. Then you wouldn't need to modify the step down code, but whatever gets it done. I may be confused.

No, those are two entirely different firmwares. BLF-A6 is for t13 and Bistro is for t25, both written by TK.

I got the predecessor to Narsil still working on 13A's, but not with smooth ramping, but the modes work the same as Narsil mode sets - a twist on the Werner UI. Mine should be in the repository, not changed for couple years I'm thinking.

The UI is pretty similar, but blf-a6 was heavily refactored to make bistro and it needs a bigger MCU. It didn’t just add more options, it also changed a bunch of core logic. It made a lot of things easier, like reversing the mode order, but I don’t think it has been ported back to the attiny13 yet… except for biscotti, which is generally more like guppydrv than like blf-a6.

There might be an easier solution, but I don’t think an exact match exists yet.

Yeah, ok, I thought the code snippets looked pretty familiar, and yet different, then I did kind of remember that the attiny25 thread only started back in the summer or so (I think). It seems pretty hard to fit most of the mode logic into half the memory. I did try to really update/spring-clean the pre-processor configs in HD for pulling functionality in and out for various builds, but I'm not sure even with some of the new savings, if there's any way to get a build back down to that small as it stands now.