E-switch UI Development / FSM

1034 posts / 0 new
Last post
primarycell
Offline
Last seen: 1 year 10 months ago
Joined: 07/24/2019 - 10:06
Posts: 15

d_t_a wrote:
hodor wrote:
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.

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..)

I want to highlight this comment. I agree that switching from smooth to stepped in Anduril is a bit too easy, and a 3H might help with that, and really like the idea of 3C as a shortcut to moon. That’s the shortcut to moon on an HDS, so it’s natural for me. I don’t know if there’s a feature vote option, but I think this idea deserves some thought.

bquinlan
Offline
Last seen: 2 months 3 weeks ago
Joined: 04/19/2018 - 01:07
Posts: 125
Location: Madison, Wisconsin, USA
primarycell][quote=d_t_a][quote=hodor wrote:
I want to highlight this comment. I agree that switching from smooth to stepped in Anduril is a bit too easy, and a 3H might help with that, and really like the idea of 3C as a shortcut to moon. That’s the shortcut to moon on an HDS, so it’s natural for me. I don’t know if there’s a feature vote option, but I think this idea deserves some thought.

I would be in favor of these changes as well.

gusto
Offline
Last seen: 4 months 6 days ago
Joined: 09/06/2018 - 11:29
Posts: 6
Location: Ukraine

primarycell wrote:
d_t_a wrote:
hodor wrote:
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.

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..)

I want to highlight this comment. I agree that switching from smooth to stepped in Anduril is a bit too easy, and a 3H might help with that, and really like the idea of 3C as a shortcut to moon. That’s the shortcut to moon on an HDS, so it’s natural for me. I don’t know if there’s a feature vote option, but I think this idea deserves some thought.

I tried to implement it yesterday, turned out pretty easy, although I don’t know if it’s such a useful feature for me… will test for some time. Anybody wants to test it with me – save this diff to anduril.patch file next to anduril.c file and run

Quote:
patch < anduril.patch
mattlward
mattlward's picture
Offline
Last seen: 9 hours 32 min ago
Joined: 06/19/2015 - 09:20
Posts: 3235
Location: Illinois, USA

I finally think I have Studio 7 ready to go, did a test complile on the latest Anduril with the config target being the D4V2. I finally managed to get the full repo on my windows 10 machine. But, at build it is complaining about a missing version.h file and a error in the make file.

The logged errors are:
recipe for target ‘main.o’ failed
version.h: No such file or directory

Indeed, I do not have a version.h file and I cannot find it on the repo.

When I click the main.o error, it loads the makefile and highlights this line…
@echo Building file: $<

Can someone point out what I am doing wrong?

UPDATE:
I did get it to build by commenting out this line:
#define USE_VERSION_CHECK

EDC rotation:
FW1A, LH351D 4000k (second favorite)
FW3A, LH351D 3500k
FW3A, SST20 FD2 4000k
FW3A, Nichia 4000k sw40 r9080 (favorite light!)
FW3A, Cree XP-L Hi 5A3
Emisar D4V2, SST20 4000k

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 10 min ago
Joined: 01/12/2013 - 14:40
Posts: 10804
Location: (469219) 2016 HO3
mattlward wrote:
Studio 7 … is complaining about a missing version.h file

Right, that file is normally created by the build script.

Since not everyone is using the build script, I added a default version.h file just now. It should clear up the compile error.

Anthon
Offline
Last seen: 7 hours 52 min ago
Joined: 09/07/2015 - 10:33
Posts: 669

I’d love to modify anduril to be like this

-4 clicks from OFF or ON: lockout
-4 clicks from lockout: disable lockout and turn on in last used brigthness

and as it has already been said: change 3 clicks from on to change from stepped/ramping to 3 clicks and hold

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 10 min ago
Joined: 01/12/2013 - 14:40
Posts: 10804
Location: (469219) 2016 HO3

hodor wrote:
Anyone know how to keep the switch / indicator LEDs the same brightness regardless of main LEDs? Specifically on a SP36. Currently the switch LEDs have low brightness while the main LEDs are in regulation and high when the FET is engaged.

Apologies if asked before, I searched and couldn’t find the answer. Also looked in the code and couldn’t find anything.

That’s in fsm-ramping.c in the USE_INDICATOR_LED_WHILE_RAMPING sections. It’s kind of a mess, honestly. I need to refactor that part of the code to make it cleaner in light of some recent additions.

hodor
hodor's picture
Offline
Last seen: 38 min ago
Joined: 07/11/2018 - 03:58
Posts: 1064
Location: UK

Ah I see it. Thanks TK Beer

So in order to keep the switch led on low, am I correct in saying that I can’t just un-define USE_INDICATOR_LED_WHILE_RAMPING but would need to set indicator_led(0)?

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 10 min ago
Joined: 01/12/2013 - 14:40
Posts: 10804
Location: (469219) 2016 HO3

hodor wrote:
Ah I see it. Thanks TK Beer

So in order to keep the switch led on low, am I correct in saying that I can’t just un-define USE_INDICATOR_LED_WHILE_RAMPING but would need to set indicator_led(0)?

Sorry for the delay.

