Skip to main content

Configuration Macros

All macros live in ostx_config.h (or set by CMake/Arduino IDE). Set them before including any <OSynaptic-TX.h> header.

Buffer Sizes

MacroDefaultUnitDescription
OSTX_PACKET_MAX96bytesMaximum output packet size. Must be large enough for header + longest possible body
OSTX_ID_MAX9bytesSensor ID max length (including NUL); default allows up to 8 chars
OSTX_UNIT_MAX9bytesUnit string max length (including NUL)

Value Scaling

MacroDefaultDescription
OSTX_VALUE_SCALE10000Fixed-point scale factor. scaled = real_value × OSTX_VALUE_SCALE

You can set this to any power of ten. Example: 100 for 2-decimal-place precision saves approximately 1-2 Base62 digits per packet.

Timestamp

MacroDefaultDescription
OSTX_NO_TIMESTAMP0Set to 1 to omit timestamp fields from struct and packet. Saves ~20 B Flash + 4 B stack

When OSTX_NO_TIMESTAMP=1, pass 0 for the ts_sec argument; the library ignores the value and the TS_SEC field is zeroed in the packet.

Feature Toggles

MacroDefaultDescription
OSTX_NO_STATIC0Set to 1 to exclude Tier B (static descriptor API)
OSTX_NO_STREAM0Set to 1 to exclude Tier C (streaming callback API)
OSTX_DISABLE_B62_TABLE0Not applicable — TX uses a lookup-table encoder for speed

Memory Profiles (AVR, avr-gcc -Os, ATmega328P)

ProfileDefinesFlashStackStatic RAM
Full (all tiers)defaults~760 B~137 B (Tier A)96 B
Tier B onlyOSTX_NO_STREAM=1~430 B~51 B96 B
Tier C onlyOSTX_NO_STATIC=1~600 B~21 B0 B
No timestampOSTX_NO_TIMESTAMP=1~740 B~117 B96 B
MinimalOSTX_NO_STATIC=1 OSTX_NO_STREAM=1~600 B~137 B96 B (Tier A only)

CMake Usage

target_compile_definitions(my_sensor PRIVATE
OSTX_NO_TIMESTAMP=1
OSTX_NO_STATIC=1
)

Arduino IDE Usage

Add to Sketch > Sketch Properties (Arduino 3.x) or define before the include:

#define OSTX_NO_TIMESTAMP 1
#define OSTX_NO_STATIC 1
#include <OSynaptic-TX.h>