I tried everything I could and it’s not working.
So here’s the relevant bit of code:
Couldn’t make it work.
It says “0 being low for pressed, 1 for pulled-up for released”. 0 is pressed in default config. So I need 1 for pressed.
The pull-up resistor is high because:
So I don’t need to do it.
Now, there’s something with the underlined bit of code. I need to reverse the way it registers the push signal. From low to high.
You need to add a pull-down resistor to keep the line normally low, then pressing the switch will pull the line high. Any value from 1k to 100k can be used if you disable the pull-up resistor on that input. But using a 1k ohm pull-down will overcome the internal pull-up even if not disabled (at the expense of a fraction of a Milli-amp of extra current draw, this could be an issue with e-switch lights). It is important that the positive side of the switch is the same voltage as the controller IC. If the voltage is higher, the IC may be damaged.
I'm not sure about the code, firmware wigs me out, I'm always off by one...
First try adding the pull-down resistor, then revisit the code, it just may work!
Edit: Put a meter on that line and verify it goes from a zero to a one when the switch is pressed.
On the File menu at the top of your screen click “Project”, click the bottom selection “(project name) Properties”, click “Toolchain” on the left, and look for “Optimization”. Optimization level set to -Os Optimize for size.
The basic clicky STAR uses on-time. STAR_noinit uses fixed offtime via a memory decay trick. Or STAR_offtime uses configurable offtime via an offtime capacitor. Take your pick.
Ok, for the STAR_noinit. You say this uses a "decay trick". Does that mean that I can use that with a nanjg 105C and it will give the board off time memory?
I have a version of wights single sided 17mm FET DD board I would like to use it on. It has an OTC with a value of 1uf. I am guessing the STAR_offtime would be the way to go with that?
Those warnings are not severe, so you can just ignore them.
Or fix them by:
- removing the line 366 (the variable is not used, so it can - and should be - removed safely)
- removing the 'inline'-definition on line 168 (no point of inlining that function, especially as it uses a static variable which kind of works, but violates the C-standard)
I have a couple more questions. I would like to know how to add more modes to this.
I saw that the high mode was disabled, so I enabled that and added a value, but I would also like to be able to add more.
For example can I have the moonlight mode enabled by default rather than when using star 2?
Also if I wanted to get even more modes than that, like say 6,7,8 in the string, how to do that?
Other frimwares I have seen just had them in a single line like "define modes, 0,2,7,14,39,100" etc, but this one has a define and the name of each one.
Turbo timer is enabled by default in STAR_offtime. Check lines 78, 79 & 80.
BTW: Looks like STAR_offtime (revision shown by your link) doesn't have the ability to re-enable turbo after step down by a half click. Is it really so?
This is part of why I made a modified version of STAR_off_time called starry_offtime. It allows you to set the mode array directly like you described, for both channels (if you have a FET+1), and set the PWM speed for each mode. Also has some extras which can be disabled, such as blinky modes and “medium” presses to go backward instead of just short/long.
It’s sort of halfway between STAR_off_time.c and blf-a6.c. It’s not heavily tested though, so LVP might behave a little weird. It also doesn’t have a way to completely turn off support for the second power channel, so the best you can do is set it to all zeroes.
Thanks, that code edit did give me the use of moonlight without the start locked.
I have been playing with the turbo timer a bit. It looks like it is in fact working. You are correct about not being able to go back to the turbo setting by a half click. When the timer kicks in the light ramps down to "turbo low" so since the light is technically still in turbo mode the next half click takes you to low.
ToyKeeper,
I appreciate that. It is much easier for us noobs to edit that single line with all the modes in it. I will keep the starry in mind.
Here is today's question if you guys can bear with me a bit longer.
Is there something else in the code that effects the level of light output besides the values of each mode?
The reason I ask is because I can set value of moonlight all the way down to 1, and it does give a reasonable low mode with one cell. On a zener modded board with 2 cells its a bit bright still though. I have other firmware I can flash that puts moonlight lower than this.