I think you could probably just replace indicator_led((level > 0) + (level > MAX_1x7135)); with indicator_led(level > 0); . That should keep it on low whenever the main LEDs are on.

hodor
hodor's picture
Offline
Last seen: 38 min ago
Joined: 07/11/2018 - 03:58
Posts: 1064
Location: UK

No worries at all and thanks for the confirmation Smile

Light Veteran
Offline
Last seen: 3 hours 30 min ago
Joined: 10/17/2019 - 03:36
Posts: 96
Location: Italy

Is this the perfect location for speaking in general about the UI?
What I like or what I don’t like..
If not, please suggest me the right thread
Thank you

Flashlight addicted

Agro
Agro's picture
Offline
Last seen: 15 min 9 sec ago
Joined: 05/14/2017 - 11:16
Posts: 6868
Location: Ślōnsk

TK, I have my own branch with a number of commits. I’m new to bzr and it causes me a lot of troubles…
I’d like to upstream 3 minor tweaks. How do I organize the repo to do this well? Should I have a feature branch for each of them (note that the 2 smaller paches total 3 lines and the third is larger but nevertheless very minor)?

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 10 min ago
Joined: 01/12/2013 - 14:40
Posts: 10804
Location: (469219) 2016 HO3
Agro wrote:
I’d like to upstream 3 minor tweaks. How do I organize the repo to do this well? Should I have a feature branch for each of them (note that the 2 smaller paches total 3 lines and the third is larger but nevertheless very minor)?

There are lots of ways it can be done. The easiest is probably to just commit the changes, if you haven’t already. Then push the branch up to Launchpad. Or if you don’t have an account and don’t want one, you could send me a diff (or three diffs) or a copy of the branch.

If you have an account, it’d be something like this:

  • bzr commit
  • bzr push lp:~myuser/flashlight-firmware/mybranch

Then make a merge proposal on Launchpad, or otherwise let me know there’s a thing waiting for review.

If you don’t have an account but are okay with making one, it involves creating an account with a web browser, creating a ssh key, uploading the ssh key, then telling bzr to log in. The last two are done something like this:

  • ssh-keygen
  • (paste ~/.ssh/id_rsa.pub into Launchpad’s ssh key editor)
  • bzr launchpad-login myuser

I really should move things to github though, since it’s so much more popular and more actively maintained.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 10 min ago
Joined: 01/12/2013 - 14:40
Posts: 10804
Location: (469219) 2016 HO3

On a different note, I made a bunch of kernel-level changes recently, and published the code and .hex files today. It still needs more testing before it can be considered stable, so any help with that would be … helpful.

So far, everything seems good except that thermal regulation might behave a little differently. It shouldn’t be any different, but each test run produces slightly different results… so it can be a little hard to distinguish between an actual change and a random expected variation in behavior.

The changes include a complete rewrite of how interrupts work, plus a bunch of other changes to the plumbing for how FSM works. This makes it a high-risk change since it affects so many things. However, there shouldn’t be any visible differences in the user interface. If anything, the only visible difference should be a general lack of glitchy behavior. I fixed most of the race conditions and other inconsistencies which could occasionally happen.

Agro
Agro's picture
Offline
Last seen: 15 min 9 sec ago
Joined: 05/14/2017 - 11:16
Posts: 6868
Location: Ślōnsk

https://code.launchpad.net/~nisjuk/flashlight-firmware/nisjuk
Revisions 451, 452, 455 could be interesting for you.

Agro
Agro's picture
Offline
Last seen: 15 min 9 sec ago
Joined: 05/14/2017 - 11:16
Posts: 6868
Location: Ślōnsk

I did a bunch of changes to tweak the UI more to my liking.
I have one problem with it though – some configuration defaults don’t suit me (particularly aux LED config) and I don’t see a way to change it. Is there a good way to change the default config?

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 10 min ago
Joined: 01/12/2013 - 14:40
Posts: 10804
Location: (469219) 2016 HO3
Agro wrote:
https://code.launchpad.net/~nisjuk/flashlight-firmware/nisjuk Revisions 451, 452, 455 could be interesting for you.

Thanks, those look useful.

  • 451: Looks like I never tried building with sunset mode but no beacon. Oops. Smile
  • 452: Allowing the user to disable momentary mode at compile time is a good idea. I think it just hadn’t come up before.
  • 455: This is very interesting. Adding a -fwhole-program flag changes how the linker works, and appears to save a significant amount of space without changing any functionality. I’ll definitely be adding this, since it provides space to do other things people have been asking for. Smile
Agro wrote:
I did a bunch of changes to tweak the UI more to my liking. I have one problem with it though – some configuration defaults don’t suit me (particularly aux LED config) and I don’t see a way to change it. Is there a good way to change the default config?

I suppose it depends on what exactly you want to change.

