How-To: D4 with Anduril + Aux support (windows)

18 posts / 0 new
Last post
Pöbel
Pöbel's picture
Offline
Last seen: 2 hours 10 min ago
Joined: 02/14/2013 - 08:27
Posts: 234
Location: Germany
How-To: D4 with Anduril + Aux support (windows)

Hello Guys,

I know many of you would prefer the D4 with Anduril and Lexels AWESOME Aux Boards controlled by Anduril. So far people seem to either hard-wire the Aux boards to battery or flash the D4s Variant of Anduril/Ramping OS. While this seems to work it’s not perfect, as the D4s is different in driver components and thermal mass, which is reflected in its firmware.

I have never edited or compiled firmware before. It’s actually rather straight forward, but I did struggle a lot in the process because you have to skim info from many different threads and places. So here is my guide which hopefully makes the process easier for others.
__________________________________________________________

1 Editing the files for the D4 to enable Aux support
This is done to tell the software that the light has a board with aux LEDs. Without that step, the Aux Pad next to the switch will not work!

hwdef
cfg

1.1 Add those lines to the D4 hwdef file:

Quote:

#ifndef AUXLED_PIN
#define AUXLED_PIN PB4 // pin 3
#endif

1.2 Add those lines to the D4 cfg file:

Quote:

// the button lights up
#define USE_INDICATOR_LED
// the aux LEDs are behind the main LEDs
#ifdef USE_INDICATOR_LED_WHILE_RAMPING
#undef USE_INDICATOR_LED_WHILE_RAMPING
#endif
// enable blinking indicator LED while off
#define TICK_DURING_STANDBY
#define STANDBY_TICK_SPEED 3 // every 0.128 s
#define USE_FANCIER_BLINKING_INDICATOR

This is also a good time to adjust Anduril to your preferences. You can easily comment out additional flashing modes etc. I for instance removed bike, party and tactical modes.

2.1 Download and install Atmel Studio 7
2.2 Create a new Project “Anduril_d4aux” (Executable Project)
2.3 Paste the required files into the directory which Atmel Studio just created for your project. This is important and the main reason why I failed before.
these are located in:
…/head:/ToyKeeper/
…/head:/ToyKeeper/spaghetti-monster/
…/head:/ToyKeeper/spaghetti-monster/anduril/
Important: hwdef and cfg need to be replaced with the ones you just edited before!

2.4 Replace the code in the active Atmel Studio window for “main.c” with the code for Anduril, which you take from anduril.c
2.5 add the line to define Attiny85 to main.c (which is now anduril c)

Quote:
#define ATTINY 85

2.6 compile the code buy selecting “Build Anduril” from the menu
2.7 if you did everything right you will get no errors. Several new files are created in the working dir, one of them is anduril_d4aux.hex

3 Flashing
3.0 connect everything to the ATTINY85
3.1 get the drivers from https://protostack.com.au/shop/accessories/usbasp-avr-programmer/
3.2 get AVRDude
3.3 To test your connection! make a backup using AVRDude by running: avrdude.exe -p attiny85 -c usbasp -U eeprom:r:backup.hex:a
3.4 To finally flash run this command (the hex should be in the avrdude directory): avrdude.exe -p attiny85 -c usbasp -Uflash:w:anduril_d4aux.hex:a

4 The Aux Board needs to be soldered to the Aux Pad (the empty pad next to the switch pad) and ground (the big pad at the AMC for example).




good luck and have fun!

Edited by: Pöbel on 01/29/2019 - 07:21
USA
USA's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 11/28/2018 - 08:44
Posts: 296

Thanks for putting this together, I do all of this on linux/debian/raspbian but I like the one-stop approach. Good information. And huge thanks to the entire BLF technical team and contributors.

youmansk
Offline
Last seen: 6 months 2 weeks ago
Joined: 01/08/2019 - 15:39
Posts: 3

