NarsilM - configurable e-switch firmware for Multi channels, v1.3

Ok. Thanks Tom! I’ll let you know how it goes. If I have any trouble I’ll probably just go back to v1. I’m using it in the m3 clone and thinking about it, there won’t be any reflashing once the light is put together so I’ll need to trust whatever firmware I decide to use. :slight_smile:

Hhhmmm - might pay to wait til I try out a triple - think your M3 clone is a triple channel, like my M3. I got a couple test lights, easy to dnld to, like the SupFire M2-Z, SupFire L5, etc. Got quite a few lights running Narsil that are not so easy to dnld to, many have the old e-switch or early Narsil versions.

I still left some open issues on the triple channel ramping tables in my notes, but think I resolved those issues by re-gening the tables - not sure now. I know the mode sets for MODES operation are not the same as 2 channel setups.

Ya, I’m using a triple channel. 1+3+FET. I’ll try to pay attention to the possible problems. Actually, I think I’m going to build two drivers. One to test with and one for the final use. The final driver won’t be reflashable unless I solder leads to the MCU pins. Hmm? That would be possible but probably still easier to make two drivers. I’ll be able to use the extra driver in another light soon enough anyway.

So, I guess:

- momentary works only in RAMPING

  • you can use momentary if the lamp is ON or OFF

1 - Yes, for now, only accessible from ramping

2 - not sure what that means. Momentary/tactical turns the lamp ON and OFF - ON while holding the switch in, OFF when released. A lamp is the main LED or LEDs?

I don’t understand tactical mode.

After 5x clicks, can I push the button in morse code as fast, till the button melts?
To exit tactical mode I would unscrew the tailcap.

The % ist not clear, does that mean more than two clicks?
Is that another way to exit tac. mode?
But that would prevent fast morse code.

Toykeeper has in Andúril:
Momentary mode is permanent until power is disconnected.

What I mean is
The lamp is off: I click 5x and I am in tactical mode.

The lamp is switched on: I click 5x and I am in tactical mode.

Yes lamp is the main LEDs

"%x" must be a typo - as said in other places, it's "5X" clicks.

No bout the super fast morse code currently.

I see I'll have to remove the 2X clicks to exit tactical mode - way too easy to inadvertently hit, but the 5X is not as easy to trip up on. Dunno - maybe I could just remove the 5X click method to exit, then yes, it would work like Andúril then - power cycle to exit.

If this is preferred, it's basically removing code - easy to do.

Ok, understand now -- Yes, you can enter tactical mode via 5X clicks when the main LEDs are ON or OFF.

Also the 4X click lockout works with the main LEDs ON or OFF, as does 3X and 2X clicks.

Looks like there are two ramp table .h files. One for high performance lights(high power/output) and one for standard. No ramp tables for three channels in HP but three channels has ramp tables in the standard file. To throttle back the ramp ceiling looks like I would just chance ramp_size to less than 150?

Will there be troubles anywhere else if I change the rampsize to 200? I know I would have to make a number of changes to the start levels and also I will need to generate a new ramp table but other than that, looks like no other changes need to be made?

Oh, what sets the output value of the 2x click turbo? Is it hard coded to pwm 255 or is in codes to ramp max?

To clarify: what I’m thinking on doing is generating a ramp table to 225 levels using level_calc.py and then setting ramp_size to 200 or so. Then I would have a longer ramp time, ramp max level less than turbo, and turbo via 2x clicks? Is this correct? Sorry, lots of questions…

Yes - that should all work. The high performance files are for lights like the 27K lumens MT03 or 37K 18 XHP50 lights, so yes - don't use them.

Nowadays, 6K or 12K lumen lights are common -- go figure.

TK mentioned a limit above, forgot what the limit # was, and not sure where the limit is imposed - maybe in the Python script?

In your setups file, you need to have this set:

#define TURBO_LEVEL_SUPPORT // set if you want a max turbo level above the max ramping level

