STAR Firmware by JonnyC - Source Code and Explanation

My driver was modified to temperature monitoring instead of voltage monitoring. Would you please educate me to modify the code to ramp down and to shut off when the voltage of the ADC is higher than the threshold.

Johnny - thanks for the input.

I did as you suggested and changed to “static uint16_t ticks = 0” then changed the turbo timeout to 600. Let the light run for 9 minutes and did not see any step down.

Is there something I’ve missed?

Much appreciated.

You don’t want to do both voltage and temperature monitoring?

If you want to do only temperature I assume you don’t want a “critical” value which turns the light off, only a step-down temperature. In that case I’d do something like this:
Replace:

#define ADC_LOW                130
#define ADC_CRIT            120

with

#define ADC_LOW                130
#define ADC_CRIT            0

also replace

if (ADCH < voltage_val) {

with

if (ADCH > voltage_val) {

That’s a pretty dirty way to hack the code. It should work I think, but I don’t like it. For my own use I’d want a separate check done for temperature.

Thanks Wight, That is what I supposed to modify the code.

Sure. Remember that I did not try it, but I think it will work fine. Will you post a thread about your temperature monitoring? I would like to do that myself.

Here is the thread of my temperature monitoring driver. Microa's single XP driver board

This was 'solved' by using Atmel Studio 6.2, the problem code now flashes correctly.

FWIW I also tried:

Change to “static uint16_t ticks = 0” with 240 (instead of 600 above) for the turbo timeout.

This result in a timeout near 2 minutes. Not sure why 600 wouldn’t yield 5 minutes…

Thanks Microa.

Heh, :beer:

Sorry, I didn't provide all of the code for you. Try changing...

if (ticks < 255) ticks++;

to...

if (ticks < TURBO_TIMEOUT) ticks++;

Will the following changes give me a single mode setup?

Tried them and received several errors from Armel Studio 6.2:

Add // before a line to have it ignored.

//#define MODE_MOON 8 // Can comment out to remove mode, but should be set through soldering stars

It seems it works as I modify:
#define ADC_LOW 130 (130=56C)
#define ADC_CRIT 140 (140=60C)
Change
if (ADCH < voltage_val) {
if (++lowbatt_cnt > 8)
to
if (ADCH > voltage_val) {
if (—lowbatt_cnt > 8)

In fact, the 140 shut off the light will not happen because the power to LED already has been ramped down when the temperature reach 130.

Better now but still getting this

If you're using MODE_HIGH as your single mode, and not turbo, you also need to comment out #define TURBO_TIMEOUT.

Are you also disabling low voltage monitoring? (if so, why?) When you comment out settings at the top, you have to go hunt for other stuff farther down that refers to the things you disabled. If you re-enable #define VOLTAGE_MON those two errors will go away and it builds correctly.

You saved me once again!
If I have only one mode (turbo), voltage step down will work, since I re-enabled the vol mon?

Cool. Good point, I guess a sudden jump from 55c to 60c would be a huge thermal shock: never going to happen unless you drop it in a volcano. I hadn’t thought of that.

I think for step-down to work some extra stuff has to be done. STAR steps down by lowering the mode index (it changes the mode to a lower one). If you only have one mode defined then the stock STAR ontime or offtime firmware can’t step down. Momentary might be different, I don’t remember.

I think RMM has a post about that subject around here somewhere. I don’t recall how he was working around it.

zeremefico, “MODE_TURBO” (255) mode includes a timed step-down to “MODE_HIGH_W_TURBO” (110). This is independent from the low-voltage-protection step-down. “MODE_HIGH” (255) uses the same brightness but does not include a timed step-down. You do want Turbo?

I had problems with high (set at 255), as only mode, so i chose turbo only.

Johnny - that did it. Thank you very much for your help. It’s certainly appreciated.

I took star off-time memory 1.3 and modified it to add the feature that the longer press (of reverse clicky switch) cycles back the mode. (It’s less than 10 lines of additional code).

Finally I have the perfect driver for me.