E-switch UI Development / FSM

I used the D4 today on the road. Pointed down almost 45° as it’s so floody. Mounted on one of these but I’ll probably order a more lightweight clip.

I’m considering getting a D1S or Q8 though, as the D4 is currently my farthest thrower. Just need a good excuse to spend the money!

Both are good, depending on what you need. One of the main things is to match the beam type to what you’re doing.
From floodiest to throwiest:

  • D4: ~4 cd / lm
  • Q8: ~12 cd / lm (?)
  • D1: ~30 cd / lm
  • D1S: ~100 cd / lm

For biking I use a very floody light like the D4, and I find the D1 is usually throwy enough for my needs when I need to see farther. The D1S and Q8 are also very good at what they do, but I don’t use them as much because of the size.

Then again, size isn’t always a deal-breaker. I might have a BLF GT on the way (~500 cd / lm), which totally dwarfs all these other lights. It won’t exactly be an EDC, but I’ll make excuses to use it… because that’s just the kind of item it is. :slight_smile:

FWIW, I pushed a bunch of changes to FSM / Anduril. A lot of things should be nicer now, but there’s one specific thing I haven’t tested yet and don’t trust. On a hotrod like a D4-219c, I don’t think it’ll regulate down fast enough on full turbo. However, it did pretty well on my FW3A at the highest regulated level, 8x7135. I need to do more testing and tweaking to make sure it won’t burn people with a quad 219c though.

FSM dev branch, getting closer to stable so maybe I can merge it into trunk soon.

Changes:

  • Made eeprom writes somewhat more atomic, less likely to do weird things if power is interrupted mid-write.
  • Added a super-simple muggle mode. One level, 150lm, click on/off. Has LVP.
  • Added candle mode, next to lightning mode. Is particularly nice in the bathtub.
  • Added FW3A support.
  • Made lockout moon level use current ramp config instead of whichever ramp is lower.
  • Completely reworked button debouncing so it’ll be okay even on a really noisy switch.
  • Fixed LVP / thermal issues (ADC was triggering 4000X / second instead of the expected 4X, which made things weird).
  • Thermal regulation changes…
    • Instead of ~85 steps, it now uses 256 or 512 (for a 2- or 3-channel driver). This makes adjustments invisible by eye, but they still show up on a lux meter. Try zak.wilson’s ceilingbounce app if you want to measure it.
    • Won’t adjust below 1x7135 level any more.
    • Adjustment speed changes with how far it needs to go.
    • Added the ability to calibrate the thermal sensor, to reduce issues from the attiny’s per-unit variation.

… and I updated the UI diagram a bit:

The thermal config generally involves a lot of clicks… sorry. Hopefully it only needs to happen one time though, to calibrate the sensor.

Great! I’m gonna update one of my Q8s to give Candle Mode a test. :slight_smile:

Did you mean to use this link?

It’s been several months since I reflashed a driver, and I’m still a noob. I’m using my notes to compile Anduril, but am running into 300+ errors.

The first is in Makefile line 79 “recipe for target ‘main.o’ failed”.

The next few errors are in main.c in lines 11 to 14 that seem to be caused by some references to folders and .png files in the repository.

The rest are in main.c lines 1500 to 3000 and are “stray ‘#’ in program” errors.

It seems I have a fundamental issue with my workflow, but as I mentioned, I’m a total noob.

Are my errors due to some change in the organization of code and header files? I see that Anduril.c has lots of stuff up top that wasn’t there before. :laughing:

I haven’t actually tried to build anything in Atmel Studio. It might be easier to use a build I made for Dale.

http://toykeeper.net/torches/dbcstm/anduril-d4.2018-01-24.hex
http://toykeeper.net/torches/dbcstm/anduril-q8.2018-01-24.hex

Anyway, I made some videos showing some of the fancier modes.

3 minutes of lightning storm mode:

3 minutes of candle flicker mode:

Play both videos at the same time if you want to simulate taking shelter by a fire while a storm goes by. :stuck_out_tongue_winking_eye:

Thanks!

I’ll keep fiddling with AmtelStudio. I’ll report back if I end up with a successful build.

I’ve had some success getting closer to a build!

Turns out I mixed up some header files and somehow got an anduril.c file filled with XML code. :person_facepalming: No wonder it looked so different! :stuck_out_tongue:

At this point I’m getting an error indicating that “region ‘text’ overflowed by 154 bytes” when attempting a build for the Q8.

The only changes I’ve made were to comment out the blinks at ramp floor, ramp ceiling, and channel boundaries.

I had that same “region ‘text’ …” error when trying to compile Narsil a few months ago. If I recall, changing the configuration from “debug” to “release” solved the problem. Must be some strange accidental modification in the config manager. Perhaps debug isn’t using any optimization?

