STAR Firmware by JonnyC - Source Code and Explanation

Makes sense.

Was hoping for something like this with or without the spring but using an e-switch instead of a clicky.

I think the reason they are unavailable is because each lights Eswitch lines up in a different place with many sizes for hole diameter. It would be impossible to make a generic Eswitch board that would fit many lights.

When using a regular clicky switch with these drivers, all of the current flows through the switch.

When using an e-switch in the configuration we’ve been discussing would the current not flow through the switch?

I ask because I’m looking at switches on Digikey and none of them appear to have the necessary current rating.

Just wanted to double check.

http://www.digikey.com/product-search/en/switches/tactile-switches/1114206?k=&pkeyword=&pv235=14&FV=fff40011%2Cfff8005e&mnonly=0&newproducts=0&ColumnSort=0&page=1&quantity=0&ptm=0&fid=0&pageSize=25

No the curent wouldn’t flow through the eswitch. Because of that you can use very small switches and thin cables for the eswitch

+1 w/finges. I use 26 AWG or 30 AWG silicone. The two connections are from ground (BATT-) and usually pin #2 of the ATMEL MCU.

Very helpful. Because I’m a bit dense, it would be wired as below:

Ground~~switch~~>pin #2 of the MCU

Thanks

A bit late, but yes, that’s the way to wire the e-switch. Or the other way around, doesn’t matter :wink:

If you check out the text in the firmware you use(open the *.C file in a text editor), it’s usually described in the beginning which pin is the switch pin on the MCU. If it’s not described, it’s probably a clicky switch firmware.

Excellent info. Thanks

Hey guys! I’m surprised to see that STAR has stuck around this long! I’ve been out of the game for a long time, but I’m back for a little bit just to check out the amazing drivers and firmware people have created to simplify things and add features (no cap needed for off-time, adjustable turbo timeout, add temp monitoring, even a lighted tailcap).

Anyways, my question is, even though my GitHub site (Blf-firmware) doesn’t get much traffic, I’d like to update the top of the page to make note that development has stopped, and that there are so many other better options out there. What site(s) should I link to that are good starting points for people new to flashing and want a description of the firmware options and process?

- Jon

These would be a good place to start I think, TK has taken a lot of time to combine most of the firmware around.

https://code.launchpad.net/~toykeeper/flashlight-firmware/trunk

I’ve tried to gather things together and put them in one place. Basically, click the Link in my signature for the introductory page. A lot of the further details and links are in the readme in the repository, while a summary of available code is in the index file.

I would like a little help .

I flashed the firmware (dual switch) on wight’s fet driver : 17mm & 20/26/27mm single-sided DD/FET driver release: A17DD-SO8 / A20DD-SO8 / etc
and the boards i used : OSH Park ~

First question : Should i use OTC cap for memory ? Or what ?

2nd : the switch should be connected between ground and “A” or “B” ?

You can use OTC to control the timing boundary between a short press and a long press (or even short/medium/long), or with some code changes you could leave that part out. IIRC, the STAR dual switch code needs the OTC.

About connecting the switch, neither A nor B is the right spot. If I understand the driver layout, you probably need to connect the switch to ground and to pin 3 of the MCU. It’s the pin just to the right of “L+” on that last picture.

This is not the easiest driver layout to use for an e-switch light.

Input voltage is used at the calculation of the variables ADC_LOW, ADC_CRIT in STAR.c (and others?). Can i tweak the equation since the input i would use would be 12V? Thus;

But since this is mains powered, not a battery, the voltage won’t decrease. So what should i do, assign the same integer to both?

If you’re doing mains-powered 12V, you should probably turn off the voltage-related functions.

However, if you still want to measure voltage, you’ll at least need to change the voltage-divider resistors to keep the expected voltage within the MCU’s usable range.

You’ll also need to limit the voltage used to power the MCU, using a Zener or LDO or something. It’ll fry at 12V. So, at least one hardware modification is needed.

What would happen if I flash STAR off-time but didn’t have a capacitor in place? I’m looking for “off-time” memory during mode selection, but “no memory” once the light is powered off. Wondering if I can accomplish this without the cap.

-Garry

Usually, the result ends up being that every click is registered basically as a "short click", where the driver would advance to the next mode (not what you want).


Doesn't selecting "no memory" accomplish what you want, anyways? The off-time STAR with capacitor in place functions like you are describing.

But that IS what I want. When the light is on I always want a short click to advance modes. When the light is off & turned on I want it to always turn on in the first mode.

I found that regular “STAR” (on-time) even when set to “no memory” would require two clicks to advance modes because “memory” had set it. That was annoying.

Anyway, I just tried flashing STAR off-time to a 105D without capacitor and it IS working just as I wanted! Single-click always advances mode & always starts in first mode! (EDIT-see next post.)

My problem now is that I need reverse mode order which I originally planned to get by soldering star #3 on a 105C. Can I change mode order in the code simply by reversing the line entries to put high first? (I’m referring to the lines where I enter my desired PWM values - the only lines I ever edit.) Or are there other lines in the code to edit also?

Thanks,
-Garry

WAIT! My bad! You’re right RMM! Upon closer inspection it’s acting like a driver with “next mode memory” which is not what I want! Doh! So I guess I’m back to switching the 105D out for a 105C.

I would still like to hear an answer to switching mode order in the code though.

-Garry

You can use ToyKeeper's "NOINIT" modification to the code that will give you off-time without the capacitor, so you can use it on the 105D without adding any extra parts (for best timing, also change the fuses to those listed in the initial code description). (it's in ToyKeeper's repository).

To switch the default mode order in the code, find this:

if ((PINB & (1 << STAR3_PIN)) == 0) {
        // High to Low
        mode_dir = -1;
    } else {
        mode_dir = 1;
    }
}

Then change to this (or just solder Pin 3 to ground with the default code...):

if ((PINB & (1 << STAR3_PIN)) == 0) {
        // High to Low
        mode_dir = 1;
    } else {
        mode_dir = -1;
    }
}