Does anyone have the a diagram of how the physical connections are setup? I bought one of these boards. (Still trying to figure out what resistors to use) I have never reflowed solder before so this is my first SMD build. I am not sure what resistors to use and where to place them. I understand that they will affect the brightness but I do not know what values to even try. I am not really looking to test a lot of values because I have never used SMD before. Kind of looking for someone else values. I also do not know enough about the attiny 85, so i am not sure where to connect the wires.
thanks

contactcr
Offline
Last seen: 44 min 55 sec ago
Joined: 05/19/2017 - 18:52
Posts: 2844
Location: US

Thanks, this motivated me to finally install Atmel Studio and begin playing with the Anduril code.

Even though I don’t have a D4 aux board I have been meaning to try a dual switch Anduril build for the C8F 21700 and I did get it to compile after enabling the dual switch and disabling the strobes (to make room). I guess i’ll figure out something more appropriate to strip out if this works. I followed your steps and with a little troubleshooting I got a ROT66 based build to compile (which fits my own custom C8F better I think).

Pöbel
Pöbel's picture
Offline
Last seen: 2 hours 10 min ago
Joined: 02/14/2013 - 08:27
Posts: 234
Location: Germany

yes. It actually is not that hard, unless you try to figure it out via trial and error.

I found almost all the info scattered over many blf threads and after finally succeeding I thought I should put it all together for my fellow windows buddies.

In fact its really fun to tinker with Toykeepers absolutely fantastic work.

so big shoutout to Toykeeper

MRsDNF
MRsDNF's picture
Online
Last seen: 3 min 47 sec ago
Joined: 12/22/2011 - 21:18
Posts: 12983
Location: A light beam away from the missus in the land of Aus.
Beer

 

djozz quotes, "it came with chinese lettering that is chinese to me".

                      "My man mousehole needs one too"

old4570 said "I'm not an expert , so don't suffer from any such technical restrictions".

Old-Lumens. Highly admired and cherished member of Budget Light Forum. 11.5.2011 - 20.12.16. RIP.

 

Firelight2
Firelight2's picture
Offline
Last seen: 2 hours 4 min ago
Joined: 04/08/2011 - 15:17
Posts: 3657
Location: California

Wow! Thanks for this guide!!!

Going to give this a shot once my parts arrive.

Though, I’m going to see if I can flash unmodified Anduril onto my D4. Tried last week and hit a snag and now my computer refuses to even run AVRdude.

Pöbel
Pöbel's picture
Offline
Last seen: 2 hours 10 min ago
Joined: 02/14/2013 - 08:27
Posts: 234
Location: Germany

I had absolutely no issues using those drivers linked above. Windows 10 1809 Update

Firelight2
Firelight2's picture
Offline
Last seen: 2 hours 4 min ago
Joined: 04/08/2011 - 15:17
Posts: 3657
Location: California

Pöbel wrote:
I had absolutely no issues using those drivers linked above. Windows 10 1809 Update
I don’t think my problem with Windows 10 is a driver issue.

I think somehow something I did caused Windows to see AVRdude as a hostile program and ban it. When I type “AVRdude” in the command line I get “does not have permission”. This now happens even when AVRdude is not installed.

The solution is probably to system restore to a point before Windows chose to do this. Unfortunately, I waited to long and no such system restore point exists on my computer. I suppose I could reinstall Windows but that’s way too much effort to try to get AVRdude running.

I got AVRdudess running, but I’m not sure that will actually flash anything if doing so would mimic AVRdude. Also, I can copy-paste a command line instruction to flash AVRdude, but have no idea how to use AVRdudess.

My backup plan is to try installing AVRdude on a different computer and hope it works there.

sbslider
sbslider's picture
Offline
Last seen: 25 min 12 sec ago
Joined: 01/22/2017 - 13:41
Posts: 1374
Location: United States

When I read in the D4 mod thread you had successfully did this Pobel, I told myself it was too much work to figure it all out, even though I knew the information was available. Now that you have gathered the information into one place, I can see myself doing this in the not too distant future.

