Mike C drivers and X85 firmware.

X85 dual switch functionality

A video that describes the interfaces and special modes. Sorry about the quality, crappy mobile phone camera that couldn’t lock any brightness or focus settings.

Note: The firmware changed slightly since I made this video but I couldn’t be bothered to make a new one. The difference is with special mode 3 (programming mode brightness for UI 1 & 2 modes). I’ve removed the timeout that exits programming mode. It will now stay in constant programming mode until the light is turned off for about 5 to 6 seconds, so there is no rush to adjust those modes to perfection.

This post describes how my X85 firmware works for dual switch lights (lights with both a clicky switch and a momentary “E” switch). There are four user interfaces (UIs):

E press = Press with E-switch, P press = press with power switch.

UI 1
Next mode: Short E or P press.
Previous mode: Long E or P press.
Boost: In mode cycle.

UI 2
Next mode: Short P press.
Previous mode: Long P press.
Boost: E press (not in mode cycle). Hold for 1.5 seconds to lock.

UI 3
Adjust mode: Short P press enables mode adjustment (indicated by three quick flashes).
Boost: E press. Hold for 1.5 seconds to lock.

UI 4
Adjust mode: Constantly adjustable.
Boost: Not available, UI 4 mode is adjustable all the way up to maximum output.

Adjusting output in UI 3 and 4:
Increase brightness: E press and hold.
Decrease brightness: Double E press, hold on second press.

UI 3 mode adjusting times out after about one second of no activity. A flash indicates timeout and the new brightness level is saved.
UI 4 mode adjusting always available. Timeout for saving is the same, but no flashes to indicate timeout.

Setup
The setup menu and all other features are accessed by holding the E-switch pressed while turning on the light, counting the amount of blinks that correspond to the menu of interest and then releasing the E-switch. Directly after releasing, additional E-switch presses access settings under that specific menu, and then additional presses to modify that specific setting. If no additional presses are entered directly after releasing the E-switch from the first blink out menu, the light will in most cases perform a readout of some sort. Also, single long presses (L) are in some cases detected (holding E-switch for about a half second).

Copying in the text with setup info into here looked crap so I put it here instead: http://www.mikec.se/Stuff/SetupDsw.txt
Left column is blink counts while holding E-switch on startup. Columns to the right are by pressing X number of times.

Examples
These are the steps to set the UI.
1: Turn on light with E-switch pressed.
2: Count 1 blink then release the E-switch.
3: Immediately after releasing E-switch in step 2, press 1 to 4 times quickly to select UI 1 to 4.
4: The light will flash a sort of “entry accepted” blink (fade in, fade out). Done.

To engage the safety lockout feature, follow the steps above except for step 3:
3: Immediately after releasing E-switch in step 3, press and hold the E-switch for about half a second.
When locked, the light blinks every now and then. To unlock from safety lockout, either repeat or set any UI as in first example.

To readout the voltage level:
1: Turn on light with E-switch pressed.
2: Count 1 blink then release the E-switch.
3: The light now flashes 1 to 5 times depending on cell voltage level. If it does a fade out instead of blink, the level is below level 1.

X85 off switch functionality

A video that describes the interfaces and special modes. Sorry about the quality, crappy mobile phone camera that couldn’t lock any brightness or focus settings.

Note: The firmware changed slightly since I made this video but I couldn’t be bothered to make a new one. The difference is with special mode 3 (programming mode brightness for UI 1 & 2 modes). I’ve removed the timeout that exits programming mode. It will now stay in constant programming mode until the light is turned off for about 5 to 6 seconds, so there is no rush to adjust those modes to perfection.

This post describes how my X85 firmware works for off switch lights (lights with only a clicky switch). There are four user interfaces (UIs):

UI 1
Next mode: Short off press.
Previous mode: Long off press.
Boost: In mode cycle.

UI 2
Next mode: Short off press.
Previous mode: Not available.
Boost: Long off press (not in short press mode cycle).