I’ve been meaning to go through and make sure each of the USE_ flags can be set or unset in the config files. This would mean that, for example, people could copy cfg-emisar-d4sv2.h to cfg-my-emisar-d4sv2.h (or just #include the upstream one in the personal one) and then change whatever they want, producing a custom version without needing to make changes which could get overwritten by later upstream revisions.

For example, it might work to have a cfg-my-emisar-d4sv2.h which looks like this…

#include "cfg-emisar-d4sv2.h"
#undef USE_BIKE_FLASHER_MODE
#undef USE_PARTY_STROBE_MODE
#undef USE_TACTICAL_STROBE_MODE
#undef USE_LIGHTNING_MODE
#undef USE_BEACON_MODE
#undef USE_MOMENTARY_MODE
#undef DEFAULT_LEVEL
#define DEFAULT_LEVEL MAX_1x7135
#define USE_DEFAULT_AFTER_LOCKOUT

Or something like that.

If the UI options are desired on a bunch of different lights, those parts could go in a “my-cfg.h” and then include that in each custom build target, to avoid duplicating the same code a bunch of times.

Agro
Agro's picture
Offline
Last seen: 15 min 9 sec ago
Joined: 05/14/2017 - 11:16
Posts: 6868
Location: Ślōnsk

When I said config I meant “whatever is in eeprom”. It gets reset upon every flash – and to values that don’t work for me.
Though that custom cfg file is a good idea, more maintainable than what I’ve so far. Smile

SammysHP
SammysHP's picture
Online
Last seen: 8 min 53 sec ago
Joined: 06/25/2019 - 14:35
Posts: 1036
Location: Germany

You can set the EESAVE fuse so that the EEPROM is not erased during flashing. But then you have to make sure that the addresses of the variables stay the same.

Agro
Agro's picture
Offline
Last seen: 15 min 9 sec ago
Joined: 05/14/2017 - 11:16
Posts: 6868
Location: Ślōnsk

Thanks. Manual configuration every time I change EEPROM format is way better than every time. Though if there was an easy way to change the defaults – that would be great. Smile

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 10 min ago
Joined: 01/12/2013 - 14:40
Posts: 10804
Location: (469219) 2016 HO3

Ah. If you just want to change the default runtime configuration, like the stuff a user can modify by pressing the button, that can be done in the cfg-*.h file.

#define RGB_LED_OFF_DEFAULT 0x18  // low, voltage
#define RGB_LED_LOCKOUT_DEFAULT 0x37  // blinking, rainbow
Agro
Agro's picture
Offline
Last seen: 15 min 9 sec ago
Joined: 05/14/2017 - 11:16
Posts: 6868
Location: Ślōnsk

That’s it, thanks you Smile

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 1 day 15 hours ago
Joined: 03/24/2016 - 07:44
Posts: 9402
Location: Everything is brighter in Texas

Anyone know how to disable thermal control with anduril?

I can’t seem to change it even after following the manuals I have found.

I click 3x, then 2x, 2x, 2x, then 4x to get to thermal config according to this diagram: https://imgur.com/5H5CWjo

It gives me 2 menu option, then first I have tried everything from 1 click to 30 clicks. Then I just click the 2nd option 50-100 times to try to set the temp high enough it will never kick in. Yet it still kicks in almost instantly when the light is still cool to the touch.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 10 min ago
Joined: 01/12/2013 - 14:40
Posts: 10804
Location: (469219) 2016 HO3
Texas_Ace wrote:
Anyone know how to disable thermal control with anduril?

To completely disable it, compile with something like this in the config file:

#undef USE_THERMAL_REGULATION

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 1 day 15 hours ago
Joined: 03/24/2016 - 07:44
Posts: 9402
Location: Everything is brighter in Texas
ToyKeeper wrote:
Texas_Ace wrote:
Anyone know how to disable thermal control with anduril?

To completely disable it, compile with something like this in the config file:

#undef USE_THERMAL_REGULATION

Thanks, I might have to do that, was just hoping for a quick fix without having to take it apart.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 15 hours 10 min ago
Joined: 01/12/2013 - 14:40
Posts: 10804
Location: (469219) 2016 HO3

Otherwise, get it hot, calibrate the sensor to tell it it’s only 1 degree, and set the ceiling as high as it can go… 70 C or 40 clicks. That should give it a lot of headroom.

Not guaranteed to completely disable regulation, but it should at least reduce the chance of ever stepping down.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 1 day 15 hours ago
Joined: 03/24/2016 - 07:44
Posts: 9402
Location: Everything is brighter in Texas

Yeah, not worried about it never stepping down, it just steps down way too much right now.

Lexel
Lexel's picture
Offline
Last seen: 1 year 3 weeks ago
Joined: 11/01/2016 - 08:00
Posts: 5895
Location: Germany

I have now tried to get a new version of Anduril built

Problem No. 1 is that all the code is totally exploded with Java

Its so bad even Atmel Studio crashes, not even to think to get that anyhow converted to be compatible

Agro
Agro's picture
Offline
Last seen: 15 min 9 sec ago
Joined: 05/14/2017 - 11:16
Posts: 6868
Location: Ślōnsk

Looks like Atmel Studio bug.

Quadrupel
Quadrupel's picture
Offline
Last seen: 8 hours 5 min ago
Joined: 12/03/2017 - 10:40
Posts: 754
Location: Lithuania

Using your Atmel project, with last Anduril.c. All works. Must be your soft go mad

Pages