Potnom not completely float
Posted: Wed Aug 13, 2025 4:55 pm
While driving my Saxo at low speed/power I sometimes feel the small surge or dip in power.
When looking on the web interface at the Iq current I can see a corresponding rise or fall in current.
After adding potnom to the chart they matched perfectly.
Potnom was changing with discrete steps. To verify this I tested this on my test setup.
After tracing through the code I found this:
the 100 should be 100.0f I think. After this I took a look at the Zombie code:
When I changed the code I got this
Second point.
The second "if" returns the opposite value 0 VS 100. 0 seems logical to me but maybe there is a reason?
When looking on the web interface at the Iq current I can see a corresponding rise or fall in current.
After adding potnom to the chart they matched perfectly.
Potnom was changing with discrete steps. To verify this I tested this on my test setup.
After tracing through the code I found this:
Code: Select all
float Throttle::DigitsToPercent(int potval, int potidx)
{
if (potidx > 1) return 0;
if (potmax[potidx] == potmin[potidx]) return 100.0f;
return (100 * (potval - potmin[potidx])) / (potmax[potidx] - potmin[potidx]);
}Code: Select all
float Throttle::NormalizeThrottle(int potval, int potIdx)
{
if(potIdx < 0 || potIdx > 1)
return 0.0f;
if(potmin[potIdx] == potmax[potIdx])
return 0.0f;
return 100.0f * ((float)(potval - potmin[potIdx]) / (float)(potmax[potIdx] - potmin[potIdx]));
}The second "if" returns the opposite value 0 VS 100. 0 seems logical to me but maybe there is a reason?