Void Sentry
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
Loading...
Searching...
No Matches
calibration_blob.h File Reference

Versioned, CRC-checked byte layout for saving an AimMap to NVS (pure C++20, natively tested). More...

#include "aim_map.h"
#include "crc32.h"
#include <array>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <span>

Go to the source code of this file.

Typedefs

using aiming::Blob = std::array<uint8_t, kBlobSize>
 

Functions

Blob aiming::serialize (const AimMap &map)
 Packs a map into the 28-byte versioned layout, with the CRC-32 in the last four bytes.
 
std::optional< AimMap > aiming::deserialize (std::span< const uint8_t > blob)
 Parses a blob; empty if the length, magic, version, CRC or float values are invalid.
 

Variables

constexpr size_t aiming::kBlobSize = 28
 

Detailed Description

Versioned, CRC-checked byte layout for saving an AimMap to NVS (pure C++20, natively tested).

Layout (little-endian, 28 bytes): magic "AIM1" (u32), version (u16, = 1), reserved (u16, 0), pan_a, pan_b, tilt_a, tilt_b (4 x f32), CRC-32 of the first 24 bytes (u32). Both the ESP32 and x86 are little-endian, so fields are copied with std::bit_cast. Anything that fails a check deserializes to nothing, and the caller falls back to default_map().