Flashlight Firmware Repository

2180 posts / 0 new
Last post
Quadrupel
Quadrupel's picture
Offline
Last seen: 1 hour 6 min ago
Joined: 12/03/2017 - 10:40
Posts: 132
Location: LT

Yes.. looks complicated and its for clicky nanjang driver. Maybe ill try to reduce ramping table in Anduril or something Question

Lexel
Lexel's picture
Offline
Last seen: 19 hours 37 min ago
Joined: 11/01/2016 - 08:00
Posts: 5564
Location: Germany

I am even too stupid to get that Bazaar to open your trunk, the plenty URLs I tried do not work
Anduril does not work properly with temp reading

the Wiki gets it for granted you know which link and how to add and don’t even give any examples

with https://

I downloaded every single file to my PC manually and replaced the old ones, its still reading garbage then it seems to read correctly after running it a while
but testing the driver with heat applied does not adjust output at all

Agro
Agro's picture
Online
Last seen: 1 min 9 sec ago
Joined: 05/14/2017 - 11:16
Posts: 5284
Location: Ślōnsk

You’re using a website that presents the repository rather than the repository.
The website shows that you should use “bzr branch lp:~toykeeper/flashlight-firmware/fsm” command.
With your UI you may try to enter “lp:~toykeeper/flashlight-firmware/fsm” URL.

Lexel
Lexel's picture
Offline
Last seen: 19 hours 37 min ago
Joined: 11/01/2016 - 08:00
Posts: 5564
Location: Germany
Agro wrote:
You’re using a website that presents the repository rather than the repository. The website shows that you should use “bzr branch lp:~toykeeper/flashlight-firmware/fsm” command. With your UI you may try to enter “lp:~toykeeper/flashlight-firmware/fsm” URL.

Those people who write this bazaar wiki seem to think everyone is an expert programmer and know all the basics

with your link I get this error

Please all I am asking is a zip or similar container with a working Anduril build for AS7

.

I am wasting again now almost 4 hours on this and can’t build drivers in that time for the community and I have not much time at all right now for weeks and its not looking better this year

I am close to quit Anduril with a March build like I did with NarsilM v1.2 and support no newer versions anymore

Lexel
Lexel's picture
Offline
Last seen: 19 hours 37 min ago
Joined: 11/01/2016 - 08:00
Posts: 5564
Location: Germany

Now I seem to got it working but I run into serious code overflow problems using FW3A with Aux LED support

contactcr
Offline
Last seen: 4 hours 8 min ago
Joined: 05/19/2017 - 18:52
Posts: 2910
Location: US
Lexel wrote:
Now I seem to got it working but I run into serious code overflow problems using FW3A with Aux LED support

IMO, tell buyers they can have AUX support OR muggle mode but not both. Commenting out muggle saves a lot of space

treellama
Offline
Last seen: 2 hours 50 min ago
Joined: 12/08/2018 - 21:20
Posts: 83
Location: Pittsburgh

Add -fwhole-program to the CFLAGS in build.sh, and comment out #define USE_VERSION_CHECK from anduril.c (or USE_BIKE_FLASHER_MODE or another mode if you really need the version check)

Lexel
Lexel's picture
Offline
Last seen: 19 hours 37 min ago
Joined: 11/01/2016 - 08:00
Posts: 5564
Location: Germany
contactcr wrote:
Lexel wrote:
Now I seem to got it working but I run into serious code overflow problems using FW3A with Aux LED support

IMO, tell buyers they can have AUX support OR muggle mode but not both. Commenting out muggle saves a lot of space

#ifdef USE_BIKE_FLASHER_MODE
#undef USE_BIKE_FLASHER_MODE
#endif
#ifdef USE_PARTY_STROBE_MODE
#undef USE_PARTY_STROBE_MODE
#endif

disable 2 strobe modes works as well 99.7% full now

treellama wrote:
Add -fwhole-program to the CFLAGS in build.sh, and comment out #define USE_VERSION_CHECK from anduril.c (or USE_BIKE_FLASHER_MODE or another mode if you really need the version check)

