feat(cv): add CVTuning struct and NVS persistence scaffolding

Adds CVTuning to CVState, populates defaults from existing file-scope
constants in cv_init, and introduces config_load_tuning/config_save_tuning
backed by the doorcounter NVS namespace. No runtime behavior change yet;
CV code still reads the existing constants (Task 2 will migrate reads).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-16 15:45:53 -07:00
parent 9d5b588231
commit e28a4c1863
5 changed files with 92 additions and 0 deletions

View File

@@ -19,6 +19,15 @@ struct CVTrack {
int missed;
};
struct CVTuning {
uint8_t diff_thresh; // per-pixel motion threshold
int min_blob_px; // min foreground pixels for a blob
float max_move; // max inter-frame track jump (px)
int max_missed; // frames before drop
uint8_t line_offset; // 0-100, percent of frame height for virtual line
uint32_t cfg_version; // monotonic; server increments on push
};
struct CVState {
uint8_t background[CV_PIXELS];
bool bg_valid;
@@ -28,6 +37,7 @@ struct CVState {
std::vector<CVTrack> tracks;
int entries;
int exits;
CVTuning tuning;
};
struct CVResult {