Instantiate two ints named temp15 and temp16. After the limit mixing functions have run, do this:
Code:
temp15=(int)pwm15-127;
temp16=(int)pwm16-127;
pwm15=(int)(.007874*pow(temp15,3)/fabs(temp15)+127);
pwm16=(int)(.007874*pow(temp16,3)/fabs(temp16)+127);
My real code is structured a little differently, but it works the same. 0 still outputs 0. 127 still outputs 127. 254 still outputs 254. Everything else in between is much less touchy, and it gives the driver a lot more control. It's also much simpler than making a lookup table, and won't eat up all your memory. (Yes, this is how I actually code. No, nobody else can ever figure out what I'm doing.)