E-switch UI Development / FSM

1034 posts / 0 new
Last post
bquinlan
Offline
Last seen: 2 months 4 weeks ago
Joined: 04/19/2018 - 01:07
Posts: 125
Location: Madison, Wisconsin, USA

I’m not sure this is the right place to ask, but will files for the Astrolux HL01 eventually be added to the /torches/fsm/ download list? I’m not yet sure how to hook up that light for flashing, but I’m sure it can be done. And I always get a kick out of upgrading. Smile

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 hour 59 min ago
Joined: 01/12/2013 - 14:40
Posts: 10810
Location: (469219) 2016 HO3
bquinlan wrote:
will files for the Astrolux HL01 eventually be added to the /torches/fsm/ download list?

That probably depends on whether Astrolux gives me a copy of the source code they used.

It’s one of like a dozen apparent license violations I’ve been meaning to chase down…

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

ToyKeeper wrote:
Otherwise, get it hot, calibrate the sensor to tell it it's only 1 degree, and set the ceiling as high as it can go... 70 C or 40 clicks. That should give it a lot of headroom. Not guaranteed to completely disable regulation, but it should at least reduce the chance of ever stepping down.

With the new Haikelite HK04 (quad XKP50.2) on VTC6D cells and spring bypasses, the max of 70C doesn't give me 30 secs, best I can get is ~22 secs. I need a bit more headroom. Sure would have been nice to know this 70C max limit - I've been clicking 50 times, 60 times, 70 times over and over again - no idea, til i came across this thread and this post in this other thread: http://budgetlightforum.com/comment/1608312#comment-1608312.

Could you please at least update the latest Anduril manual in the repository with this limit? That should be the ultimate ref. I re-read a "few" of the hard copy Anduril manuals I got and couldn't find it.

Btw, I don't see any config file in the repository for the HK04 - is HL doing this stuff on their own? Funny - their website doesn't exist anymore, or is temporarily down, dunno - used to be Haikelite.top.

Update: forgot to mention it's a quad XHP50.2, measured 37 amps at a min on full turbo (before spring bypasses added), does about 15,000 lumens at start and is the size of a SP36, so yes, it does get hot. Maybe even a max of 80C would be fine.

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

ToyKeeper wrote:
Cereal_killer wrote:
Does anyone have a ready to roll atmel studio project using the newest code they'd be willing to share as a .zip? I've just been downloading precompiled hexes recently but now I need to make some code changes so I took a look and there's TONS of changes everywhere from the older early summer version my atmel studio project was last based off of.
The build has been getting more complicated over time, harder to make it work inside Atmel Studio. It simply isn't designed for the sort of things being done in this code, like having a bunch of build targets which are detected at compile time by the file names. Depending on your setup, it might be easier to use WSL (Windows Subsystem for Linux) instead of Atmel Studio, so you can use the same development tools it was made with. It basically makes a virtual container running a Linux distro. Either the Ubuntu or Debian flavors should work. From there, the instructions in the README file should be useful.

I converted Anduril to VS7 a while back, wasn't that difficult but think it took a while. Also, I seem to recall to be able to keep the code base current, it would be an effort. I know it compiled and built fine, think it was smaller code size than i expected as well - not sure of that though.

Just checked - I did this back in Dec 2018, so might not be as easy now.

bquinlan
Offline
Last seen: 2 months 4 weeks ago
Joined: 04/19/2018 - 01:07
Posts: 125
Location: Madison, Wisconsin, USA

ToyKeeper wrote:
That probably depends on whether Astrolux gives me a copy of the source code they used.

It’s one of like a dozen apparent license violations I’ve been meaning to chase down…

I really shouldn’t be surprised, but I still am. Chinese manufacturing really is the wild west. There is no law except what can be enforced at the end of a gun.

I hope Astrolux gets its act together and complies. Anduril is the reason I bought the HL01.

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

