Skip to main content

Configuration Reference (osrx_config.h)

All macros are #ifndef-guarded. Override via CMake -D flags or by defining before including any OSynaptic-RX header.


Buffer & Field Sizes

MacroDefaultDescription
OSRX_PACKET_MAX96Maximum wire frame size in bytes (= OSRXParser buffer size). Increase for extended-body frames.
OSRX_ID_MAX9Max sensor ID length including NUL terminator
OSRX_UNIT_MAX9Max unit string length including NUL terminator
OSRX_B62_MAX14Max Base62 string length including NUL terminator
OSRX_BODY_MAX64Max body byte count (must be ≤ OSRX_PACKET_MAX - 13 - 3)

Decoder Behaviour

MacroDefaultDescription
OSRX_VALUE_SCALE10000Divide field->scaled by this to obtain the real value. Must match the TX side.
OSRX_CMD_DATA_FULL63Expected cmd byte (0x3F). Frames with other values are rejected.

Feature Toggles

MacroDefaultFlash savedRAM savedEffect
OSRX_VALIDATE_CRC81~80 B (AVR)0Set to 0 to skip body CRC-8 check. Not recommended for production.
OSRX_VALIDATE_CRC161~90 B (AVR)0Set to 0 to skip full-frame CRC-16 check. Not recommended.
OSRX_NO_PARSER0~316 B102 BSet to 1 to exclude streaming parser (OSRXParser). Use with osrx_sensor_recv() only.
OSRX_NO_TIMESTAMP0~20 B4 BSet to 1 to exclude ts_sec field from osrx_packet_meta. Useful on sub-64 B targets.

Config Tier Presets

Ultra tier (ATtiny85 / ATmega48 — every byte counts)

/* Place before any OSynaptic-RX include, or via CMake -D flags */
#define OSRX_NO_PARSER 1 /* excludes OSRXParser: save 316 B Flash + 102 B RAM */
#define OSRX_NO_TIMESTAMP 1 /* save 20 B Flash, 4 B RAM */
#define OSRX_VALIDATE_CRC8 0 /* save ~80 B Flash (accept CRC8 risk) */
#define OSRX_PACKET_MAX 64 /* smaller buffer if frames are short */

CMake equivalent:

cmake -B build \
-DOSRX_NO_PARSER=ON \
-DOSRX_NO_TIMESTAMP=ON \
-DOSRX_VALIDATE_CRC8=0 \
-DOSRX_PACKET_MAX=64

Tight tier (ATmega88 — 1 KB RAM, 8 KB Flash)

#define OSRX_NO_TIMESTAMP    1
/* Keep CRC validation; keep parser */

Standard tier (ATmega328P / Uno — comfortable defaults)

No overrides needed. Use the library defaults as-is.

Comfort tier (ATmega2560 / ESP32 — multi-channel)

#define OSRX_PACKET_MAX    128   /* allow larger frames */
/* All other defaults fine; instantiate multiple OSRXParser for each channel */

CMake Override Examples

# Minimal AVR target: no parser, no timestamp, no CRC8
cmake -B build \
-DOSRX_NO_PARSER=ON \
-DOSRX_NO_TIMESTAMP=ON \
-DOSRX_VALIDATE_CRC8=0

# Multi-channel with larger buffer
cmake -B build -DOSRX_PACKET_MAX=128

# Debug build with all checks
cmake -B build -DCMAKE_BUILD_TYPE=Debug