E-switch UI Development / FSM

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.

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

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?

Thanks, those look useful.

  • 451: Looks like I never tried building with sunset mode but no beacon. Oops. :slight_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. :slight_smile:

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.

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. :slight_smile:

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.

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. :slight_smile:

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

That’s it, thanks you :slight_smile:

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: Updated Anduril UI instructions for Aux LEDs - Imgur

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.

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.

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.

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

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

Looks like Atmel Studio bug.

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

seems save file as in the firmware trunk with right click does add HTML Java code
id the download button pressed only the Atmel code downloaded

Lexel, I don’t see any Java in your screenshot. Just HTML because you’ve saved the page instead of the file. Also please note that Anduril is not a single source file. It consists of multiple files in several directories. Use bazaar to clone the code and you won’t have such issues.

Now the firmware seems to blink out 28.9°C as 2 8 9 I don’t like, the MCU is very imprecise even when the room temp is set
it’s a wast of time to try to blink out another digit