I got absolutely no idea how to do that, that file is not even on the dependencies list in my project

This is the code when open in my Editor

Quote:

#!/bin/sh

UI=anduril

date ‘+#define VERSION_NUMBER “%Y%m%d”’ > version.h

for TARGET in cfg-*.h ; do NAME=$(echo “$TARGET” | perl -ne ‘/cfg-(.*).h/ && print “$1\n”;’) echo “===== $NAME =” ATTINY=$(grep ‘ATTINY:’ $TARGET | awk ‘{ print $3 }’) if [ -z “$ATTINY” ]; then ATTINY=85 ; fi echo ../../../bin/build.sh $ATTINY “$UI” “-DCONFIGFILE=${TARGET}” ../../../bin/build.sh $ATTINY “$UI” “-DCONFIGFILE=${TARGET}” mv -f “$UI”.hex “$UI”.$NAME.hex
done

I use a simple build “Anduril” project button with my mouse
I use no scripts or make file or other stuff the programmers are always talking of to build 20 versions at once with different settings in them

v

treellama
Offline
Last seen: 2 hours 50 min ago
Joined: 12/08/2018 - 21:20
Posts: 83
Location: Pittsburgh

My bad, I should have realized using Atmel Studio doesn’t use that build.sh. You might be able to get back some space by adding the -fwhole-program flag to the miscellaneous flags here:

But I haven’t tried it. I’m not set up to compile for AVR.

Lexel
Lexel's picture
Offline
Last seen: 19 hours 37 min ago
Joined: 11/01/2016 - 08:00
Posts: 5564
Location: Germany

I cant find even that menu you opened

then add “-fwhole-program” ?

PS seems to save 126 Bytes but are there any problems with firmware stability?

treellama
Offline
Last seen: 2 hours 50 min ago
Joined: 12/08/2018 - 21:20
Posts: 83
Location: Pittsburgh

Right click on the project in the solution explorer at the right, and choose Properties, to find the menu I showed. Then add the -fwhole-program to that huge list of flags in Miscellaneous (or maybe to the shorter list in Optimization). The flags are separated by spaces, and are what get passed to the compiler I use on the command line instead.

If it still gives you trouble, and you’re willing to wait a few days, I can try to set up Atmel Studio for AVR myself and give it a try.

Lexel
Lexel's picture
Offline
Last seen: 19 hours 37 min ago
Joined: 11/01/2016 - 08:00
Posts: 5564
Location: Germany

treellama wrote:
Right click on the project in the solution explorer at the right, and choose Properties, to find the menu I showed. Then add the -fwhole-program to that huge list of flags in Miscellaneous (or maybe to the shorter list in Optimization). The flags are separated by spaces, and are what get passed to the compiler I use on the command line instead.

If it still gives you trouble, and you’re willing to wait a few days, I can try to set up Atmel Studio for AVR myself and give it a try.

99.9% with that option with all features enabled


Compression from this flag:
strobe modes like crazy 148→ 6 Bytes for tactical strobe
lightning mode gets a good compression from this option

treellama
Offline
Last seen: 2 hours 50 min ago
Joined: 12/08/2018 - 21:20
Posts: 83
Location: Pittsburgh

-fwhole-program wasn’t my idea, it was Agro’s from the FSM thread. It shouldn’t affect stability.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 12 hours 43 min ago
Joined: 01/12/2013 - 14:40
Posts: 10141
Location: (469219) 2016 HO3
Chatika vas Paus wrote:
Tried to compile rampingUI (the original from D4) and I have two errors: The program has not been modified. What to do with this?

Oh, er, the “ramping-ui” firmware was never shipped on the D4. I think you’re probably looking for RampingIOS. V2 is under the Tom_E directory, and V3 is in the spaghetti-monster directory.

ZozzV6 wrote:
Hello! Yesterday I got my MF01 mini and it got Anduril. I did not find a specific version of Andutil for this one. Maybe Astrolux used the MF01S Anduril?