FWIW, I’m also having trouble building Anduril in Atmel Studio 7. I might be overlooking something obvious, but I have all of the dependencies in place, and the only change I made for this first test was a #define for the hardware type.

All the settings I use are in the bin/build-85.sh script. In theory, it should work by plugging those values into Atmel Studio, but I’m not sure where it puts them.

Exactly, and particularly no size optimation in stock configuration. This is the purpose of debug mode.

Success! My Q8 is happily running Candle Mode in celebration. :partying_face: Thanks for the tip!

Thanks again to ToyKeeper for the excellent Andúril UI, and for the ongoing improvements and tech support. :+1:

When flashing the Emisar D1 and D1S, should I use the ‘#define FSM_EMISAR_D4_DRIVER’ line? How about on an EagleEye X6R running a Texas Avenger driver and single emitter? I think the version of Andúril I’m running on them now predates the driver options.

I’ll wait to reflash my D4 until you are more confident in the thermal regulation. :slight_smile:

Looks like all of those settings match what AS7 is doing already, but there are a lot of errors to sift through. Something tells me my linker is missing some random flag, etc. The strange part is that I’ve been able to compile all of your other firmwares that I’ve tried straight OOTB. I’ll have to dig a little deeper later on, but in the meantime the Q8 *.hex works great! I really like that anyone who picks it up can intuitively use the light, but more interesting features are hidden. A very nice analogue to Bistro’s Muggle Mode.

No problem!

The D4, D1, D1S, and D4Ti all use the same driver. The #define for the D4 will work for all of them. The TA uses 3 power channels, so the #define for the FW3A might work.

Edit: formatting

Andúril’s five-click Momentary mode is awesome, especially because you can’t exit accidentally. I use it frequently on my Emisars and Q8s.

Last September, ToyKeeper added dual-switch support to Andúril. I’ve generally avoided dual-switch lights, but Andúril makes them awesome.

It’s been working great on my EagleEye X6R with a forward-clicky tailswitch and a TA driver piggybacked onto the stock driver PCB.

I hike with a floody headlamp on and a small thrower at the ready. Momentary is perfect for identifying trail markers, landmarks, and the sources of spooky noises. :smiley:

With two switches, momentary brightness can be adjusted on the fly instead of exiting momentary, changing the output level, and re-entering momentary.

Activating the tailswitch while holding the e-switch overrides memory and turns the light on in moon.

I’ve noticed that the indicator LED on my Q8 doesn’t illuminate while the light is off in momentary mode.

Should momentary share the indicator LED setting for lockout?

BTW, Candle Mode is very convincing! I’ve been enjoying it on a Q8 with a yellow spray-paint cap acting as a diffuser. :smiley:

That’s a good question. Should momentary use the same setting as lockout? Would it bother the tactical crowd to have a glowing button interfering with their stealth in momentary blast mode?

TBH, I don’t know who uses momentary mode or what their needs are, so any light people can shed on the topic would be helpful.

Hmm, I hadn’t considered that.

I’ve used momentary for light painting, where an indicator would actually be a bad thing.

I often use momentary on a second light while hiking with a floody headlamp.

I sometimes enable momentary when lending lights to young users. I can set the output based on the situation, and it prevents a light from being left on unattended. Kids seem to enjoy ‘manual strobe.’ :laughing:

Perhaps there could be separate indicator settings for:

  • off, normal operation
  • off, momentary mode
  • off, muggle mode
  • off, lockout mode
  • on, any mode

This is getting out of hand pretty quickly. The indicator config would need its own UI diagram. I think you also mentioned the possibility of a blinking/breathing indicator at some point… :smiley:

OTOH, I’d be happy with indicator settings for just two states, main emitters on and main emitters off.

ToyKeeper, I am loving Candle mode! I keep a Q8 with a diffuser burning on the coffee table in the evenings.

Would it be possible to add a sleep timer to Candle mode? I’d love to use it on my nightstand and while camping.

Ideally, it would retain brightness adjustment and run for an hour before simply ‘burning out,’ rather than dimming gradually like Sunset.

Perhaps it could be named Votive, Tealight, or CandleStub? :smiley:

Hmm… timed candle mode might be interesting. It wouldn’t be easy to make it dim over time, since it fluctuates across a fairly wide range and the low end doesn’t have sufficient resolution, but it could still stop more abruptly after a while.

The main difficulty there is just whether to spend the extra bytes or not.

Perhaps I could refactor some code to make all config-type modes use a single function and thus be smaller overall. This would free up space and reduce the cost of making modes configurable. Probably not today, but I’ll put it on the list…

Yes, abruptly ‘burning out’ is what I was thinking.

I meant it’d be neat to retain Candle mode’s adjustable flame brightness without interfering with the countdown.

I’d be the envy of the camp with a diffused light hanging over my hammock burning Candle mode with a sleep timer. :smiley:

Great! Can we have a peek at what else is on your list? :partying_face: