STAR Firmware by JonnyC - Source Code and Explanation

In my experience more 7135 chips takes a higher PWM level to turn on than less chips. Has your experience been different?

I havenā€™t tried nearly as many hardware configs as RMM, but Iā€™ve found that 2-8x7135 chips on a nanjg/qlite driver will light up at around PWM=6, while 32x7135 chips on a BLF-SRK driver will light up at PWM=1 (or even PWM=0 in fast mode).

It might not be the number of chips, but rather the design of the driver. I donā€™t know.

In any case, I havenā€™t seen a FET which wonā€™t light up at PWM=1, though the output gets really dim at low voltage.

Are you using the 350mA or the 380mA chips on the SRK? The 350s with the rounded tab like you get from FT light up with a lower PWM number than the 380mA "38A" or equivalent chips do. The difference is pronounced enough that I have two different files for the 32x 7135 drivers depending on which binned 7135s are used.

Ah, Iā€™m mostly using the 350mA model. It looks like the 380mA chips might give me a nicer moon mode though. I think ~0.2lm is the sweet spot for a moon mode.

I have data about these:

  • 32x350mA: ~1 lm at PWM=1 (phase-correct) (3xXM-L2)
  • 2x350mA: ~0.7 lm at PWM=6 (fast) (red XP-E2)
  • 4x350mA: ~0.5 lm at PWM=4 (phase-correct) (XP-G2)
  • 5x380mA: ~0.2 lm at PWM=6 (fast) (Nichia 219B)
  • 8x350mA: ?? lm at PWM=9 (fast) (old XM-L T6)

I had no idea the 7135 bin would have this effect, but I like the lower moon mode on the 380mA chips.

Also, old XM-L emitters need a significantly higher PWM level in order to light up. Not sure what the actual output is though, since I took that light apart before measuring it.

I don't know if it is the bin, or the manufacturer.

Hi vex_zg,

I had seen your first post in this matter and I found the idea truly intriguing.

But I lost track of what went on and did not notice your success. It seems your endeavour went widely unnoticed. :frowning:

Would you mind sharing what you added and/or changed in the code?
Did you keep the capacitor value the usual 1yF or did you use a larger one?

Iā€™d be happy to read about it.

Iā€™d like to see the code too. I finally got some drivers with an off-time cap, and am trying to decide how to design the UI for them.

I like short-cycle memory on drivers without the capacitor, and off-time would help with avoiding extra clicks to move from, say, mode 8 to mode 9, but Iā€™m trying to decide if there are any other good enhancements to be made. (especially if I want instant access to both moon and turbo after being off for a while)

i didnā€™t monitor the thread for a while.
here should be the code:
http://www.codeshare.io/2Vlfm

changes in the UI:

the modes are not circular, instead when doing a short press while in the highest mode, the firmware keeps it in that mode. I wanted to be able to put it and keep it in the highest mode without accidentally missing it, with a few fast clicks.

3 commands you can issue though the reverse clicky switch:

short press->mode advance
long press (cca 1.5s in my case)->mode go back
longer press~~go back to the first mode (same state as turning the light after it has been off for longer than some time~~ 3s in my case)

notes:

5 modes: 2.5mA 25mA 250mA 0.9A 2.8A. These are aproximations from my memory using a 2.8A driver.

added another capacitor level constant to be able to distinguish between short and long presses. This is for a cca 5uF capacitor, so it should be tuned for whatever value you are using.

I might have disabled mode memory, dontā€™ remember. Also I might have hardcoded mode directions. You can take original firmware and take the snippets from my code.

so, as far as I rememeber, changes are from line 280-305, and in function next_mode(), and the added capacitor level constants

#define CAP_THRESHOLD_SHORT
#define CAP_THRESHOLD_LONG

next step I plan to do: implement and hide modes (strobe) ā€œbeforeā€ the first (moon) mode so that they can only be accessed immediately after the light has been switched on, using ā€œgo backā€ / longer press of the switch.

edit: if there is interest I can make it more ā€œtidyā€ so that this is a generic change while keeping all the other regular Star features I might have disabled while researching. I know it can be frustrating to do this yourself for somebody whoā€™s new to this, it was so for me.

edit2: coding detection of a doubleclick is possible, but then how would you distinguish between two short clicks which should advance by 2 modes, and a doubleclick. I think having doubleclicks in the same UI with short clicks would make UI non deterministic.

Now that is a very interesting idea. :slight_smile:

I think ā€œbackward from moonā€ might be a great way to access what I call ā€œimpress modeā€ on a stupidly-bright light Iā€™m making. I wanted something to give me quick access to its brightest mode without interfering with EDC-style use, and that might work really well.

@vex_zg

Thatā€™s a really nice adaptation.
I just looked into it and I think I saw what you did.
I perfectly understand that you alter and hardcode the stuff, itā€™s so much easier if you program it anyway.
A tidy version would certainly help, if you find the time. But you already were extremely helpful.
So thx again.

EDIT: Your code went blue :bigsmile:

Thanks vex!
I will definitely try your codeā€¦

A lot of interest from my side. :slight_smile:

ok, Iā€™ll make the tidy version during the weekend (if wife allows :slight_smile: )

Ok, I'm looking for some help in creating a perfect MTB cycling headlight firmware. I'm already working with another BLF user who will be doing the mod. Now I'm not a code writer/programmer so I haven't been following the various firmwares that closely, so please direct me if there is some other firmware better suited. If I should post this in a new thread let me know, but it seems there have been numerous offshoots from JonnyC's STAR firmware posted in this thread already. Because I'm not a programmer, let me know if my requests are not feasible.

