E-switch UI Development / FSM

@Toykeeper

I redid the Andúril UI graphic a bit.

  • changed the green single lines to double lines.
    If the UI is printed only in black and white you can’t distinguish the green with black/grey. With double lines you can
  • added “switch between ramps”
    people seems to overlook the triple click
  • Ceil and floor lines extended to right.

I sent it to …

Can you please comment if good or bad?

Joechina

I got problem calibrating Ramping IOS v3 voltage readout for GT build

in the hwdef-BLF_GT.h file there is
// Raw ADC readings at 4.4V and 2.2V (in-between, we assume values form a straight line)
#define ADC_44 186
#define ADC_22 92

but changing those value does affect the rerading not a bit

Im pretty sure that Anduril and RampingIOSV3 only use the VOLTAGE_FUDGE_FACTOR to adjust the calibration. Ive paged through the ADC files for compiling fsm and didnt see a reference to those values from what I remember.

still this does not help me to adjust it, as this code does not explain anything how it works where to adjust if needed
its really poor there is no adjustment like in Narsil for Diode or multiple cells if the reading is off

OK I found the parts for temp and voltage adjust, but they are hidden deep in the code not in the setup files

I got now BLF GT IOS v3 flashed on a GT, but the switch LED is permanently on

Depending on the config, that’s normal.

You need to “#undef USE_INDICATOR_LED_WHILE_RAMPING” to get the behavior of the Emisar D4S

Default locked: blink
Default off: low
Default on: following the ramp level low/high

Undef locked: same
Undef locked: same
Undef on: indicator LED off

Thanks! I have it on the list of patches to apply… I’ve just got a big pile of tasks to finish lately so it’s taking a while.

I believe you just add that line in the blfgt.cfg file. Its in the anduril directory I think.

You add VOLTAGE_FUDGE_FACTOR # and the number is equal to the offset in voltage reading in increments of .05v.

So VOLTAGE_FUDGE_FACTOR 5 = add .25v to the reading.

Ive noticed that the reading is sometimes inaccurate across the entire voltage range, so I recommend doing the reading and calibration near 3.3v. Better to have the low voltage right than full capacity readings spot on.

It has two supported ways to adjust the voltage readings. One is the diode drop adjustment or “fudge factor”, similar to Narsil but it goes by 0.05V increments instead of 0.10V increments. The other is the voltage divider method, where you calibrate it by configuring the ADC readings it should expect at 2.2V and 4.4V per cell.

For a driver with a voltage divider, use the voltage divider method. The diode drop bit won’t work on those.

Normally, it should be sufficient to copy/paste an existing configuration, like the BLF GT files, and then edit the values. But if one wants to dig through the code, the recommended tool for finding references in the source tree is “rgrep” or “grep -R”. This should work in almost any Unix-like OS, including OSX, or in an Ubuntu container in Windows. I’m not sure what the equivalent would be in an all-Windows environment though.

It might be helpful to flash a pre-built version on a supported light, to use as a reference while learning how it works. There is also some documentation available.

TK,

Is there a “guide” on how tint mixing is supposed to work? I built and flashed the tint mixing branch onto my Anduril Candle with two channels, one 1800k and the other 5000k and it starts out with the 1800k only and then at the top of the ramp the 1800k is still bright as can be and the 5000k is some fraction of its total brightness and a fraction of the brightness of the 1800k. the 1800k channel is run by a single 7135 and the 5000k channel is run by two 7135. I would think at the top of the ramp the 5000k would be on max by itself and it would be brighter than the 1800k channel ever was (because of twice the 7135).

Is my understanding of how this works flawed?

The tint mixing attempts to keep constant brightness when tint changes, and keep constant tint when brightness changes. It also assumes both power channels have the same maximum brightness.

If you used red and blue LEDs, the available color space would look like this… and it should allow you to move vertically or horizontally through the color space. Vertically with a regular “hold” to ramp brightness, and horizontally with a “click, click, hold” to ramp the tint:

It sounds like you’re ramping vertically, and want to ramp horizontally instead.

Tint resolution depends on the brightness though. Because at PWM level 255, there are 256 different possible tints. But at PWM level 5, there are only 6 possible tints. The tint gets coarse on low modes. If I zoom into the bottom 16 levels of the diagram above, then increase the brightness to make it easier to see, the coarseness toward the bottom becomes more visible:

For example, at brightness level 4/255, there are 4 units of brightness… and they can be allocated to the power channels in only 5 different ways: 4+0, 3+1, 2+2, 1+3, or 0+4.

Thanks,

Seems like my question ended up being a UI question. It all works perfectly. This is awesome. I cannot wait for the full BLF Lantern now. :slight_smile:

The video roughly shows

Visually for me it makes sense to ramp it all the way to the top then pick where I want the CCT because of the decreased resolution at the low modes and because it is simply brighter and easier to tell. This is another homerun you hit.

I’m glad it’s working! Also, I’m anxious to get a BLF Lantern, since I don’t actually have any Anduril lights with tint ramping yet. The code was written and tested on an Emisar D4, and I haven’t gotten a chance to test it with actual warm/cool emitters yet.

At some point, I should add the auto-tint mode where it’s warm at low levels and cool at high levels, but I haven’t decided on some of the details yet.

I ordered a ton more boards to build some more of these. I am not sure if you are interested, but I can send you one as a thank you. While not a full fledged BLF lantern it is still quite fun.

Is there a way to dnld a full branch in launchpad? Would like to dnld the fsm branch as-is. Only way I know of getting files is 1 by 1 dnld.

Oh, um, the recommended method is to use bzr branch lp:~toykeeper/flashlight-firmware/fsm to grab the entire repository.

Unfortunately, Launchpad doesn’t have automatic .zip downloads. I bugged them about that feature for a few years, but it was never added. I considered moving the repository to Github instead, which would provide this feature, but in some ways it’s a downgrade so it’s not a clear win. One of these days I may have to move it anyway though, since Canonical hasn’t been good about maintaining Windows versions. I think the most recent is 2.6b1 from here.

Hhhmm, it's crashing. I dnlded v2.6b1-1 and used "Open URL" and pasted in: lp:~toykeeper/flashlight-firmware/fsm

But it appears to start loading then comes up with an error: "Bazaar has encountered an internal error. ..."

Well, that’s unfortunate. It seems Windows support is worse than I realized.

For now, here’s a .zip copy of that branch:

http://toykeeper.net/torches/fsm/fsm.2018-12-22.zip

Under Windows 10, the easiest method may be to install an Ubuntu container and then use it from a bash command line. Doing it that way, the regular “apt” package commands can work and a current copy of bzr can be installed. That’s not an option for everyone though.