It’s configured in cfg-mateminco-mf01-mini.h, but it’s in the fsm branch along with all the other recent development. The trunk branch is only updated occasionally.

f0xx wrote:
On this thread HERE it seems that Hank has put a new driver in the D1.

User cuberS seems to have a D1 with an ATtiny1634 (he has flashing pads and the MCU signature matches the ATtiny1634), but I haven’t find any firmware in the repository for such a light. He flashed the ATtiny85 firmware and it does not work. Is there a firmware he can flash to rescue his light?

That’s really interesting. I’ve heard a couple other reports of similar things too. I didn’t make a D1 tiny1634 build target, so it’s probably using a D4 V2 driver.

That should work okay, I suppose. Not much is different between the two configurations. But the thermal regulation might act a little weird, pulling the output down faster than necessary. I haven’t tried a D4 V2 firmware build in a D1, so I’m not sure if the thermal response is okay.

dropman wrote:
how to disable FET mode on FW3A completely

Hi, sorry about that. I forgot to add the FETless FW3A build target…

… until you reminded me just now.

It’s now included in the repository as cfg-fw3a-nofet.h.

http://toykeeper.net/torches/fsm/anduril.2019-12-03.fw3a-nofet.hex

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 12 hours 43 min ago
Joined: 01/12/2013 - 14:40
Posts: 10141
Location: (469219) 2016 HO3
Dr.Phillip wrote:
Do I need a special compiler (I am using windows)? … Could anyone please recommend me the best and the easiest way to do this?

Pretty much, yes. It needs to be in its native build environment unless you really know what you’re doing.

To set that up in Windows, step 1 is to install WSL. Either the Debian flavor or Ubuntu flavor should work.

From there, it’s mostly a matter of following the README in the code repository. There are a few commands to run to install other tools, and then the “make” tool should work.

Technically, it can be compiled in Atmel Studio, but it’s not easy and, as shown earlier on this page, people run into a lot of problems trying to do it that way. It’s not supported or recommended, and is an easy way to get headaches or bugs.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 12 hours 43 min ago
Joined: 01/12/2013 - 14:40
Posts: 10141
Location: (469219) 2016 HO3

0-8-15 User wrote:
I recently got my hands on a used Sofirn SP36 Anduril and found that the temperature limit is exceeded by more than 10 K, although the measured temperature is relatively accurate. This made me curious, especially since I recently ordered some Emisar D4V2s. So I wrote a little simulation to test the thermal regulation code.

Thermography:
https://abload.de/img/heatup_sp36_16x_60fpsgbkwn.gif

Measurement result: https://abload.de/img/anduril_run-2tak3r.png

Simulation result (revision 388): https://abload.de/img/anduril_temp_regulatin1jcj.png

Simulation result (revision 454): https://abload.de/img/anduril_temp_regulatirtjec.png

Simulation result (mockup of how it could look like): https://abload.de/img/anduril_temp_regulatikzk6h.png

There is a lot of magic involved to prevent the current thermal regulation from exploding, I think there is need for another rewrite. I’ll probably give it a try once my D4V2 arrives.

Hi, sorry about the delay in responding. There has been a lot to do… any help with thermal regulation would be really appreciated though. Smile

It’s the part of the code I’ve struggled the most with, and a rewrite is definitely not a bad idea. The abstractions used make it a harder problem than it probably should be, but I haven’t found any good alternatives which still allow the UI and hardware abstractions the system is based on. In particular, keeping it portable across lots of different hardware. A fresh pair of eyes looking at it would be really helpful.

treellama
Offline
Last seen: 2 hours 50 min ago
Joined: 12/08/2018 - 21:20
Posts: 83
Location: Pittsburgh

