What it solves
Embedded systems often need to redistribute a fixed budget between channels without changing the global total. EquiShift makes the compensating transfer explicit and leaves the state unchanged when limits or headroom prevent completion.
How it works
1Validate limits->2Check headroom->3Write two channels->4Preserve exact sum
Use it when
Redistribute power, current or PWM budgets
Probe actuators while preserving a system invariant
Coordinate valves or other bounded outputs
Run repeatable calibration and online identification sequences
Quick Start
#include <constrained_probe/transfer.h> int32_t channels[4] = {25, 25, 25, 25}; constrained_probe_transfer_config cfg = { .minimum = 0, .maximum = 100 }; /* Move 5 units from channel 0 to channel 1. */ constrained_probe_transfer(channels, 4u, 0u, 1u, 5, &cfg); /* channels is now {20, 30, 25, 25}; the sum remains 100. */Engineering evidence
- Caller-owned memory with no heap or mutable global state
- Checked int32 arithmetic and exactly two channel-array writes on success
- Failed transfers leave the input state unchanged
- Sequence restoration copies the saved baseline exactly, avoiding cumulative drift
- Host tests and cross-build targets cover Cortex-M0, Cortex-M4 and RV32IMC objects
Known limits
- Physical actuator atomicity and power-loss persistence remain the caller's responsibility
- The sequence object layout is not a cross-release ABI promise
- Build from source for each release; v0.1.0 does not promise binary ABI compatibility