E-switch UI Development / FSM

Thanks TK, I will give it a try :+1:

TK, do you have a suggestion as to what settings I should use for the BLF GT?

Iā€™ve just gotta have AndĆŗril in my GT when it arrives!

Thatā€™ll make nine lights running my favorite UI. :partying_face:

Oh, the GT will require some additional changes in order to work. Its power circuit functions somewhat differently than the Q8. Iā€™m hoping to get a GT and port FSM to it, but I have no idea when that will happen.

My GT should arrive in a few days.

Let me know if youā€™d like to borrow the driver / head / entire flashlight for ā€˜research.ā€™ :slight_smile:

I demonstrated a few of my lights at a party last night. The GT, Q8, Meteor, and Emisars were all big hits.

It was about 0Ā° F (ā€“18Ā° C) so thermal stepdowns were not an issue. :smiley:

About an hour later one of the kids announced, ā€œThereā€™s a flashlight going crazy outside.ā€

I had left my D4 outside on a windowsill in AndĆŗrilā€™s ā€˜Lightning Stormā€™ mode. :partying_face:

Managed to flash Anduril on my D4!

Thatā€™s the first time Iā€™ve ever modded a flashlight, so thanks ToyKeeper both for writing the firmware and introducing me to this exciting world.

Iā€™m keen to tweak the C and have a go at implementing some new modes. Iā€™ve that Iā€™m not an expert at soldering though and wouldnā€™t be surprised if I damaged the D4 if I tried doing it again.

Did I read somewhere that the Q8 can be flashed without needing to solder anything? That might be a good enough reason to get one if so.

Also, is there a definitive list of lights that work with Anduril? Iā€™m assuming anything with an e-switch and an attiny85 would work but itā€™s often hard to find out what chip a light has. Are there any C8 style lights that might work with it or is the D1s the closest thing?

This is going to get expensive now!

Congratulations! TK and AndĆŗril got me into reflashing too! :slight_smile:

My first-run and second-run Q8s both have wires long enough to flip the driver over without desoldering anything. Itā€™s an awesome light, too!

Iā€™m not sure if the current Q8s allow this. Perhaps someone with a recent sample can chime in.

In addition to the Q8s, I have AndĆŗril running on my Emisar D4, D1, and D1S. I also have it on a modded EagleEye X6R with a Texas_Ace driver from Lexel. The X6Rā€™s design takes advantage of AndĆŗrilā€™s dual-switch option, which works great.

Some more random observations and feedback, after playing with it for about a day:

  • bike flasher is excellent and means Iā€™ve technically saved money by buying a USB programmer and SOIC clip (compared to a dedicated bike light).
  • Momentary moon on lockout is handy and good makes the D4 kid-safe
  • Having 2 different lockout moons (from the 2 ramps) would be ideal
  • Adjustable party strobe level (eg using using memorized level or bike flasher level) would be a nice to have but realistically, the partyā€™s strobe wonā€™t get lots of use anyway
  • Good night mode being ramp-able, maybe having a config for time to off, would be another nice to have. I havenā€™t actually tried good night mode yet though.
  • A good morning / alarm mode would be very cool. I know thereā€™s issues with power usage though.

Thanks. I guess if longer wires can fit then you could always do a one-off resolder for longer wires if needed. Iā€™d give that a go on my D4 but I doubt thereā€™s space and thereā€™s a good chance Iā€™d damage the driver.

The X6R looks nice. With the cost of getting a new driver for it the D1S looks quite reasonable though.

So far, only a single e-switch is supportedā€¦ with the option of also using a power switch to make it do momentary-style use in the regular output mode (no need for a separate momentary mode). Without an e-switch it wonā€™t do much.

Two different lockout moons is easy to do; it mostly just depends on whether people think itā€™s better.

Adjustable party strobe brightness is a little tricky. The pulses are generally only ~4 PWM cycles long. It turns on for 4*512 clock cycles, then turns off. If the brightness is adjustable, itā€™ll actually pulse 4 times per strobe instead of once. Thatā€™s not ideal. Of course, the method Iā€™m using for short strobe pulses already isnā€™t ideal. Iā€™ve been meaning to make it control the power chips in more of a raw mode, on for N clock cycles instead of N/512 PWM cycles, but that adds code complications because it bypasses the abstraction used to control output brightness. So it locks brightness to a sweet spot on the ramp where PWM is steady, and sometimes stays lit for 4 cycles or sometimes for 5, depending on random factors.

Anyway, um, kind of a long tangent, but party strobe has some known limitations which arenā€™t trivial to fix.

Making the sunset mode adjustable, and adding sunrise mode, seems like a better thing to prioritize.

The D1S is an amazing bargain.

I built my X6R before the D1S was available. The smooth, tapered shape is a bit more ā€˜pocket friendly,ā€™ and like using it with the tailcap switch for momentary turbo while hiking with a headlamp.

If I had to choose between the X6R and D1S, Iā€™d choose the D1S. :partying_face:

BTW, I posted some beamshot comparisons of the X6R, D1, D1S and a few other lights when my D1S arrived.

What light will you be using on your bike and how will you mount it?

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.