How do you feel about C++? I know it’s controversial. constexpr math would allow the compiler to create ramps, so no external script would be needed. Also, templates would allow a more abstract PID to be adapted to specific hardware.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 12 hours 43 min ago
Joined: 01/12/2013 - 14:40
Posts: 10141
Location: (469219) 2016 HO3
treellama wrote:
How do you feel about C++? I know it’s controversial. constexpr math would allow the compiler to create ramps, so no external script would be needed. Also, templates would allow a more abstract PID to be adapted to specific hardware.

I’ve done C++ on embedded systems a couple times. It’s definitely possible. I don’t think it would help anything in this case though. Ramp creation and per-hardware code selection haven’t really been issues. Switching has costs though, at least in terms of time but also potentially in terms of code size. Some build targets are already at 99.8% full, and a change of language could easily push them over the limit.

There’s certainly an argument to be made for moving the ramp shape calculations from a table to an onboard formula, since working in units of linear power instead of perceptual brightness would probably make the thermal code a lot more reliable. But that’s unrelated to the language the code is written in.

SammysHP
SammysHP's picture
Offline
Last seen: 3 hours 10 min ago
Joined: 06/25/2019 - 14:35
Posts: 224
Location: Germany

I think treellama meant that the compiler will calculate the ramps.

Btw. a user at TLF (and who already contacted you here) wrote a new regulation that is absolutely amazing (at least in the simulation). Just not implemented in Anduril.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 12 hours 43 min ago
Joined: 01/12/2013 - 14:40
Posts: 10141
Location: (469219) 2016 HO3
SammysHP wrote:
I think treellama meant that the compiler will calculate the ramps.

Yeah, that’s what I was assuming too. But there are reasons why it doesn’t calculate the ramp values on the fly, either at compile time or at run time. The ramp generally needs very careful fine-tuning to make it work well, and often even needs the calculated values modified by hand. The ramp calculator is a good start, but it doesn’t get us 100% of the way to the values the program needs.

SammysHP wrote:
Btw. a user at TLF (and who already contacted you here) wrote a new regulation that is absolutely amazing (at least in the simulation). Just not implemented in Anduril.

Yeah, it sounds really promising! It sounds like things are waiting on shipping at the moment.

treellama
Offline
Last seen: 2 hours 50 min ago
Joined: 12/08/2018 - 21:20
Posts: 83
Location: Pittsburgh

I suppose I hadn’t considered the need to hand-tune ramps. I’ve been replacing table generation scripts with compile-time generation and it seemed like the ramp would be a good candidate for that. An abstract perceptual-to-linear interface would also make it easier to do things like interpolate between ramp values for smoother ramps on small firmware.

But not if they need handed-tuned!

Chatika vas Paus
Offline
Last seen: 21 min 37 sec ago
Joined: 09/03/2017 - 13:46
Posts: 649
ToyKeeper wrote:
Chatika vas Paus wrote:
Tried to compile rampingUI (the original from D4) and I have two errors: The program has not been modified. What to do with this?

Oh, er, the “ramping-ui” firmware was never shipped on the D4. I think you’re probably looking for RampingIOS. V2 is under the Tom_E directory, and V3 is in the spaghetti-monster directory.

Yeah, I was in a bit of a hurry with that, so I decided pm to you Smile You don’t come here often, do you? Anyway, thank you for your help.

0-8-15 User
Offline
Last seen: 31 min 35 sec ago
Joined: 11/25/2019 - 17:07
Posts: 50

ToyKeeper wrote:
It sounds like things are waiting on shipping at the moment.
Yes, but my D4V2s arrived yesterday, the Reflashing kit is still on its way. The firmware revision on my D4V2s is <= 450. The temperature target is set to 45 °C and the temperature sensor is properly calibrated.

Measurement results:

Quadrupel
Quadrupel's picture
Offline
Last seen: 1 hour 6 min ago
Joined: 12/03/2017 - 10:40
Posts: 132
Location: LT

I think the problem is that 7135 heats up driver and attiny85 measuring bogus temperature. Why just not turn off 7135 in high modes? After 350mA there is no stabilization anyway.

0-8-15 User
Offline
Last seen: 31 min 35 sec ago
Joined: 11/25/2019 - 17:07
Posts: 50

