Configuration & Defines¶
Two layers of build-time configuration tune the library's footprint and behavior: a memory profile that sets a coherent group of defaults, and individual override macros that fine-tune any single value.
Memory Profile Macros¶
A memory profile is one of three preset bundles. Define it before
#include <ViewPoint.h>:
If no profile is set, the library auto-selects one from the target board. Small
AVR boards (UNO R3, Nano, Leonardo, Micro) get VIEWPOINT_MINIMAL. Mega 2560
and UNO R4 (Renesas) get VIEWPOINT_LITE. Every other board falls through to
VIEWPOINT_FULL. The library emits a #warning line at compile time when it
auto-selects MINIMAL or LITE, so a build that picked a tight profile by
accident is visible in the compiler output.
A FULL build on a Teensy 4.1 costs roughly 4–6 KB of static RAM. A MINIMAL build on an UNO R3 fits in roughly 1.5 KB of SRAM with room for typical sketch state.
Individual Override Macros¶
Every value the memory profile sets is also accessible as its own define. Set
any of these before #include <ViewPoint.h> to override a single field without
changing the rest of the profile.
| Macro | Default (MINIMAL / LITE / FULL) | What it controls |
|---|---|---|
VIEWPOINT_MAX_TRACES |
2 / 4 / 16 | Maximum simultaneous traces |
VIEWPOINT_MAX_PLOTS |
1 / 2 / 8 | Maximum plot panels |
VIEWPOINT_MAX_TRACES_PER_PLOT |
2 / 4 / 16 | Trace ids per plot's association list |
VIEWPOINT_MAX_REFERENCE_LINES |
2 / 4 / 8 | Reference lines per axis |
VIEWPOINT_MAX_DERIVED_TRACES |
1 / 4 / 32 | Derived-trace slots — may be removed in a future release; the desktop app's UI is the recommended path |
VIEWPOINT_LABEL_SIZE |
16 / 24 / 32 | Bytes per trace and plot label, including null terminator |
VIEWPOINT_UNITS_SIZE |
8 / 12 / 16 | Bytes per axis-units string |
VIEWPOINT_TITLE_SIZE |
16 / 32 / 64 | Bytes per sketch and plot title |
VIEWPOINT_DEFAULT_PACKET_SIZE |
50 / 100 / 500 | Default points per frame in Frames mode |
VIEWPOINT_TX_BUF_SIZE |
32 / 128 / 512 | CommandEncoder transmit-batching buffer, necessary for certain MCU's in frames mode (ESP32, Arduino Giga) |
USE_VIEWPOINT_WITH_NAMESPACE |
(off) | Disables the namespace shortcut macros so identifiers like scatter and frames stay in the user's namespace |
Override one value like this:
Common Data Shapes¶
| Pattern | Typical Use |
|---|---|
view.addData("Signal", value) |
single-value Cartesian trace |
view.addData("XY", x, y) |
paired-value Scatter trace |
view.addData("Polar", radius, angle) |
Polar trace using magnitude and angle |
repeated view.addData(...) calls before view.send() |
multi-trace update in one cycle |
Minimal Starting Examples¶
- HelloPlotter — simplest Cartesian example (start here)
- HelloScatter — simplest Scatter example
- HelloPolar — simplest Polar example
MCU Compatibility¶
See MCU Compatibility for the current support snapshot, suggested memory profile per board, and verification status.
Common Library Calls¶
These are the most important sketch-side calls. A full API reference is in Appendix A.
| Call | Purpose |
|---|---|
view.begin() |
start with default settings |
view.begin(plotType, mode, packetSize) |
start with explicit plot type, update mode, and packet size |
view.setPlotType(...) |
choose Cartesian, Scatter, or Polar |
view.setMode(...) |
choose Continuous or Frames |
view.setDelay(...) |
set the delay for the current mode |
view.setPacketSize(...) |
control the frame or packet size |
view.setHorizontalRange(...) |
set horizontal axis range |
view.setVerticalRange(...) |
set vertical axis range |
view.setUnits(...) |
set axis units (Horizontal, Vertical) |
view.setAxisLabels(...) |
set axis label text (Horizontal, Vertical) |
view.setTitle(...) |
set the sketch title shown by the app |
view.setPlotTitle(...) |
set the plot title for the active plot |
view.setDisplayMode(...) |
choose None, Persistence, Spectrogram, or Gradient |
view.addData(...) |
buffer data for a trace |
view.send() |
send buffered data and any needed config updates |
view.sendInfo(...) |
send a message to the desktop app serial monitor |
Mapping Library Calls To What You See¶
| Sketch Call | Desktop Result |
|---|---|
view.setPlotType(...) |
the canvas switches to Cartesian, Scatter, or Polar behavior |
view.setHorizontalRange(...) and view.setVerticalRange(...) |
axes start with those ranges |
view.setUnits(...) and view.setAxisLabels(...) |
labels and units appear in the plot UI |
view.setDisplayMode(...) |
plot rendering changes to the selected mode |
view.addData(...) |
one or more traces appear and update live |
view.setNumberOfPlots(...) and view.plot(index) |
the app can show and configure multiple plots |
view.sendInfo(...) |
a message will appear in the serial monitor |