Anduril ... 2?

I still get this bug as well on latest Gchart revision. When the voltage is at orange or red, the LEDs alternate between the correct color and white, it’s strange that nobody else is reporting this.

View post on imgur.com

This isn’t exactly a bug, but a compromise to smaller code and less memory usage.
It happens when the ADC is on a margin of reporting one count less or one more, because measurement is between a quantisation threshold and there is the internal inaccuracy.

It would be easy to make a directional state follower by using a byte of RAM and a few IFs, but I can not make contributions to the code, not being capable of the launchpad/bazaar system.

Maybe roll your own.

fwiw, I do have my Anduril lights set up to use 3H from Off to get to Strobe.

3H from On with my SP10 Pro gives momentary Maximum…
(3H from On does nothing on my FWAA)

imo it would be fine to alter a Hex file to give Strobe with 3H from On. Or even, add another User Option to Anduril, to select 3H from on to give either Momentary Strobe or Momentary Maximum.

Except for lights that have tint ramping, which already uses 3H from On.

It’s not that, e.g. alternating between yellow and green because it’s close to the 3.5V green/yellow voltage threshold, I know this happens, it’s not a problem.
Here it does that from 3.5V to 2.9V, all the time, and it alternates with white, which is 4.4V, not the voltage color above or under.

Rereading Valynor comment, his is alternating between red and green, not exactly the same, but they are still not successive voltage colors.

Is it possible to disable LVP ?

My guess is #undef USE_LVP (defined in config-default.h)

Thanks, I should have checked better.

It doesn’t work though :

edit : Pastebin link because the error log is a bit long

Seems like it needs some refactoring to me, if you want it to compile (I’m looking at gabe fork r625) in file fsm-adc.h comment/remove line 79 and 30 (#ifdef USE_LVP … #endif), only those lines.

There is a nested “#ifdef USE_LVP” in there, I don’t know why there is an outer one. I don’t know this codebase and I’m no C/C expert so I don’t really know how it should be handled properly.

Thank you very much for looking into it, now it just say this and build successfully :

In file included from …/fsm-states.h:23,
from …/spaghetti-monster.h:32,
from anduril.c:92:
…/fsm-adc.h:59:20: warning: ‘ADC_voltage_handler’ declared ‘static’ but never defined [-Wunused-function]
59 | static inline void ADC_voltage_handler();
| ^

I’ll test the driver with this.

:+1:

You can ignore that or wrap/move it (line 66 “static inline void ADC_voltage_handler();”) in a #ifdef USE_LVP section

file fsm-adc.h

#define VOLTAGE LOW 29 to whatever you like like 22 ( 2.2V)

Thanks but I needed to completely disable it.

When it will not compile, no way ;))

Currently Anduril doesn’t compile without LVP, because things like battcheck depend on USE_LVP. A workaround is to start with the official source code and remove the content of low_voltage() in anduril.c.

Well what bitew told me worked (thanks again) and I could test my driver, it works very well aside from the Vbatt voltage divider pin, I don’t exactly know what is the issue with it. Before disabling LVP I had the Anduril boot up flash but the button was unresponsive, no Enable or DAC signal so I suspected it was LVP/voltage divider.
The driver has a regulated boost converter for powering the MCU at 3V, below 3Vbatt Vcc=3V and above 3Vbatt Vcc=Vbatt, so of course a voltage divider is needed to read the battery voltage. Except at 3Vbatt and under I measure 2.34V on the voltage divider pin, and it increases slightly above 3Vbatt. With the 330k/100k divider I should get 0.7V at 3Vbatt, it looks to me that it is being pulled up by the MCU. No short with the pins (pulled up) directly next to it, maybe it’s the voltage divider pin that is pulled up, maybe a mistake in my hwdef file, or maybe the pin is defective ??

Here’s my hwdef file

The SP10S PRO hwdef has some fuse settings, I don’t know what they’re for.

Edit : I just realised that for testing without LVP I could have just removed the voltage divider code and the MCU would have read VCC=3V or higher at all Vbatt.

The only non-default fuse setting should be enabling BOD while active. Sofirn noticed that if you smack the SP10 Pro on a table a few times, eventually the momentary loss of power could lock up the MCU and you’d need to break the power to get it to come back on. Enabling BOD addressed this.

I just took a quick glance at the hwdef, I don’t see anything glaringly wrong. You could probably decrease the MCU clock speed, but that shouldn’t have much affect on standby drain since the MCU is sleeping. It does still need to wake up and take ADC readings, so that contributes some to standby drain.

OK thanks for checking.
I just tried banging my PL09, it also has a button so that can disconnect the power, it always turn on without issue, so it’s probably something specific with the SP10 Pro rather than the T1616.
Regarding undercclocking, there is dynamic underclocking, so 2.5MHz at the bottom of the ramp IIRC.

I reflowed another T1616 and now it works :slight_smile:

I just finished assembling my nimh/li-ion FWAA and I noticed the AUX LEDs don’t work with Nimh :frowning: I guess the LVP for the AUX doesn’t take into account the second lower working voltage range ?