generated from CubeCraft-Creations/Tracehound
[CUB-228] Add battery_calibration_offset to cameras table #23
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Linear: CUB-228
Linear URL: https://linear.app/cubecraft-creations/issue/CUB-228/add-battery-calibration-offset-to-cameras-table
Description
GoPro Hero 3 reports battery as raw byte (offset 57). Store per-camera calibration offset so hub converts raw to percentage. Add column to schema, update migration, update Go models. NULL = no calibration, use raw value as-is.
Imported Linear metadata
Imported Linear comment from CubeCraft Creations at
2026-05-23T02:32:24.411Zon CUB-228:CUB-228: Add battery_calibration_offset to cameras table — Complete ✅
Branch:
agent/hex/CUB-228-battery-calibration-offsetCommit:
1704d8aValidation: PASS (
go vet ./pkg/models/ ./internal/db/ ./internal/api/all clean;go vet ./internal/mqtt/has a pre-existing go.sum issue unrelated to this change)PR: #7
Changes Summary
pkg/models/camera.goBatteryCalibrationOffset *float64field toCamerastruct (JSON:battery_calibration_offset, omitempty)internal/db/migrations/001_create_tables.sqlbattery_calibration_offset REALcolumn to CREATE TABLE for fresh databasesinternal/db/migrations/002_add_camera_calibration.sqlALTER TABLE cameras ADD COLUMN battery_calibration_offset REALinternal/db/db.gorunIncrementalMigrations()withpragma_table_infoguard for idempotent migration on existing databasesinternal/api/cameras.goGetCameraDetailSELECT to include new columninternal/mqtt/subscriber.gogetCameraSELECT to include new columnMigration Strategy
pragma_table_infoidempotency check — safe to run multiple times