E-switch UI Development / FSM

my customer wanted anyway a higher setting of low if its not possible at all the whole thing changes

I want simply the low mode removed from UI then

In Anduril, is there a shortcut to moon/floor when the light is on? Apologies if this has been asked/answered before, I searched and couldn’t find an answer.

Not when the light is ON.

But switch OFF and then hold works.

Thanks Joe. I may look into adding a shortcut. I’ve got so used to my main edc with shortcuts to low and high I feel a bit lost without it!

And ramping down is too slow?
That is click, hold

No, I would just prefer a shortcut.

If you’d like to see what I consider very well done shortcuts to get some ideas have a look at this code by tterev3 here.

Edit: that’s not the right code, let me look…
Edit 2 Bad news, I’ve located the file I’m talking about on my computer but there’s a typo in the header of the file (actually right in the GPLv3 wording) so I’m not comfy posting it, sorry.
If you’d like to try to locate it on your own on tterev3’s blog or whatever it’s called “Ultimate Flashlight Code” for the PIC 12F617. Do note it’s written in PIC assembly language so you cant just copy/paste, again I’m only bringing it up as an example of well implemented shortcuts.

First you set your main shortcut level (with some clicks, don’t remember it exactly anymore) which you could set to low or whatever ramp position you wanted. Then a double click from anywhere takes you to that saved position, then a double click from there takes you to turbo or a click hold takes you to moon. Or something like that. I can’t remember for sure what’s what but it’s the best implementation of shortcuts that I’ve ever seen!

Thanks CK, I’ll take a look.

I had a quick look at the Anduril code last night and was thinking of implementing it into the 3 clicks in steady state and changing the mode switching to 3 clicks and hold. Or vice versa.

I’m just not sure if it’s worth it as I would need to re-implement every time there’s an Anduril update I want to flash - not sure if / how often this would happen though.

My main EDC is a Nitecore D10. I’ve been using it almost daily for the past 10 years and it’s still going strong. Shortcut to turbo is double click, moon is double click and hold on second click. Ideally I’d like this as I’ve been so accustomed to it but looking at the code and playing with the UI I can see why this probably won’t be possible.

That’s what “bzr merge” is for.

Basically, branch a copy of trunk from upstream, and leave it alone aside from occasionally using “bzr pull” to grab the latest changes. Then “bzr branch” trunk to your own personal work space. Make the changes you want there. Use “bzr commit” to check them in. Afterward, after doing a “pull” on trunk, you should be able to go into your dev branch and “bzr merge …/trunk” to integrate the latest upstream changes without clobbering the modifications you made locally. Then of course “bzr commit” after the merge.

It should work seamlessly as long as the upstream changes don’t affect the same lines you changed locally.

A shortcut to Moon mode when in the ON state seems to be nice.

(In Anduril), I feel it’s a bit too easy to switch from stepless to stepped ramping modes (usually I don’t need to keep changing from stepless to stepped mode…, so maybe your 3-clicks+hold might work…)

Why do you want a shortcut to MOON from ON?
I think comming from a brighter setting I already lost my night sight?
(I am not against it, just curious)

Thanks TK, completely forgot it was all source/version controlled!

Because I need MOAR! It’s mainly habit I guess, I like being able to go directly and precisely to moon without having to switch off first. Also I find switching on (from off) to moon is unreliable, sometimes I’ll get moon and other times I’ll hold the button too long and it’ll start ramping. This is not a criticism of the firmware and is definitely a user issue but having a shortcut would eliminate this possibility.

It’s nice to have the option of switching modes but personally it’s not something I’ll be doing often. If I was going to change it I’d move smooth/stepped mode switching out the way to 5 clicks (or more) and put moonlight on 3 clicks. 2 clicks and hold could then be used for going to moon and ramping up if desired.

However… I’ve been defeated by Atmel Studio, getting a ton or errors and can’t compile so doesn’t look like I’ll be making any changes any time soon :frowning: .

If you have Windows 10, I highly recommend the Linux subsystem for windows. It makes recompiling a breeze.

Success!… I think. I made a few changes to anduril.c and called build-all.sh. Below is an excerpt for the D4S. I didn’t receive any errors so I guess it’s safe to flash?

= emisar-d4s =
bin/build.sh 85 anduril -DCONFIGFILE=cfg-emisar-d4s.h
avr-gcc -DCONFIGFILE=cfg-emisar-d4s.h -Wall -g -Os -mmcu=attiny85 -c -std=gnu99 -DATTINY=85 -I… -I…/… -I…/…/… -fshort-enums -o anduril.o -c anduril.c
avr-gcc -Wall -g -Os -mmcu=attiny85 -o anduril.elf anduril.o
avr-objcopy —set-section-flags=.eeprom=alloc,load —change-section-lma .eeprom=0 —no-change-warnings -O ihex anduril.elf anduril.hex
Program: 7356 bytes (89.8% Full)
Data: 247 bytes (48.2% Full)

I bit the bullet and flashed it. I’m happy to report it works! Having a shortcut to moon is great (for me). There’s also the added benefit that in stepped mode, moon is still accessible regardless of the floor level.

I couldn’t get anything to compile in Atmel Studio so ended up installing the Linux Subsytem (thanks to nick779 for the suggestion!). This worked great for compiling but it couldn’t detect any USB devices, including the programming clip, so I ended up flashing in Windows 10 with avrdude.

I’m happy to hear that someone who has never done anything with AVR devices before can modify the interface and have it work on the first try. :slight_smile:

The Windows issues are unfortunate, but there’s not much I can do about that. It’s nice that they finally added Linux containers though, so Linux userspace tools can be used. It really helps a lot for stuff like this.

Oh it definitely wasn’t on the first try :blush:

FSM made it easy to make the required code changes though :+1:

Could someone walk me through making a new HW_config file? I tried yesterday and couldn’t ever work through the errors, I had to edit an existing config file and use that.

I created the file then added it to the project then added the #include to anduril.c but it comes back with a laundry list of errors as of no HW Config is selected at all.

If you have a unix-compatible OS or the Linux subsystem for Windows, it should be pretty simple — add a cfg-something.h file and then run “make” or “build-all.sh”. It should notice the file and automatically treat it as a new build target.

If the build system doesn’t automatically pick up new cfg-*.h files, pull in new changes from upstream. It’s a thing I added somewhat recently.

As for what to put in the file, mostly just copy/paste the parts of other files which are relevant to what you’re making. I have it split out into separate files for app config and hardware layout, but that’s not strictly necessary.