i didn’t monitor the thread for a while.
here should be the code:
http://www.codeshare.io/2Vlfm
changes in the UI:
the modes are not circular, instead when doing a short press while in the highest mode, the firmware keeps it in that mode. I wanted to be able to put it and keep it in the highest mode without accidentally missing it, with a few fast clicks.
3 commands you can issue though the reverse clicky switch:
short press->mode advance
long press (cca 1.5s in my case)->mode go back
longer press~~go back to the first mode (same state as turning the light after it has been off for longer than some time~~ 3s in my case)
notes:
5 modes: 2.5mA 25mA 250mA 0.9A 2.8A. These are aproximations from my memory using a 2.8A driver.
added another capacitor level constant to be able to distinguish between short and long presses. This is for a cca 5uF capacitor, so it should be tuned for whatever value you are using.
I might have disabled mode memory, dont’ remember. Also I might have hardcoded mode directions. You can take original firmware and take the snippets from my code.
so, as far as I rememeber, changes are from line 280-305, and in function next_mode(), and the added capacitor level constants
#define CAP_THRESHOLD_SHORT
#define CAP_THRESHOLD_LONG
next step I plan to do: implement and hide modes (strobe) “before” the first (moon) mode so that they can only be accessed immediately after the light has been switched on, using “go back” / longer press of the switch.
edit: if there is interest I can make it more “tidy” so that this is a generic change while keeping all the other regular Star features I might have disabled while researching. I know it can be frustrating to do this yourself for somebody who’s new to this, it was so for me.
edit2: coding detection of a doubleclick is possible, but then how would you distinguish between two short clicks which should advance by 2 modes, and a doubleclick. I think having doubleclicks in the same UI with short clicks would make UI non deterministic.