Then in the ramping tables file, you need to set RAMP_SIZE to 200, and generate the table for 225. So the last entry at 225 should be 0 for the 7135, 255 for the FET. You can delete all the points after 200 since they won't be used -- this will free up some space.

It's also important to set these in the ramping tables file:

#define FET_START_LVL 68

#define TIMED_STEPDOWN_MIN 115 // min level in ramping the timed stepdown will engage,
// level 115 = 110 PWM, this is ~43% (for 350's)
#define TIMED_STEPDOWN_SET 102 // the level timed stepdown will set,
// level 102 = 72 PWM, this is ~32% (for 350's)

I did everything you listed besides Define turbo level support and change the last entry to 0.
And I got the error messages below. So I’ll give it another try later tonight and do as you describe as I’m not at my pc now.

Actually, I am unsure about where to put the “0”. My 190th(I used 190 instead of 200) entry is 255,255,90. I also set all the last entries in mode sets to the same 255,255,90.

Do I need to have the 190th ramp level use only the fet? I would have to guess where it would mesh with the ramp. Probably around 145? Anyway, I need to try what you have said and see if my error messages go bye bye.

That should be defined in ModeSets.h:

// Common Output Settings:
#ifdef GT_BUCK
#define MAX_BRIGHTNESS 255,255 // for GT-buck
#define MAX_7135 255,25 // for GT-buck, about 117 mA
#define BLINK_BRIGHTNESS 100,25 // for GT-buck, about 50 mA
#define CLICK_BRIGHTNESS 50,25 // for GT-buck, about 25 mA
#define OFF_OUTPUT 0,0
#else
// output to use for blinks on battery check mode
// Use 20,0 for a single-channel driver or 40,0 for a two-channel driver
#define MAX_BRIGHTNESS 0,255
#define MAX_7135 255,0
#define BLINK_BRIGHTNESS 40,0
#define CLICK_BRIGHTNESS 20,0
#define OFF_OUTPUT 0,0
#endif

Ok. I’m sure there is a value there so that means I probably need to check my file path’s

I'm taking down the NarsilM v1.2 files - need to fix the tactical mode to ignore all fast multi-clicks: 2X thru 5X clicks. I'll post an update in a few mins hopefully.

:person_facepalming: I just managed to build a .hex file with my changes. let me know which files will need to be updated. :slight_smile:

Tom
please edit the typo in

from %X to 5X

This

is an option for compiling?

This [quote]

ADDED : (from MAD777, maybe others) if strobes are disabled, a 2X click from 2X turbo should restore the previous level you were at
[/quote]
does not replace the old: 1X for OFF and 1X for ON. It’s a second way to do it, when strobes are disabled?

Yes, max ramping is compiling option.

1x on and 1x off has not changed. If the user double clicks to get to turbo, this is saying he can 2x clicks to get back to the mode that was switched from.

Here's the latest NarsilM v1.2 files: https://drive.google.com NarsilM v1.2

You will find a readme.txt file listing the .HEX pre-configured files there.

The tactical mode is now invoked only from ramping from a fast 5X click with the main LED(s) ON or OFF. It can only be disabled from a power cycle. It is very quick, very responsive, and very fast clicks can be used even for a manual strobe.

There's still no updated manual. I still consider it a BETA release for testing.

Thanks Lightrider for your answers.

Nice Tom,
I hope someone can make use of it.

(I allways thougt the tactical mode for the BLF GT is when you use it as a mace)

So, lets figure out what to add for 6x clicks.
Maybe a staged ramp?
You enable two stops in RAMPING at ca.150lm and 1500lm with 6x.
So when you ramp with the main LED off:
Moon -> ramps up -> stops at 150lm-> you have to click&hold again -> stops at 1500lm -> you must click&hold again -> stop a max. brightness.
Backwards also two stops.
If you want get rid of this mode: 6x clicks and you are in normal ramping.

The two stops can be set while compiling.