I just built the latest version, 464, of Anduril on Atmel Studio 7, latest version. The key things I did:

  • define a compile time symbol of "ATTINY=85" in the project properties->AVR/GNU C compiler->Symbols
  • if you include all the fsm-*.c files in the project as i did, for each of these .c files, set the build action for each individual file to "None" instead of compile.

That's basically it. This is what it resulted in:

   Program Memory Usage : 8122 bytes 99.1 % Full
   Data Memory Usage : 205 bytes 40.0 % Full

The other important thing is the files: where to copy them, what files to include, etc. I took the simple approach and moved them all into just one folder.

  • Started with the spaghetti-monster folder, all spaghetti-* files and all fsm-* files.
  • then in the Anduril folder, all *.c and *.h files. You can take any other text/document files you want - no harm
  • then from the root "ToyKeeper" folder, took all tk* files and all hwdef* files. You could restrict it to just the hwdef* files you need, but that gets tricky since some include others.

 

I built it for the Q8 for now, but will try others. The HL HK04 light I'd love to change to rise the max thermal limit, as defined in fsm-adc.h:

   #define MAX_THERM_CEIL 70

But the HK04, like the SP36, has the driver glued. I tried removing the switch to get access to push out the driver, but the switch has some nasty glue - I destroyed it partially in trying to get it out - never ran into this before. I killed one of the LED's. Ugh...

d_t_a
Offline
Last seen: 11 hours 25 min ago
Joined: 08/04/2017 - 23:58
Posts: 2626
Location: Manila, Philippines
ToyKeeper wrote:
bquinlan wrote:
will files for the Astrolux HL01 eventually be added to the /torches/fsm/ download list?

That probably depends on whether Astrolux gives me a copy of the source code they used.

It’s one of like a dozen apparent license violations I’ve been meaning to chase down…

So, it looks like as of now, these flashlights use Anduril, but have not released the actual source code used (ie. unknown which Anduril “build target” they were based on:

Astrolux EC01
Astrolux HL01
Astrolux FT03S

Haikelite HK04

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

Thanx TK! I see your manual update smile

bquinlan
Offline
Last seen: 2 months 4 weeks ago
Joined: 04/19/2018 - 01:07
Posts: 125
Location: Madison, Wisconsin, USA

ToyKeeper wrote:

Astrolux EC01
Astrolux HL01
Astrolux FT03S

Haikelite HK04

I sense a pattern here…

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

Can we as a community put some pressure on them to release the code?

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

How? Anyone have an email address for Mr. Astrolux or Mr. Haikelite?

Haikelite's website even disappeared.

Hhmm - Astrolux does seem to have a website: https://www.astroluxlite.com/, but of course the Contact link is dead, but the brand link does work: https://www.astroluxlite.com/support.html?article_id=5

Based on their websites, they are a mess for sure...

 

 

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

Some of our members have contacts with Mateminco and Banggood, so we kinda have an email of Mr. Astrolux.
The same is true w.r.t Haikelite.

But several devs is unlikely to be significant pressure…there must be more (many more) people who care.

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

Agro wrote:
Some of our members have contacts with Mateminco and Banggood, so we kinda have an email of Mr. Astrolux. The same is true w.r.t Haikelite. But several devs is unlikely to be significant pressure...there must be more (many more) people who care.

Well if you don't want to name names, the 2 developers I know of have business relationships with at least one of these vendors, unlike us. Plus I know they have communications problems with the vendors as it is (like not answering/repsonding for long periods of time, etc.), so even if they were willing, not sure it would be wise for them.

 

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

Would it be so bad for these members to notify the manufacturers about a thread where people rage against them? Wink

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

Agro wrote:
Would it be so bad for these members to notify the manufacturers about a thread where people rage against them? ;)

Dunno - ask them.

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

As a follow-up to post #907 above, just tested out the Atmel Studio 7 build of Anduril 464 on a Sofirn Q8 and it worked perfectly. Tweaked the thermal max temp to 85C, and checked the voltage and it's dead on so far.

 

Not sure now there's any point to go back to NarsilM for much of anything. 

 

