Using sprintf generates a large amount of code. By replacing the
sprintf calls with dedicated code, program size is reduced when
widgets are used.
Also:
- Added a getValLen method for widgets which returns the print
length for the current value, similar to the existing getMaxValLen.
- The value for widgets is now initialised to the minimum value,
instead of 0, because 0 could be outside the specified range.
- Added getValLen and getMaxValLen keywords.
- The MicroViewWidgetDemo example sketch was modified to use
the new getValLen method, plus a few other small changes.
The user can add a flag to the style, for all widgets, to supress
the display of the numeric value.
Added new widget method drawNumValue() to simplify the code,
which can also be called by the user, e.g. for a custom numeric
value location.
Widgets will now work properly with minimum and maximum values
from −32,768 to 32,767.
Also, place the numeric value field close to sliders
and horizontally centred in gauges.
Use just one loop to draw all minor ticks.
Use a second loop to extend lines for major ticks.
Use totalTicks variable to determine number of ticks to draw.
In drawFace, majorLine could be left uninitialised if style was invalid
(although this couldn't happen with the current code).
Also cleaned up the WIDGETSTYLE tests.
(and fixed a few spelling errors in comments)
- Use fast pin change macros for RESET, SS and DC.
- Implement MVSPI.packetBegin() and MVSPI.packetEnd() to allow sending
multiple byte "packets" while SS remains enabled.
- Add 2 and 3 byte command() functions to send multiple command bytes in
one packet.
- Modify clear() and display() functions to send commands and data in
packets.
- Do the "wait for SPI transfer complete" just before sending the next
byte (plus after the last or only byte) in a packet, so code can be
executed while bytes are being sent.
- Disable SPI mode when not transmitting, so MOSI (and SCK) will go low.
- Keep DC low except when sending data bytes.
- Change MVSPI.transfer() to void since nothing can be received from
the display.
- Fixed use of = instead of == in "if" statment.
- Fixed uninitialised count variable in "for" loop.
- Removed unused variables.
- Replaced line splice characters (backslash) at end of comments.
OK, this version is actually worth looking at. Previous had more bugs
than you could shake a stick at.
vert_slider_test.ino illustrates the two slider styles, vertical
versions of the two existing styles
Added WIDGETSTYLE2 (like 0, but vertical) and WIDGETSTYLE3 (like 1, but
vertical). NOTE: I don't have a build environment, so I can't even
promise this will compile! So if it's crap, just treat it as a concept
for an enhancement request!