UI 3
Adjust mode: Long off press enables brightness adjustment (indicated by three quick flashes).
Boost: Short off press.

UI 4
Adjust mode: Constantly adjustable.
Boost: Not available, UI 4 mode is adjustable all the way up to maximum output.

Adjusting output in UI 3 and 4:
Increase brightness: Short press starts increase of brightness. Stop with short press.
Decrease brightness: Double short press starts decrease of brightness. Stop with short press.

UI 3 mode adjusting times out after about one second of no activity. A flash indicates timeout and the new brightness level is saved.
UI 4 mode adjusting always available. Timeout for saving is the same, but no flashes to indicate timeout.

Setup
The setup menu and all other features are accessed by short off presses directly after a cold start (turning on the light after it has been off for 5 to 6 seconds or longer). To enter the menu off interest the corresponding amount of off presses must be entered, each off press within a second of the previous. The light will then give a confirmation flash (quick fade in/fade out) and then await input in the form off additional off presses to access a specific function or setting within that menu. If no additional presses are entered directly after the first menu selection confirmation flash, the light will in most cases perform a readout of some sort. Also, single long presses (L) are in some cases detected (holding the off switch off for about a half second).

Copying in the text with setup info into here looked crap so I put it here instead: http://www.mikec.se/Stuff/SetupOsw.txt
Left column is press count directly on cold start to access that menu. Columns to the right are by pressing X number of times.

Examples
These are the steps to set the UI.
1: Turn on light after it has been off for at least 5 to 6 seconds.
2: Within one second perform three off presses.
3: Wait for the confirmation flash (quick fade in/fade out).
4: Enter 1 to 4 short off presses quickly to select UI 1 to 4.
5: The light will flash a confirmation flash. Done.

To engage the safety lockout feature, follow the steps above except for step 4:
4: Immediately after the confirmation flash, perform a long off press by holding the off switch off for about half a second.
When locked, the light blinks every now and then. To unlock from safety lockout, either repeat or set any UI as in first example.

To readout the voltage level:
1: Turn on light after it has been off for at least 5 to 6 seconds.
2: Within one second perform three off presses.
3: Wait for the confirmation flash (quick fade in/fade out).
4: The light now flashes 1 to 5 times depending on cell voltage level. If it does a fade out instead of blink, the voltage level is really low, below level 1.

I think things are just getting lost with all of the activity on BLF recently. Browsing the ‘Recent Posts’ page doesn’t work as well as it used to.

Well, I’ll let this thread hang around for awhile. If there is no interest at all I’ll just delete all info in it and continue on in silence like before.

That’s a truckload of code! I can barely imagine how much time you must have put into it. Almost makes me glad I’m limited to an attiny13a for now :]

Please do not delete! You have viewers. The complexity of the subject makes it hard to interact with in the short term. It takes some prep to get to a place where one can even ask a question. I’ve been watching this thread and trying to absorb the great info. There is some excellent functionality here and over time it will help many! As I’m needing new drivers, I have come to this page, and to your work even prior to this posting. Each time I have not been able to use the information, but each time I come back, I get farther into what you are doing and soon I will be able to interact with this great firmware/drivers. They offer some things that are not currently out there so what you are doing is relevant, it’s going to take some time though. No doubt there are others thinking the same thing. Thanks for your work!

Thanks. I’ve been quite tired of it lately, but now I think it works as I have intended… But to be honest I don’t want to do more extensive testing and bug searching for a while, I just want to relax thinking all the quirks have been worked out for awhile :slight_smile:

Ok, point taken. I haven’t exactly released this stuff in steps so I guess a little understanding from my side is due. My companions and I wouldn’t have such awesome lights without BLF, and this stuff wouldn’t exist at all, so I kind of owe it to leave this stuff here, be it of interest or not.

It’s definitely of interest! Thanks for posting this info! Please don’t think it isn’t of interest!

I know exactly what you mean :slight_smile: Debugging firmware is about as much fun as debugging multithread code and ignorance is bliss.