In case anyone is interested, here's the AS7 Anduril v464 full folder with all the source code, solution and project file and it all builds, right now defaulted for a Q8 configuration, with the max temp of 85C, default to 55C:

 google drive share for Anduril

 

 

d_t_a
Offline
Last seen: 11 hours 25 min ago
Joined: 08/04/2017 - 23:58
Posts: 2626
Location: Manila, Philippines
Tom E wrote:

As a follow-up to post #907 above, just tested out the Atmel Studio 7 build of Anduril 464 on a Sofirn Q8 and it worked perfectly. Tweaked the thermal max temp to 85C, and checked the voltage and it’s dead on so far.


 


Not sure now there’s any point to go back to NarsilM for much of anything. 


 


In case anyone is interested, here’s the AS7 Anduril v464 full folder with all the source code, solution and project file and it all builds, right now defaulted for a Q8 configuration, with the max temp of 85C, default to 55C:


 google drive share for Anduril


 


 

Nice. Is it possible to post a compiled .hex file for people like me (I have a flashing kit and have successfully flash Q8s to NarsilM v1.2 and Anduril from the hex files in the repository, but haven’t tried compiling code…). Also, maybe a short list of how to configure those new settings.. Thanks!

MRsDNF
MRsDNF's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 12/22/2011 - 21:18
Posts: 13473
Location: A light beam away from the missus in the land of Aus.

Thanks TomE.

There is a hex file in the Release folder.

 

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.

 

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

smile, yep in the release folder, but of course it's only 1 possible config of many. The Q8 is the FET+1 design with the aux LED (usually switch LED) support, so I've used these driver designs in many mods.

80T
80T's picture
Offline
Last seen: 2 days 18 hours ago
Joined: 01/24/2019 - 18:11
Posts: 225
Location: Romania/Ireland

Is Anduril able to use both AUX and Indicator LED's at the same time as long as the driver has the required hardware capabilities / pins ?

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

80T wrote:

Is Anduril able to use both AUX and Indicator LED's at the same time as long as the driver has the required hardware capabilities / pins ?

Not sure what you mean by AUX and Indicator LED's? I always thought of them as two words describing the same thing. I "think" Anduril has control over one pin for AUX/Indicator controls, so you can run multiple LED's off the same pin, for example, the switch LED's and the Lexel AUX board LED's on a MF01 Mini.

 

Pin Summary

1 -  Reset (can be used for I/O but would break the popular dongles for re-programming)

2 -  switch

3 -  AUX LED, or main LED channel

4 -  GRND

5 -  main LED channel

6 -  main LED channel

7 - for 6V/12V designs used for voltage divider for voltage reading, spare for 3V designs, or AUX LED for 3 channel drivers

8 - VCC

 

Example flashlight/driver pin layouts:

 MF01-Mini driver layout
 -----------------------
  Reset -|1 8|- VCC
eswitch -|2 7|- aux LEDs
FET PWM -|3 6|- PWM (7x7135)
    GND -|4 5|- PWM (1x7135)

 Emisar D4 driver layout
 -----------------------
   Reset -|1 8|- VCC
 eswitch -|2 7|-
 AUX LED -|3 6|- PWM (FET)
     GND -|4 5|- PWM (1x7135)

 

These two layouts above represent the classic 3 channel (FET+1+bank) and 2 channel (FET+1) layout of BLF drivers.

80T
80T's picture
Offline
Last seen: 2 days 18 hours ago
Joined: 01/24/2019 - 18:11
Posts: 225
Location: Romania/Ireland

Hi Tom,

 

In Anduril the AUX LED's are the RGB front facing LED's, each one with its PWM PIN and the Indicator LED is the side switch LED, which is only 1 color, usually green. Thus far I have only seen lights using either one or the other, but never both. MF01 Mini only uses the Indicator LED PWM Channel for both the side switch LED and the front facing LED's. There is independent code in anduril.c to use any of them, but as per most lights hardware, the code is reflected as such, thus using either the Indicator or RGB AUX LED's code, but not both at once.

 

Regards.

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

