The ramping tables are used to convert a human-friendly value (linear-scale perceptual brightness) into a set of raw PWM values. So, given a ramp 40 items long, level 10/40 would appear to be about 25% brightness, level 20/40 appears to be about 50% brightness, etc. Doesn’t matter how many power channels there are or how the ramps are shaped or how the individual power curves add together; all you need to deal with is a single number.
The ramp is used for basically everything which sets an output level, not just soft start. However, you can reduce the size of the ramp if you like, to save space.
To alter the mode groups, look for the array declared as “PROGMEM const uint8_t modegroups[]” and change its contents. Each set of 8 values is one mode group. The final one (muggle mode) can be less than 8 bytes, but all others must be padded with zeroes until they are long enough.
Blinky modes are defined near the top of the file, and are basically just numbers close to 255.
So, in bistro-tripledown:
- 0 is off.
- 1-40 are moon mode through turbo, on a visually-linear scale.
- 247-254 are blinky modes.
- Other numbers are unused.
To adjust the shape of the curve, edit the definitions of RAMP_7135, RAMP_7135s, and RAMP_FET. I recommend generating these values with level_calc.py as shown in the comment above the definitions. If you want any no-PWM medium modes, you’ll also need to manually tweak the values a little to make one or two modes align exactly with 255/0/0 and 255/255/0, then list those level numbers as “ONE7135” and “ALL7135s”. The special “RAMP” mode is there specifically to help with tweaking the ramp shape; it just goes smoothly from one end to the other and back, and should generally be removed after the levels look okay.
The ramp can be made dramatically smaller, like what I did in biscotti.c, but it also requires changing a few other parts of the code because some parts assume a long smooth ramp.
So, adjusting the ramp can be a pain… but once that’s done, all those details are abstracted away to make the rest of the code simpler.