On top of what PPDB22 wrote, keep in mind that there are probably under twenty people here who could read and understand that code. And I think we could really use a “firmware index” thread.

There is such a thread Flashlight Firmware Repository

Thanks, I knew of ToyKeeper’s repository but somehow never realized that thread was also a sort of index.

Mike C, if I remember correctly, you’re the one whose drivers have cell level readout, OTC and e-switch all on the same pin, right?

Thanks for sharing your time & work, Mike C. :beer:

Great 10x for your time and efforts m8, so far so good, you did a good job on the firmware too - i like F-8 v2

Actualy, most fo the time ppl dont need that fancy firmwares ( including me), 2-3 modes plus eventualy moonlight…. and strobe( for bikers)

Likewise. I dont understand a lot that goes on here but do understand the time put in. :beer:

Thanks for the positive comments all :beer:

Yep. All the drivers listed in the OP work like this and use my X85 firmware.

Yeah, I do know what you mean. I thought so too, but then I wanted to use constant current instead of PWM, and that required more pins, so I combined three functions on one pin, then after using them down in mines I got all these different ideas, and took ideas from friends… and then wanted to be able to configure the lights I’d built for them with them in the mines… and now here we are :slight_smile:
All the development stuff, configurable stuff and readouts are totally useless for people who flash their drivers and are done with it. I use that stuff because I set people’s lights up as they want in person out in the field away from computers and crap. Maybe one day I’ll release a “clean” version with all that crap cut out, leaving the bare essentials. Who knows, it might even fit into the ATtiny25 by then.

Bistro uses 2048 bytes. Meanwhile, blf-a6 with the runtime config parts removed uses 710 bytes. The difference is almost entirely the soft config options. I wouldn’t be surprised if yours went from 7500 bytes down to 2000 without the config options.

A light with one of my drivers and firmware is in the mail, so I have updated post #3 with dual switch setup info.

I’ve thought a little about making a clean version and I don’t think I will. If most of the features and functions are useless… don’t use them. Set the right driver type, then the mode levels under DEFAULT SETTINGS at the top of the C file, and it’s done. I believe I’ve made those definitions easy enough to understand, so if there is no interest in the rest, there’s no need to bother about the rest. Boost timers, low voltage thresholds, mode direction and all that stuff is also set by definitions. Set ’em and forget ’em.

Besides, making it smaller so it fits into the ATtiny25 is pointless for me. I’ll save like 0.5$ by switching to the 25, even less for low voltage versions, at least when buying from my component supplier. It’s too much work for 50 cents.

Dual switch= wow! I’m determined to build one of these now. I’ve started plans to build a BLF d80 with an added side switch. I think that will be my perfect opportunity. I will keep you informed.

OK, time for some user opinions from here!

Tested this light a few times now.

To be short, what I like:

- Voltage level / real voltage indication

- PWM not noticeable (big factor for me)

- UI1. It is very good for my use “As Is”. 4 modes with either this “back & forth” style or shot-cycle style is what I like.

  • UI4: the adjustment goes insanely low BUT the brightness steps go slower at the lowlow end. I have had several adjustable lights back some time ago, where you
    had to be really fast to catch the lowest low to stick with you. Not with this.

Not so favorite things to me:

- UI2 & UI3, I´m not a special fan of Boost mode although it might become handy if you use lower mode and just want to take a Quick Peek with higher power mode.

  • Dual switch light in general, I have owned only a couple of them but again, this is about who prefers and what…

At the moment, I havent programmed parameters. Changed one mode a bit though.
I think as far as I have tested, that this driver works flawlessly! :sunglasses:

Thanks for the comments, appreciated :beer:

The light goes as low as all the way down to 0 in PWM off that single PWM dedicated AMC7135. I slowed it down so once could easily make a moon mode.
I use fast PWM. I tested phase correct PWM, but the moonlight levels where a lot more spaced with phase correct and I couldn’t be bothered to have a routine that switches between fast and phase correct depending on PWM level… So I just kept it on fast PWM through the whole range.