E-switch UI Development / FSM

I never had to use SOS in practice. But if one day I needed it, sure it will be good to have it in hand. :slight_smile:

Can you imagine an actual event where an emergency worker sees a strobing light, stops, watches it for a while and says - “whelp, I know it’s a blinking light out here where I don’t expect to see one, and I’m a lookin for a missing person, but that ain’t an SOS strobe, so theres no way I’m gonna check it out!”

A flashing light will attract attention. If it happens to be flashing out the current state of the battery, rather than slavishly repeating three dits, three dahs over and over, someone is going to count them and realize there is a pattern. Heck, even amateur radio has done away with Morse code requirements, most people are not going to notice it.

I would personally like to do away with SOS, I don’t minds police strobe, or biking strobe, and I use batt check a lot. SOS just seems like a gimmick.

UI (by Tamagotchi) that very popular in Russian forum.
From off:

sc- short click
lc- long click

1 sc – memored mode , (may be adjusted in menu)
2 sc – transition to turbo and back
3 sc – strobe mode. change of strobe modes by hold.
4 sc – lock – 1 mode (beacon off). Unlocking 4SC.
5 sc – lock – second mode (beacon mode is determined by its settings). Unlocking 4sc.
1 lc – moonlight.
Hold – change modes from the first (red) firefly, than moonlight and then Minimum> Medium 1>Medium 2>Maximum>Minimum>…
1Sc and hold – the battery indication.

from on

1 sc – turn off.
2 sc – transition to a turbo from any mode except the munlay. Repeated 2k – switch to the mode from which the turbo was switched on.
3 sc – the inclusion of strokes. Retrieval of strobe modes with hold.
1 lc – change mode to 1 mode down.
Hold – change modes from the main line up in a circle.
1sc and hold – scrolls down to the minimum mode .

That sounds like a Far Side cartoon!
I’m reminded of a early DX light I had that spelled out SOSOSOSOS.
If you really needed to signal someone you could just run your hand in front of the light and “tap” it out yourself.
To save you extra effort remember that mountaineering distress signals are simply groups of 3. Can be 3 anything, just something that stands out.
The Batt Check would work with a slightly depleted battery if you covered it up for the decimal readings.

“All it says is SSSSSSS, must be someone messing around”.

Awesome, that’s pretty close to what we came up with too, which is a good sign. It seems several people have independently created very similar e-switch UIs with roughly the same basic operation. This tells me it’s probably a genuinely good solution, one of the tallest peaks in the problem space, since people keep creating similar designs.

I wonder why big-name commercial lights are usually so different than this obvious solution.

That sounds more complex that I was expecting. How about if it was done from moonlight (I’m guessing that’s under 20mA in most lights)? Would that make it pretty simple to implement? Overnight moonlight is often useful in these cases too.

Do you think a half-sleep mode would use much less than 5mA?

I’ve actually got one of those mains powered “sunrise clocks” that are supposed to emulate the sun rising to help you wake up in the morning. The technique works (fairly well, at least) but instead of a gradual ramp it jumps up about 10lm of 6500K every minute (to about 100lm). I can imagine something like the D4’s ramp being much nicer. Having it in a flashlight would make it useful for camping and hotels too.

Really, I just want an excuse to buy the equipment needed to flash a driver :stuck_out_tongue:

Have you considered implementing PID algorithm for thermal control?

Copying and quoting from another thread, we have a perfect host for the above described light: The S42. I realize that the uC would need to be changed to an AT of some flavor, but perhaps by giving up in light charging we could gain enough real-estate to get the USB interface to function.

My S42 just sits on my desk at work, begging to be used, but the UI is just prohibitive.

Have you considered looking at the code? :stuck_out_tongue:

But joking aside, a wide range of things fall into the category of “PID algorithms” and it basically already uses one. It just has kind of a weird “I” term implemented as a lowpass or latch on the “D” term. And it’s heavy on the “D” term in order to predict temperature in advance to compensate for lag in measurement.

I’ve been meaning to try a version which uses an actual “I” term of sorts as its primary output, to see if it behaves any better, but I’ve been busy and the testing for thermal stuff always takes a long time.

Yes, a half-sleep mode should be well under 5mA. Hopefully well under 1mA, but I don’t recall offhand what the sleep mode power is with WDT enabled. The full standby mode is only like 0.02mA, which is nice, but it doesn’t wake up unless the button is pressed.

Using moon mode wouldn’t reduce power use. Idle mode with the MCU running is ~5mA, and moon mode is ~7mA. This means most of the power in moon mode is wasted just to keep the MCU running, not to make light. I wonder if there’s a way to reduce that without sacrificing any functionality… like maybe turn the ADC off most of the time, or run the MCU at a slower clock speed, or something.

