Integers Only
The new library uses integers only to save memory (no need for the 6KB real library!) and processing power.
Now, the values passed to the controls use a scheme based on two integers:
value = number / unit = significand / multiplier int32_t are used instead of int64_t because some platforms can't manage 64-bit numbers.
|
The unit provides the scale of the degrees passed.
The three following calls of the display() function are equivalent: |
display(90); // = 90 / 1 |
In most cases, the unit is set at the define() function, for example for the gauge object, in this case 10:
|
myGauge.define(&myScreen, 160, 120, 100, -100, 10); |
The value passed to draw() uses the unit. Here, 123 means 123/10=12.3 because the myGauge object has a unit=10.
|
myGauge.draw(123); |
Some functions like cos32x100 and sin32x100 have a hard-coded unit. They receive and return values multiplied by 100.
The default unit is thus set at 100. |
int32_t cos32x100(int32_t degreesX100) |