The opposite seems to be the case. The temperature sensor lags behind massively.

See: http://budgetlightforum.com/comment/1599982#comment-1599982

dstahlke
Offline
Last seen: 1 week 5 days ago
Joined: 11/13/2019 - 00:48
Posts: 1

A branch with a much improved strobe mode (D4v2 only). It can “freeze” a motor that’s spinning at 20000 RPM, just like a professional strobe!

https://code.launchpad.net/~i-dan-3/flashlight-firmware/pwm-strobe

———————-

Added accurate 16-bit PWM strobe modes

Disabled by default. Only supported on CPUs having a 16-bit PWM, which means only attiny1634, which means only Emisar D4v2 and D4Sv2. I don’t have a D4Sv2 to test, so currently it’s only implemented on D4v2. The relevant functions could probably be directly copied from hwdef-Emisar_D4v2.h to hwdef-Emisar_D4Sv2.h.

Strobe rate can be continuously varied from 1Hz to 500Hz. Theoretically it could run faster, but this is already enough to freeze something that’s spinning at 30000 RPM. Uses full brightness (1×7135 plus FET) with a 1:256 duty cycle (party strobe) or 1:4 duty cycle (tactical strobe). Rate adjustment has acceleration, going twice as fast after 1 second and 4x as fast after 2 seconds. It still takes about 10 seconds to traverse the whole range from 1Hz to 500Hz.

With this I was able to freeze my Proxon drill (similar to Dremel) running at 20000 RPM. Unfortunately the flash rate fluctuates by about 0.1%, probably due to the CPU’s RC oscillator.

Quadrupel
Quadrupel's picture
Offline
Last seen: 1 hour 6 min ago
Joined: 12/03/2017 - 10:40
Posts: 132
Location: LT

Anduril have no indicator led LVP ? Aux leds maybe off, but indicator led keeps shining until battery kaputt Wink

Maybe this line have to be fixed?

#if defined(USE_INDICATOR_LED) && defined(TICK_DURING_STANDBY)
// beacon-like mode for the indicator LED
void indicator_blink(uint8_t arg) {
// turn off aux LEDs when battery is empty
if (voltage < VOLTAGE_LOW) { indicator_led(0); return; }

In blinking mode LPV works , but in low or high modes not at all.

Agro
Agro's picture
Online
Last seen: 1 min 9 sec ago
Joined: 05/14/2017 - 11:16
Posts: 5284
Location: Ślōnsk

No, I believe it’s this place:

// TODO: turn off aux LED when power is really low if (0) {} // placeholder

So…it seems simply unimplemented yet
You may try adding

// turn off any aux LED when power is really low
#if defined(USE_INDICATOR_LED)
indicator_led(0);
#endif
#if defined(USE_AUX_RGB_LEDS)
rgb_led_set(0);
#endif
#ifdef USE_BUTTON_LED
button_led_set(0);
#endif

There.

EDIT: upgraded the code
ADDED: Note that if the flashlight is on it will turned off when LVP fires. It needs to be checked whether turning it off won’t turn the aux LEDs back on.

Quadrupel
Quadrupel's picture
Offline
Last seen: 1 hour 6 min ago
Joined: 12/03/2017 - 10:40
Posts: 132
Location: LT

Thanks, but i dont know how to do it, im not a coder.

0-8-15 User
Offline
Last seen: 31 min 35 sec ago
Joined: 11/25/2019 - 17:07
Posts: 50

ToyKeeper wrote:
I was thinking about left-shifting the values and maybe increasing the sample rate, with the values still going through a lowpass…
Yes, and in an ideal world the ADC post-processing (averaging and decimation) would be separate from the rest of the code.

Edit: An obvious change would be to oversample the ADC readings instead of skipping three out of four ticks

0-8-15 User wrote:
The opposite seems to be the case. The temperature sensor lags behind massively.
Sensor lag time test results (all lights were programmed to shut off at 50 °C):



Pages