Ahhh. Haven't noticed independent support in Anduril yet, but it certainly could be there. Since the Attiny85 has limited I/O pins, a 2 channel or 1 channel driver could use  pin 7 as a secondary AUX/Indicator control, but I don't know what Anduril would do with the two separate functionalities.

 Custom BLF drivers I typically use in a lot of mods are 2 channel 3V setups, so pin 7 is always available. I'll research Anduril now and look for the possible support there. I've even used 3 channel drivers as 2 channels, and not even populate the 7135 bank. This requires some switching around of the I/O pin assignments but NarsilM has support for that, so probably could be done easily in Anduril, but there's probably no existing hwdef file for it yet.

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

I have a problem with aux LED voltage indication on my D4Sv2.
When I connect power it sometimes blinks green but aside from that split second it’s never green, goes from blue directly to red.
I thought that was my bug (I still introduce many Sad ) but now checked with the TK’s latest revision and it’s not – I just put a ~3.7V cell, voltage blinkout shows 3.7 but aux LEDs are red…
I look at the code and fail to see the culprit…

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

I don't own one and there's no info about LVP indications on the product page: https://intl-outdoor.com/led-flashlights/emisar-d4sv2.html.

What is it supposed to do? Does the MCU think it's voltage is low, indicated by dropping amps?

 

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

It’s about voltage indication rather than low voltage indication. It’s a special aux LED mode which turns them blue above 3.8V, green above 3.3, red above 2.9. Below that they turn off. At least that’s what I see in the source, not in operation.
I don’t have a proper PSU, just a set of cells charged to different levels and I don’t see the exact thresholds but at 4V I see blue, at 3.7V and 3.5V I see red. In actual use I’ve never seen green.

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

Wow - this is strange. There's no manual on this light that documents how the AUX LED's work? From the UI diagram, I can only guess there is no auto setting of the color based on voltage, but you manually set the colors - it clearly shows that. Are you sure that code is relevant to this D4SV2 build?

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

Yes, it is relevant to this build. It has manual colour setting but also 2 other settings, rainbow/demo and voltage. You can set it independently for off and for lockout.
Mine is definitely in voltage readout both for locked out and for off, though I use different brightness to differentiate between them.

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

BTW I noticed something that may be (or may not be) a bug (unrelated):
{

2302-void indicator_blink(uint8_t arg) {
2303- // turn off aux LEDs when battery is empty
2304: if (voltage < VOLTAGE_LOW) { indicator_led(0); return; }
2305-
2306- #ifdef USE_FANCIER_BLINKING_INDICATOR
2307-
2308- // fancy blink, set off/low/high levels here:
2309- uint8_t seq[] = {0, 1, 2, 1, 0, 0, 0, 0,

2330-void rgb_led_update(uint8_t mode, uint8_t arg) {
2331- static uint8_t rainbow = 0; // track state of rainbow mode
2332- static uint8_t frame = 0; // track state of animation mode
2333-
2334- // turn off aux LEDs when battery is empty
2335: // (but if voltage==0, that means we just booted and don’t know yet)
2336: uint8_t volts = voltage; // save a few bytes by caching volatile value
2337- if ((volts) && (volts < VOLTAGE_LOW)) {

rgb_led_update() treats voltage of 0 specially.
indicator_blink() doesn’t.

Tom E
Tom E's picture
Offline
Last seen: 50 min 17 sec ago
Joined: 08/19/2012 - 08:23
Posts: 15001
Location: LI NY

 Dunno, depends on the state each of those is called. Maybe the state of "voltage = 0" is only relevant when rbg_led_update() is called?

 

For you AUX LED issue, dunno, maybe there is a bug in the voltage setting. For the hardware, I assume you can verify if the green LED's are working, if so, then I'd suspect a bug in the firmware. With that 1634 processor, there's plenty of I/O pins, so I assume she's got one dedicate to the green aux LED's, so if the full green setting is working, then it should work the some for voltage reading.

Ohh - it helps to use a fixed space font like Courier new for quoting code. I do this all the time.

Pages