Thank so much!! Beer

PocketSammich wrote: I don’t need this, but I want it. Please sign me up.

Firelight2
Firelight2's picture
Offline
Last seen: 2 hours 4 min ago
Joined: 04/08/2011 - 15:17
Posts: 3657
Location: California

Just took a closer look at the first steps for modifying the hex file and I’m majorly confused. Tired

Questions:

Question 1. Step 1 of the guide says to modify the hwf and cfg files and provides links. I downloaded the files from the links, but what do I use to edit them? When I tried notepad, the content of the files comes out in one big line with no returns. Is there a better app for editing these files?

Question 2. Step 2.3 provides three links and says go there and download the “required files” for Anduril.

… but which files are the “required files”? There’s a lot of files on those links and no list of which ones I need?

These questions probably sound dumb to the experienced programmers here. Unfortunately, I know nothing about programming and would rather not mess up a functioning light if I can help it. Shocked

Perhaps it would be easier if someone posts a complied D4 Anduril hex file where the only thing changed is enabling the aux LEDs? Smile

Pöbel
Pöbel's picture
Offline
Last seen: 2 hours 10 min ago
Joined: 02/14/2013 - 08:27
Posts: 234
Location: Germany

use notepad++ to edit

the files you need to download are those in the picture below. these are located in the 3 directories linked above the picture

do a backup before flashing so you can always go back

Firelight2
Firelight2's picture
Offline
Last seen: 2 hours 4 min ago
Joined: 04/08/2011 - 15:17
Posts: 3657
Location: California

Stuck those files in the directory. Checked that I had each one. Used Notepad++ to make the edits. Downloaded and installed Atmel7.

No luck. Compiled failed, got a couple error messages.

Closed Atmel and tried opening up my project again to find the error message but this time I don’t even see an option to build the project. GRRRR! Evil

I really have zero interest in customizing Anduril other than turning on aux LED support for the D4. Any chance I could get your hex file since we know it works?

moderator007
moderator007's picture
Offline
Last seen: 4 hours 35 min ago
Joined: 12/23/2012 - 04:47
Posts: 3100
Location: North Carolina

Nice write up. This should help a lot!
One thing that I might add to this to make it easier. They can be a little finicky at times but a lot easier than soldering wires.
https://www.amazon.com/CPT-063-Test-Clip-SOIC8-Pomona/dp/B00HHH65T4

Pöbel
Pöbel's picture
Offline
Last seen: 2 hours 10 min ago
Joined: 02/14/2013 - 08:27
Posts: 234
Location: Germany

absolutely – I now have one of these as well, but at the time of writing it was still in the mail and I did not want to wait Big Smile

@firelight
I sent you a pm

Firelight2
Firelight2's picture
Offline
Last seen: 2 hours 4 min ago
Joined: 04/08/2011 - 15:17
Posts: 3657
Location: California

Thanks for the pm Pobel. I sent a response. Thumbs Up

youmansk
Offline
Last seen: 6 months 2 weeks ago
Joined: 01/08/2019 - 15:39
Posts: 3

Firelight2 wrote:
Stuck those files in the directory. Checked that I had each one. Used Notepad++ to make the edits. Downloaded and installed Atmel7.

No luck. Compiled failed, got a couple error messages.

Closed Atmel and tried opening up my project again to find the error message but this time I don’t even see an option to build the project. GRRRR! Evil

I really have zero interest in customizing Anduril other than turning on aux LED support for the D4. Any chance I could get your hex file since we know it works?

Me too, Does anyone already have a link to the d4 aux led function already compiled?
thanks

Anthon
Offline
Last seen: 1 hour 17 min ago
Joined: 09/07/2015 - 10:33
Posts: 577

I tried to compile the firmware but I failed

did someone did this? It would be great if someone could compile the original stock Anduril for D4 with aux led enabled