What I would like is firmware that allows a MTB'r to increase brightness with a quick-click and decrease brightness with a slightly longer click. I would like to keep the "user configurable modes" and "Turbo with stepdown" and such that are standard in STAR. I want "Off" out of the mode cycle requiring a long-press to access which means a MTB'r never turns his light off on accident. Strobe should be accessed via a long-press from "Off" only (not accessible from any other mode). I would say strobe should be set to 50% brightness and be a medium speed (not too slow and not to fast). So standard modes would be "Low-Med-High-Turbo-(repeat)-Low-Med-High. . ." It would be an additional benefit to have low-voltage monitoring with stepdown for a 2S (8.4v) battery pack (ideally for both 1S and 2S I guess, as some lights do run on 4.2v). I'd also want mode memory (really doesn't bother me if it's "on-time" or "off-time" memory).

So is this feasible? Does it already exist? Anyone willing to modify existing firmware to handle this for me?

Thanks!
-Garry

Wrote this over the last couple nights. Itā€™s something Iā€™ve wanted in a light but never could do until now. Iā€™ll probably be putting this firmware into all of my lights and adapting it out as needed. I found through testing handheld flashlights, the strobe and beacon is rarely used- Iā€™m not a biker. But picking modes for my lights wasnā€™t fun either.

I wanted a ramp as the base with a hidden mode that handles strobe. I also wanted full time voltage monitoring and low moon when the tail switch is on.

So after some late night programming I came up with thisā€¦ Itā€™s a smooth ramp up and down. It starts off in very low moon using fast pwm and the pwm 0 bug on a BLFDD driver. Looks pretty cool with a dedomed emitter like a white painted square.

Voltage monitoring is enabled through the watchdog interrupt anytime the tail is on. Itā€™ll ramp down the light at low volts, and back to moon. This allows you to see the tail is on at any time too and gives you the heads up, time to charge!

Hold (eswitch) from off, and it ramps up all the way to 100%. An indication flicker was put in when you hit the top. On switch release and hold, the ramp goes opposite. You can get any light level you want. From off, you can single click to high and it will start the ramp backwards too. You can stop the ramp anywhere and go back and forth. Fast click turns it off.

The hidden mode strobe and beacon are done from off, double click. Any single click from that point alternates between the strobe and beacon. So letā€™s for example say you get jumped from behind like your in detroit or something. Ok your a gonner in that situationā€¦ lol

Ah I needed to stick something like that in hereā€¦ jus cause

Anyways :stuck_out_tongue: Double click to enter the hidden modes and if you hold the switch, it will flash once and youā€™ll be back to moon (off).

-If anyone could host this so others can play with it. I think this useful code for the community.

Hosted it
https://github.com/fellfromtree/Yezl-Y3-Drivers

(Problem posting in this thread I guess) Are you proposing this for me? Because it does seem that I could use this. It's a quick click to off instead of long press like I proposed. I never considered a ramping firmware. Not sure how feasible it is on a bike light though. Probably prefer quick taps to change modes rather than holding until you get to what you want. Can the low voltage monitoring be set for 2 cells in series?

-Garry

No it wonā€™t with series. Itā€™s a personal project of mine- but you can increase the ramp speed if you need toā€¦

edit Actually what you need is Toymakers brass-edc.c itā€™s written for her bikes

Ok, link to a description of that firmware?

Thanks,

-Garry

http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files/head:/ToyKeeper/s7/

Try that oneā€¦ Might be what your looking for

Nah, sorry not for me.

-Garry

What hardware are you using? Does it have an e-switch, a clicky switch, or both? What kind of driver is in it?

Could you be a bit more specific about the interface? Specifically, in any given state, which actions cause which state changes? For example,

While off:

  • Short click goes to (lowest/highest/memorized/other) mode.
  • Long click goes to (ā€¦ strobe?) mode.
  • Double click goes to (whatever) mode.

While on:

  • Short click increases brightness. (loop from max to min)
  • Long click decreases brightness. (loop from min to max)

How do you turn the thing off?

Iā€™m not aware of any firmwares which handle voltage monitoring properly on more than one cell in series. They generally need a zener mod, and that tends to interfere with voltage detection. I donā€™t have any hardware like that, so I donā€™t actually have a way to test it.

As far as the UI goes (if I understand it), the closest firmwares Iā€™m aware of are two that I made for the Ferrero Rocher driver in a Roche F6. One is very close to STAR-momentary, with some additions:

While off:

  • Short click to go to lowest level.
  • Long click to go to highest level.
  • Short-then-long to enter battery check mode.

While on:

  • Short click to increase brightness. At highest mode, this turns the light off.
  • Long press to decrease brightness. Hold until desired level is reached, then release. Stops at ā€œoffā€ if you hold long enough.

The other is based on the Olight Baton UI:

While off:

  • Short click to go to memorized level.
  • Long press to go to moon.
  • Longer press to enter (or exit) soft-lockout mode. When unlocking, itā€™ll enter the last memorized mode.
  • Double click to go to turbo.

While on:

  • Short click to turn off.
  • Long press to increase brightness. Hold until desired level is reached, then release. Loops from ā€œturboā€ to ā€œlowā€, skipping ā€œmoonā€.
  • Double-click to enter strobe (or beacon) (not yet implemented).

There are other firmwares I havenā€™t tried though. I try to get everything into my firmware repository, but there are a bunch I havenā€™t added yet or havenā€™t gotten permission to add.