STAR Firmware by JonnyC - Source Code and Explanation

Meh… wrong name. Kind of a pet peeve.

I doubt my “s7” or “brass-edc” would work for this. I like it, but not many people like party strobes as much as I do. Also, it’s designed for reverse-clicky lights with stock drivers so it can’t distinguish long or short presses at all. The UI is totally different than what was requested.

I do use it as a handlebar light, but it’s not primarily intended for that. In that role, I generally put it on “high” mode (~175 lm) or the med-turbo flasher (~50lm with a ~400lm stutter every second or so). Depends on whether I want to see better or be seen better.

lol Hey he asked I just delivered!

fellfromtypo that’s perfect name for me :bigsmile: Wait is that supposed to be insulting? :slight_smile:

Changing the curve shape isn’t that hard. I made one with a logarithmic ramp with extra-smooth transitions between the lowest levels, because I prefer to have more of the ramp space dedicated to the lower end. Comfychair changed it to a quadratic ramp, which is closer to visually-linear. I’ve been meaning to do a cubic ramp (should be exactly visually linear) but keep procrastinating about it.

If you want to try it, it’s in the Ferrero Rocher directory in my code repo.

BTW, why did you make your firmware incapable of shutting off? Is it for dual-switch lights?

Just thought I should mention it. Using the wrong name bothers some people, even if it’s not intended to be disrespectful.

The hardware is a stock UniqueFire HD-016 bike light (possibly other stock bike lights too). The MCU would be swapped out with a flashed Attiny13a (as seen in ImA4Wheeler's SolarStorm X2 mod thread). All these bike lights use an e-switch (I do believe that is correct). All run 2S2P battery packs (though the HD-016 will also run on 4.2v).

Functions / modes I'd like to see:

From Off:

*short-press turns on in "Low" mode, additional short presses continue advancing to Med, High, & Turbo regardless of how long a mode has been in use. A short press from "Turbo" returns back to "low to start thru the cycle again.

*medium-press turns on in "Turbo" mode with additional medium presses advancing backwards in mode order (high, med, low) regardless of how long a mode has been in use. A medium press from "low" returns back to "turbo" to cycle back thru again.

*long-press (guessing about 3 seconds) activates Strobe. Long press from "strobe" turns "off". Short-press from "strobe" could either do nothing, be a beacon mode, or return the light to the standard "L-M-H-T" mode sequence.

From On:

*short presses advance modes increasing from L-M-H-T, repeat.

*medium-presses go backwards in mode order (T-H-M-L, repeat).

*long-press (again, guessing 3 seconds) turns the light off.

Additional Features:

*Turbo step down to "high" after 90 seconds.

*Low voltage detection / warning - something like dropping down one mode and flashing. (If this is feasible with the 8.4v pack.)

*thermal step down would be awesome, but I don't expect it.

Note: user should never activate "off" unless done on purpose.

Any other questions?

Thanks,

-Garry

Er, on a side note… I just updated the Ferrero Rocher ramping UI.

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

Details are here, but if anyone has a non-default page size the link won’t work:

The short version is I caught up on a few TODO items, added support for fast PWM, made PFM easy to turn off, added some precalculated ramps, and made the default build go extremely low on moon mode. On a full high-amp cell, the lowest mode dropped from ~3.6 lumens to ~0.1 lumens on my triple-219B with a Ferrero Rocher DD driver.

So, on my hardware at least, it goes from 0.1 lumens up to 1800 lumens on a full cell. When the battery charge drops though, the output drops to like 0.000001 lumens and 1200. That extra-low moon may as well be off unless the battery is close to full. At less than full voltage, it can’t get the emitters to light up with such short pulses — they’re like one ten-millionth of a second long!

Nope, that makes sense.

Most of that would be fairly small mods to the STAR-momentary code, but it could get a little hairy trying to make it tell the difference between medium and long presses, and it has no strobe. It may require some pretty significant changes to make it do both medium and long presses, and I’m undecided how best to add blinky modes.

Timed turbo step-down is already implemented. Low-voltage detection is probably possible, but might be tricky and would require getting a copy of the hardware to whoever writes the code. Thermal step down isn’t possible without extra hardware.

I like the whole idea behind ramping :slight_smile:

The button delays take awhile to get it all meshed right Garry… It’s not a lot of code you can stuff in there so your pulling out all the tricks to get to your goal.

But to answer your question Toy it’s for my Y3 (tail and eswitch). I’m trying to find quiet momentary button switches, but no luck so made my own.

Took sleep out to keep voltage monitoring on. While I was at it, might as well exploit the PWM 0 low moon as light ring refresher. It’s really nice if you give it a try. I throw together another board and try your ramps out.

Well forget that idea… Your code is for rgb and not the tiny13a :slight_smile: I deal with ghetto stuff

Played with the ramp I made last night… It’s about perfect imo- starting low to high or high to low, you don’t really need to worry about the in between.

Huh? I’ve only made firmware for attiny13a so far. Granted, the driver I was targeting has a couple indicator LEDs hooked up to extra pins, but it still works fine on boards which don’t have that.

Ok just put another board together… I saw the green and blue pins and thought, wait a second xd

I’ll flash it in tonight and check it. Thanks

Where do I find the source code for dual-PWM off-time?

Thanks for keeping at this guys (and girls)!!! I like playing with all my new FW’s but its nice to be able to default back to STAR every now and then when I just need something to work with no debugging / other trouble.

This might not have all of JonnyC’s most recent additions, but it does at least have dual PWM:

http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files/head:/JonnyC/STAR/dual_pwm/STAR_off_time/

I’m a little behind on merging in his latest changes.

So why not link here? GitHub - JCapSolutions/blf-firmware at dual_pwm

Because I forgot to save the URL where I could find it easily, and didn’t remember where I originally found it. Also, I had some difficulty getting a copy of that via git, because it kept giving me the master branch instead of dual_pwm (even using the clone URL suggested at that site). I need to learn more about git.

I merged the dual_pwm feature into the "master" branch, so it's in the latest version of the program...

https://github.com/JCapSolutions/blf-firmware/tree/master/STAR_off_time

Fair enough. I had to search for my own post on the topic to find the link. Or I thought I did - now that I say that it strikes me that JonnyC has added a link to the GIT repo on the firmware page of his website. I forgot about that.

FYI for Cereal_killer or anyone else, to go from the link JonnyC posted on his website to the dual_pwm branch you must use the little “branch:” dropdown menu that defaults to branch: master.

EDIT: I got ninja’d by JonnyC: apparently the dual-pwm branch has already been merged back into the master branch. The latest code in the master branch is what you want.

Thanks. Right after posting earlier I grabbed updates on the main branch and found that the dual_pwm bits had been merged in. :slight_smile:

Also, I got bzr-git working, which lets me use bzr to access git repos. This is much much easier for me, and should greatly simplify merging in changes.

Edit: … and it’s all up to date now. :slight_smile: (plus, future updates should be much easier) I should note that the dual_pwm/ dir is gone though, since it got merged back into the main STAR code.

Just FYI, I'm not sure that the latest versions with the dual-pwm have been fully tested, so please let me know if there are any issues.

Using dual-PWM whats the lowest you guy’s are able to get XP-L’s to light up?

Quad XP-L with BLF 17dd V3 driver

I don’t know the answer either way, but are you asking about 7135s, FET, or something else?