ToyKeeper / anduril

Anduril 2 Flashlight Firmware and FSM UI Toolkit
GNU General Public License v3.0
226 stars 56 forks source link

enh: generate config summaries at compile time #42

Open fiveseven808 opened 8 months ago

fiveseven808 commented 8 months ago

Running firmware 311-2023-12-03

Steps to reproduce:

Result: Light does nothing, no tactical mode, still in ramp mode

Expected result: Tactical mode

A bit disappointed as tactical mode is my new favorite mode and has me finally truly moving off of surefires with my other lights. The FWXX series would be amazing to have tactical mode on. Thank you for all of your hard work!

SammysHP commented 8 months ago

The FW3A has an older driver with not enough memory for all features.

fiveseven808 commented 8 months ago

Any idea how I can go about make a special build with features I don't care about but add in tactical mode? I see in the fw3a anduril.h on line 51 there's #undef USE_TACTICAL_MODE

Looks like I can comment that out, but I'm not sure how to figure out what other features I can disable, as well as figure out if the compiled build will fit on the FW3A?

fiveseven808 commented 8 months ago

I think I figured out what I can #undef in anduril.c lines 157ish to 218ish?

Any idea how to figure out what particular size I'm shooting for?

SiteRelEnby commented 8 months ago

The easiest way is just to build it, and the build will fail if it's over the limit.

If you fork it in github you can use the CI workflows to build as well, or can use https://github.com/SiteRelEnby/anduril-buildenv-docker.

In general stuff I usually find good ones to get rid of are SOS mode, simple UI, any other strobes you don't necessarily need (party strobe, lightning storm, etc), but there are lots of other small features you can play with, in general removing SOS mode should get you most of the way there on most lights.

SammysHP commented 8 months ago

The FW3A needs a lot of memory for the ramping tables because it has three main channels. Thus you have to remove some more features. Sunset mode might be a good candidate, also all the fancy strobe modes.

fiveseven808 commented 8 months ago

@SiteRelEnby Thanks! Exactly what I need to know

@SammysHP That makes sense. I was trying to compare with the D4 which looks like it still has Tactical Mode enabled. Thanks!

Question, I also have a FET + 1 FW3A that came with Anduril 2 and appears to be have come with the BLF GT Mini firmware. Since it only has 2 main channels like the D4, is there any obvious reason why Tactical mode was omitted in the anduril header for the BLF GT Mini?

fiveseven808 commented 8 months ago

Ok so I was able to flash both my FET+1 FW3As and FET+7+1 FW3A with tactical mode!

FET+1 definitely ran the BLF GT Mini firmware. I actually enabled everything in the blf-gt-mini anduril.h and removed the defines for the lighted button. This thing is running everything but SOS mode! I suppose that's one thing this "gimped" FW3A is good for? Max for 1x7135 is level 65 it seems? level 65 is fine for most tasks around the house. I don't really miss the 7x7135s everyone else whines about. I'm normally not in that level, and if I am its not very often. My tactical mode levels are set to 150 and 65 because of this new information.

On the FET+7+1 SOS was removed by default, but it still didn't want to compile with tactical mode. I removed the sunset timer and that was enough to make space for tactical mode. I certainly never use it. Not entirely sure what the purpose of it is for. Night light for kids?

Anyway, I'm happy that my FW3A/FW1As are getting massively upgraded IMO!

Even though I've solved my own personal problems moving forward I'm going to leave this issue open for the following reasons:

I can't program very well but I'd be interested in building out a document trying to outline how a windows user can modify and compile firmware? That'd be kind of cool! There doesn't seem to be a generic "how to modify anduril" guide yet!

SiteRelEnby commented 8 months ago

Yeah, it's something I've had on my mind for a while, question of finding the time and the spoons.

ToyKeeper commented 8 months ago

is there any obvious reason why Tactical mode was omitted in the anduril header for the BLF GT Mini?

To make enough room for the firmware to fit. The GT-Mini takes extra space to add support for the lighted button... which doesn't even exist on FW3A. So if you need more room, remove the lighted button features. Lumintop didn't follow the proper dev procedures for a lot of their lights, so they ship with firmware which was never intended for those lights.

You already figured this out though.

I propose that at minimum a README file gets put in the directory of all lights

I agree. And ideally, I'd like to generate some of the config info automatically, to ensure it stays in sync with the actual code. I'm thinking of adding something to the compile process so that, after the preprocessor generates the full merged code file, something could parse that to determine the state of various options, and generate a summary in a consistent format. It already generates that post-processed source file... it just needs an extra script to pull relevant options out of it and dump them into a new file which is easier to read.

Although not the original intent of this bug, I'm going to re-title it to indicate that the compile script needs to generate a config summary. This could then be included in the readme or in a feature table or ... whatever. Details for that are yet to be determined, but the data should be available in a format which is simple to parse and read.