Hi,
i’m looking for someone, who could code a simple driver for NANJG 105D.
I need 5 modes:
100% of power, 80, 50, 20, 5 without eeprom saving last mode.
When light is off, and we trun it on, led will start always from 0% to 100% - with transition (soft start).
When we click two times, it will bling:
5 times if battery is full loaded, 4 if is 80, 3 if is 60, 2 if is 40, and one if less then 20.
Is anybody here who could help me to write driver like above or have already done ?
It might not an exact match with what you have listed, but there is a brand new firmware available, named “Biscotti”. It was developed for the new C8 and referenced here:
Depending on how many 7135 are used the brightness levels might be suitable? Or you could adapt the source code to your own needs?
Thanks for the replay!
I’m trying to write simple program, but knowledge of electronics a little beyond me.
I’ve done a simple soft start from open source firmware from github, but as I reading all posts about modding
I know that this will not be the optimal for battery performance.
A lot of problems eliminated by the omission of memory but it’s for me still a big deal.
If you are a beginner I would simply modify an existing firmware or just flash the hex file directly. All you need is the driver, a computer, a programmer (don’t need the programmer if you have a dev board, like RPi, OPi,…), dupont cables or a soldering iron (some clips come with a little breakout board where the chip can be clipped in but it won’t work with soldered chips), a clip and some time.
good. then I’d just get an existing source code, adapt to your needs, compile and flash. Some of the flashlight hex firmware files come with the source code.
I do it with another noinit variable that memorizes the previous on-time. If less than 256 ms, it was a double click.
volatile uint8_t noinit_prev_on_time __attribute__ ((section (".noinit")));
.
.
.
ISR(WDT_vect) // WDT interrupt service routine
{
// Double click timeout
if (noinit_prev_on_time < DOUBLE_CLICK_TIMEOUT) {
++noinit_prev_on_time;
}
.
.
.
int main(void)
{
// Determine what mode we should fire up, read last mode that was saved
if (noinit_decay) { // long click, reset to start mode
mode_idx = START_MODE;
noinit_prev_on_time = 0; // enable double click detection on initial start
} else if (noinit_prev_on_time >= DOUBLE_CLICK_TIMEOUT) { // short click, or first click of double click
mode_idx = noinit_mode + 1;
if (mode_idx > LAST_MODE) {mode_idx = START_MODE;}
} else {mode_idx = HIDDEN_MODE;} // second click of double-click, go to hidden mode
noinit_decay = 0; // set noinit data for next boot
noinit_mode = mode_idx;
.
.
I use a 64 ms ISR and do 4 counts, but you can do it in other ways.