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

I had a similar issue myself that took while to figure out. Indoors I couldn’t get the bug, but outside it stepped down (it was below 0°C outside, and not very warm inside the hut). At first I didn’t know why it stepped down so I programmed a separate step-down blink for voltage and temperature, and also if level is critical or not. It turned out that my issue was that when the readout goes below 0, the unsigned integer roles around to 255, causing the software to think the light is burning up at 255°C. Maybe similar issue you are having?

So I just removed role around to 255 on my 85 based drivers. I was low on space so I didn’t implement negative readouts. Now that I have double the space I’m considering implementing negative readouts, because sometimes I use my bike light to see approximately how cold it is when cycling in the winter. As it is now I can see when it’s below 0°C, but not how much below.

I think that ToyKeeper has mentioned something about negative temperature fix for RampingOS.

If I recall correctly, I did fix this in RampingIOS… but I completely removed and replaced all the thermal code there. The patch wouldn’t really apply to NarsilM, since the two projects have both diverged significantly from their shared ancestor. The RampingIOS patch could still be a general guide for implementing something similar in NarsilM though.

I can’t really apply the code from FSM / Anduril either since it has no common ancestor at all, and virtually no code which overlaps with Narsil.

At a quick glance, NarsilM seems to be using a uint8_t for its temperature value, so it can’t represent anything colder than freezing. It also appears to use a uint16_t for the initial raw value, from which it subtracts 275, which could set the value to 65,5XX during cold weather.

To fix only the negative temperature issues, it might work to simply use signed 16-bit values for all of this, and maybe add some checks to make sure it’s above 0. But I’m just guessing.

Add a default offset like 50. Then an unsigned integer can represent –50°C to 205°C. Should be enough.

Hi Tom,
some suggestions for the next version of NarsilM.

I would suggest to double the time to enter settings. From 8 seconds to 16 seconds or 20.
(Edit: The 20s would interfere with the jammed button protection)

And change the clicks for RAMPING and MODES in the settings.

Here has one and his friends problems. They accidentally end up in the settings aka wild blinks.
alternety, one of his later posts: Q8, PMS SEND TO THOSE WITH ISSUES BLF soda can light - #16932 by alternety

I think he has a point making NarsilM more robust against wrong operation.

If I handle someone the light I tell “don’t press for longer than 8 seconds”.
I think extending the time can help. The only backside would be if some switches often between MODES and RAMPING. But I guess most stay in one UI.

I guess you used 8sec to be able to switch quickly between RAMPING and MODES.

The sequence to change is:
Hold the button till it blinks the first settings, then one or two clicks and then hold the button till the lamp confirm with four blinks.

In retrospect I think it would also better to change the first setting to
1 click = RAMPING
2 clicks = MODES
Today it’s reversed.
Only for the reason RAMPING is mostly used and people try to switch off the lamp if it starts blinking.

I found a review with another grafik of the UI from NarsilM v1.0
[Review] Thorfire BLF Q8 ... 5K lumen designed by FLASHAHOLICS! | Candle Power Flashlight Forum!

changing the 8 to 20 seconds is just one line in the Narsil.c file

CONFIG hold - if it is not locked out or lock-out was just exited on this hold
//———————————————————————————————————————————-
if ((byLockOutSet 0) && !momentaryState)
{
if ((!ramping && (wPressDuration CONFIG_ENTER_DUR) && (fastClicks != 2) && (modeIdx != BATT_CHECK_MODE))
||
(ramping && (wPressDuration == 500))) // 8 secs in ramping mode

same for Modes to extend 2.5 to more in the setup file
#define CONFIG_ENTER_DUR 160 // Config mode entry hold time - 160=2.5s, 128=2s

I got a problem changing Output pins

I changed the register and PB port in the register settings but it does not work
It seems I have to change something in the channels.h file as well, but that code does not really make sense to me so I cant change it

How to remove momentary mide in narsil code?

Can I have different stepp downs for
RAMPING (e.g. timed 3min) and MODES (e.g. temperature step down) ?

Or different times for the step down?

Joe

Yes.

If you are in ramping, hold the button for 8 seconds until you get to the settings configuration.

There is going to be this array of options:

1. 2 quick flashes, 1 slow flash = Mode set(1 click), ramping (2 clicks) Do not touch. Wait until it goes to the next mode below.

2. 2 quick flashes, 2 slow flashes = Moonlight levels. Do not touch. Wait until it goes to the next mode below.

3. 2 quick flashes, 3 slow flashes:

- 1 click = Stepdown disabled. Not recommended.

- 2 clicks = Temperature stepdown. Goes to max, and then you click the button when the flashlights is too hot for you to hold it.

- 3 clicks = Timed. Then your press according to the time you want it to step down at:

1 click = 60 seconds.

2 clicks = 90 seconds.

3 clicks = 120 seconds.

4 clicks = 180 seconds.

5 clicks= 5 minutes.

6 clicks = 6 minutes.

I’m almost certain the answer is no. When you set the step down in ramping it automatically carries over to the mode sets and vice versa. So I don’t think there’s any way you can separate them. Besides, I’m not sure why you would want different step-downs between ramping and mode sets in the first place.

Is it possible for dual switch lights to make the side button only switch modes so the light can opnly be turned off with tail switch?

The reason I ask is, I found an older entry on the german forum where it should work.
He said he has in one moon aktiv in the other not.
I never tested it and have also doubts, so I asked here

Maybe he mixed sth. up

Joe

I’ve never tested it either. I’m not a fan of mode sets and never use them.

I can’t test it right now, so maybe someone will try or maybe TK will know.

(It’s also important to specify which version of Narsil your using as they each have small changes. It looks like he’s talking about NarsilM v 1.0.)

Yes, it should be NarsilM v1.0 . He bought a stock one.
It’s midnight here I don’t test anything tonight, sorry :slight_smile:

No.

Looking at the code, it has only one value which is shared across both. Tom documented it in the comment for SaveConfig():

/**************************************************************************************
* SaveConfig - save the current mode with config settings
* ==========
*  Central method for writing (with wear leveling)
*
*  config1 - 1st byte of stored configuration settings:
*   bits 0-2: mode index (0..7), for clicky mode switching
*   bits 3-6: selected mode set (0..11)
*   bit 7:    ramping mode
*
*  config2 - 2nd byte of stored configuration settings:
*   bit    0: mode ordering, 1=hi to lo, 0=lo to hi
*   bit    1: mode memory for the e-switch - 1=enabled, 0=disabled
*   bit  2-4: moonlight level, 1-7 enabled on the PWM value of 1-7, 0=disabled
*   bits 5-7: stepdown: 0=disabled, 1=thermal, 2=60s, 3=90s, 4=2min, 5=3min, 6=5min, 7=7min
*
*  config3 - 3rd byte of stored configuration settings:
*   bit    0: 1: Do OFF time mode memory on power switching (tailswitch), 0: disabled
*   bit    1: On Board LED support - 1=enabled, 0=disabled
*   bit    2: Locator LED feature (ON when light is OFF) - 1=enabled, 0=disabled
*   bit    3: BVLD LED Only - 1=BVLD only w/onboard LED, 0=both primary and onboard LED's are used
*   bit    4: 1: moonlight mode - 1=enabled, 0=disabled
*   bit  5-6: blinky mode config: 1=strobe only, 2=all blinkies, 0=disable
*
**************************************************************************************/

Yes, but I don’t think the repository has anything like that yet. A new UI would need to be created.

Thank you for your clarification, Toykeeper!

Good night