STAR Firmware by JonnyC - Source Code and Explanation

thanks for that! now I can get it all set up while i’m still at work.

The attiny13a can do two PWM channels or one PWM channel with a variable ceiling value. Not both. Since you’re already using two channels, you can’t change the ceiling. It uses the same register for both functions, but can only do one function at a time.

It would technically be possible to change modes when necessary, but it still can only change the ceiling on the primary PWM channel. The secondary channel is hardcoded to the highest ceiling value. So, it still doesn’t help, if your low modes are on the second channel.

Otherwise, if you’re curious I have a code example in both Ferrero_Rocher/Ramping_UI_table.c and in cypreus/cypreus.c .

I have an example of off-time FW with strobe in cypreus/cypreus.c in my code repo. Or an example with the new “noinit” off-time and fast strobe in s7/s7.c. But those both include a lot more than just a strobe; they’ve got all sorts of extra modes, and have diverged pretty far from their STAR origins.

Regardless, it demonstrates a way to add blinky modes.

hmm I looked at cypreus, but for some reason I thought it was a momentary FW. I might have to take another look. This is for someone else, it just needs L> M > H > Strobe

Yeah, it’s massive overkill for just four modes. It has, um, 15 modes. Or 18 depending on how they’re counted. Mostly, it just demonstrates one method of adding more stuff (like strobes) with an off-time clicky.

Hello guys,
I am working on the a17pzl driver and I would like to make a change in STAR off-time firmware that would enable me to set 255 pwm on secondary output for single 7135 and 0 pwm on primary output. I know that this change might create complications with stepdown battery monitoring and other functions but I am willing to comment them out for the ability to have the driver run 350mA on a single 7135 in one of the modes.
I am not sure what is the right and easiest way to do it. Any help would be appreciated.
Thanks.

you can take a look at star momentary firmware, there you can see how the second PWM output is used, it’s just a few more lines to be able to use the second PWM output.

In that FW, there is another array with PWM levels for the alternate PWM Channel, and for each flashlight mode you can set separately what the PWM levels are outputted at both channels.

Thank you vex_zg for a prompt reply. It seems more complicated than I thought. The momentary FW deals with modes a little differently and I am not sure how to adjust the off-time FW that I will be using.

I plan to add secondary output to off-time capacitor reverse-clicky star firmware, within a week or two… I can share once I’m done…

I finally built a moonlight special test host tonight, and should be making a STAR derivative very soon with that sort of thing built in. I’ve been busier than I expected, but I’m getting there…

That would be excellent vex_zg and ToyKeeper. I am glad to hear that. Please share the code when you are done. Thank you

Well obviously I’m doing something wrong, I’m just too inexperienced to know what that is. I’m trying to integrate a strobe into Star off-time. Here is my full code.

Please post a diff against your most recent code which compiled correctly.

https://www.diffchecker.com/miv37pun

Your problem is here on line 381:
“else {”

You added an open bracket without a closing bracket. “else {do normal non-blinky flashlight stuff}” is the correct form.

EDIT: try just deleting “else {”.

I tried deleting it first, then also closing the bracket after the if statement, and it still gives the same error. AVRStudio says the error is in line 455.

It compiled fine for me when I deleted it.

Hmm. Maybe I’m having cache problems again… At least now that I know the code isn’t the problem, I should be able to figure it out. Thanks.

Ok it is working now, just had to restart AVRStudio. I still don’t know why it does that…
………………….
If anyone else is interested in it, here is the code.
It is STAR Off-Time, no memory. L > M > H > ~10Hz Strobe

Isn’t it satisfying when you get it working? :slight_smile: