# MechanicalRelay 160.002.003 Release Notes These notes cover changes from MechanicalRelay firmware 160.002.002 through 160.002.003 as of August 14, 2026. ## Highlights - Restored legacy Mechanical Relay board behavior when saved pump configuration is erased, absent, or invalid. - Corrected authorization, fill-up, preset, handle, relay, and sale-completion behavior. - Corrected Mechanical Relay pump-brand dispatch and limited the target to its single physical pump. - Added host-tested Mechanical Relay authorization and sale-calculation helpers. - Made Visual Studio Release builds explicitly produce Release-optimized, Release-marked firmware. ## Mechanical Relay operation - Invalid or erased saved pump-brand configuration now defaults to Mechanical Relay. An explicit EMR3 selection remains supported. - Corrected shared pump dispatch to use `BRAND_MECHANICAL_RELAY`, avoiding collision with the different legacy mechanical-pump brand code. - Configured the firmware for one local pump, matching the single physical Mechanical Relay channel. - Initialized the pump task state before starting the dispenser controller so status and command processing begin in a valid running state. - Reworked handle transitions so lifting the handle is reported consistently, dropping the handle ends an active authorization, and the authorization and valve relays are switched off at sale end. - Corrected armed-state reporting to account for both physical relay state and an active software authorization. - Reasserted the physical authorization relay for every accepted Mechanical Relay authorization, including repeat commands received while software status already reports authorized. - STOP and SALE COMPLETE commands now switch off both physical relays for Mechanical Relay operation. - Updated the handle, authorization, and stopped LEDs from the current pump state rather than leaving stale indications. ## Fill-up, preset, and totals behavior - Added explicit fill-up state. The fill-up sentinel (`999999`) no longer behaves as a finite preset and no longer shuts the relay off when the displayed dollar total reaches that value. - Preset authorization parsing now validates the preset and slow-down fields with shared checked helpers. Invalid, overflowing, or inconsistent values are rejected instead of truncating into the 8-bit slow-down field. - Sale dollar and volume calculations use host-tested integer helpers with saturation behavior for oversized intermediate values. - Pulse-count accumulation is protected against rollover. - Authorization state is cleared and relay state is made safe when the handle drops or the sale completes. ## Shared protocol compatibility - Preserved the distinct Mechanical Relay and legacy mechanical-pump brand identifiers in shared interfaces. - Initialized the shared pump receive byte before returning a no-data result, avoiding an undefined output value. ## Build and verification - Bumped the firmware version from `160.002.002` to `160.002.003`. - Release compilation uses `-O2`; Debug compilation uses `-O0 -g`. - Visual Studio `Release|Win32` Build and Rebuild explicitly pass `-BuildConfiguration Release` to the firmware build script. - Generated firmware metadata identifies Visual Studio Release images with `(Release)`. - The release image embeds firmware version `160.002.003` and reports `unversioned_repos_ = 0`; no source component is marked `*unversioned*`. - A build-contract test verifies the version, Release metadata marker, Visual Studio command lines, and Release optimization setting. - Host tests cover Mechanical Relay preset/fill-up decisions, pulse accumulation, sale math, handle transitions, and pump-brand codes. ## Compatibility notes - Installations with erased or invalid pump configuration will now start in Mechanical Relay mode; an explicitly configured EMR3 installation remains in EMR3 mode. - Fill-up authorizations are treated as unlimited rather than as a `$9,999.99` cutoff. - Invalid preset or slow-down command fields that previously could be truncated or misapplied are now rejected. - No intentional persistent-configuration migration is required. ## Included artifact - Versioned release image: `MechanicalRelay/mechanical_relay_app/build/windows/out/bin/MechanicalRelay.160.002.003.hex` - SHA-256: `58DA1375B8C8D10CF0617DD49D010C2A57DC69481ECBF269DB02EF6D1BE5F9FB` - `MechanicalRelay.hex` in the same directory is an unversioned filename copy of the identical versioned firmware image. ## Change range - Baseline: `31febab` - MechanicalRelay 160.002.002 - Legacy compatibility update and version bump: `79c1b4e` - Fill-up and authorization correction: `692ea08` - Current source behavior: `53dbf6a` (later branch commits only changed documentation or other targets)