I mean, if you wanted to combine the alarm clock with an all-night moonlight mode, that’s do-able right now with no plumbing changes. But the high idle power has been bugging me anyway, so I should try to fix it. And a half-sleep mode is probably worth adding to the toolkit.

It’s a good idea; I just need to add some extra plumbing to make it feasible without wasting lots of power. I have other plumbing to add too, like an option to use “short click, long click, or hold” instead of just “click, or hold”. That one is mostly for the Russian crowd though, since I haven’t seen that type of UI anywhere else.

If you need any reasons to get firmware flashing equipment, there are plenty of reasons at the links in my signature. :smiley:

But what does the “F” stand for?

Flashlight, of course.

Or whatever F word you feel like at the time.

Haha - that F* spaghetti monster.

But seriously cool stuff! Makes me want to pick up mcu coding.

How feasible is a Pi Zero flashlight? Other than a host to shove it in? The new ones even come with Bluetooth and wifi. All sorts of fun there.

One of my favourite E-switch UI is the Skilhunt H03.
From Off:
-one click: last used mode
-hold: lowest mode
-doubble click: highest mode
-hold more than x seconds: powers on moon then blinks and go to Lockout

In lockout mode : one click activete or deactivate the button lighting beacon flashing red led.

From ON:
-one click: go the next mode
-doubble click: change to other submode (every mode has two submodes and if you choose one the light will store it and you can adapt the mode spacing to your taste)
-hold: OFF

Some of the H03’s UI looks pretty similar. Some of the differences are interesting, while others are things I’ve been avoiding.

The clicks during lockout to change indicator LED behavior might be a good thing to keep in mind for later. I don’t have any lights with indicator LEDs and recent drivers, but as soon as I get a Q8 I’ll be adding indicator LED support to the toolkit.

Another thing which might be worth adapting is the hold-for-moon thing during lockout. Not sure if the H03 does that, but my Baton lights do. It gives nice feedback and doesn’t cost much power. Basically, lockout mode becomes sort of a momentary moon mode with four clicks to exit.

I don’t really care for “hold to toggle lockout” though, since that kind of thing can happen pretty easily by accident. I implemented it once ~3 years ago (hold for moon and continue holding to enter lockout), because I was cloning the Olight Baton UI. But since then I’ve gone for multiple clicks instead, to avoid lockout accidents.

On hot-running lights, people have expressed that “hold to turn off” is probably not a good idea, especially if the button is near the emitters. That didn’t go over well in the S42 and E14 II.

Edit: I added momentary (ish) moon to lockout mode. It’s not good for signalling, since it still needs to check for the 4-click exit action, but it’s still useful for quick tasks in the dark without exiting lockout.

I like your Ideas. Maybe for the hot light problem you can short click to turn off and hold to change modes like Sunwayman C22C. Or we are almost there at the ramping things which is better and no need for submodes.

A pi zero is pretty big and IIRC it uses significantly more power. It could be neat, but it’s total overkill for this purpose.

However, if things go well I might try making a pi zero-like driver for another project… I’ll need much more processing power than an attiny processor can handle, and probably more than an atmega, so something like a stripped down pi zero might be about right.

That’s only if prior projects go well though.

Yeah, for me I don’t really see a need to tell me I screwed the cap on. So many lights don’t have that, I’m just not sure how many users find it that necessary to have 2 bright blinks to say you screwed it on. I would at least love the optional choice if people do need it. We all have different needs and I know it is difficult. I appreciate the work and consideration. :slight_smile:

+1
I really like the H03 UI. It’s a very versatile UI (like the Zebralight…which I think you have a sort-of-copy version, Toykeeper?).

I like NarsilM, but I have two issues, both in the Mode set Operation:

1) Mode Lock
I’m not a fan of the light turning off when you click the switch after the light has locked in a specific mode. I just want to be able to make the light brighter immediately, not turn it off or make it dimmer first then brighter. If there was a “Mode Lock enable/disable” option, that would be great! I understand that changes the mode selection UI, but it would grant the user even more flexibility in use. I am constantly needing to change modes when using a light - it’s a necessity.

2) Long Hold (over 1.2s) for Strobe
I would LOVE to see this be a configurable option, allowing the user to choose between either Strobe or Max (of the selected mode set) when performing a Long Press.

I have read and re read and seen the topic went into details.
I can’t help but think I missed the core of the first three posts. A universal UI to be customized by all to their liking?
Diving into code is a huge step for me, with all the things I have too do a leap too much to ask and I am sure I am not the only one.
This FSM, could it be presented in such a way even newbies can set up a light, using some clever way of getting the desired modes in a light, by using say the LED as a receiving diode? FSM as a stand alone app?

+1 invitation remains open of course :slight_smile:

+1