Noob Q's regarding Biscotti Firmware02


First of all, I want to thank you for all the information that you make available to newbies like me. A special thanks to programmers who have dedicated countless hours to putting together the firmware repository, pretty impressive.

I was in the market for a flashlight (my 1st) to use on my bike helmet/night runs. After extensive research and a lot of reading, I settled for couple Convoys namely M1 for biking and S2+ for running. Both will be running Biscotti.

I have few questions as to how can one “customize” it.

Let me explain:

Line 64 #define RAMP_SIZE 7
Line 76 #define RAMP_FET 1,7,32,63,107,127,255

Would it be possible to change line 64 value to for example 8 and line 76 to 8 value between 1-255 (where 255=100% / 1=fraction of 1%)?

I understand there will be more changes to be made line 194-209 which leads me to my next questions:

- Can I reduce the number of groups to say 2 by deleting line 198-207?

- Can I change it to 4 modes/group for example by changing line 209 to “4” and lines 196-207 to 4 values instead of 8?

I’m not a programmer by any means, but looking at the code sparked my curiosity.

I can’t wait to receive my flashlights, extra drivers and tools to start experimenting. I hope not more than 2 weeks or so.

Hi and welcome PalmBeachR. I cant help but someone will be able to. All the best for the project.

I’m not really familiar with biscotti, but I know some programming, so I will attempt to answer your questions to boost my post count. :smiley:

Toykeeper wrote most of the firmware, so she will be able to answer your questions with more precision.

Yes, the values of RAMP_FET are close to linear but not so linear for low values, so 127 is close to 127/255 = 50, but 1 is closer to 0.1 than to 1/255=0.4. RAMP_SIZE is used as equivalent to 100 in several places of the code, so the last value should be the largest. The equivalence table for different drivers is somewhere in the forum.

Note that most budget drivers are based on an attiny13 that only has 1024 bytes of memory and IIRC Biscotti compiled to 1022 bytes, so it’s possible that an extra value may not fit without removing something else.

I think the answer is yes, also you need to change NUM_MODEGROUPS from 12 to 2. Actually changing NUM_MODEGROUPS to 2 should be all that is needed, but deleting the extra modegroups would save some bytes, e.g. to enable some other feature.

No, I think you would need to modify line 378 from

const uint8_t *src = modegroups + (modegroup<<3);
const uint8_t *src = modegroups + (modegroup<<2);

<<3 means multiply by 2*3 = 8, while <<2 means multiply by 2*2 = 4. That line gets the position of the first mode of the current modegroup in the modegroups array. Arrays are actually contiguous in memory, the line breaks are there only for human eyes.

also you would need to change from 8 to 4 in line 387 and likely somewhere else too. Unless you really need to save a few bytes it would be easier to replace the unwanted modes with zeros.

Thanks for the reply. This whole thing is fascinating to me. I might have to go grab a book or 2 about coding at my local library. Any recommendations?