[CUB-228] Add battery_calibration_offset to cameras table #23

Open
opened 2026-05-27 10:55:51 -04:00 by Hermes · 1 comment
Owner

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

  • Linear ID: CUB-228
  • State: In Review
  • Priority: Urgent
  • Project: RemoteRig
  • Labels: Hex
  • Due date: none
  • Original assignee: unassigned
  • Creator: CubeCraft Creations
  • Linear branch name: cubecraftcreations1/cub-228-add-battery_calibration_offset-to-cameras-table
  • Linear comments archived/imported: 1
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 - Linear ID: CUB-228 - State: In Review - Priority: Urgent - Project: RemoteRig - Labels: Hex - Due date: none - Original assignee: unassigned - Creator: CubeCraft Creations - Linear branch name: cubecraftcreations1/cub-228-add-battery_calibration_offset-to-cameras-table - Linear comments archived/imported: 1
Hermes added the agent/hexpriority/urgentstate/in-reviewproject/remoterig labels 2026-05-27 10:55:51 -04:00
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-23T02:32:24.411Z on CUB-228:


CUB-228: Add battery_calibration_offset to cameras table — Complete

Branch: agent/hex/CUB-228-battery-calibration-offset
Commit: 1704d8a
Validation: 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

File Change
pkg/models/camera.go Added BatteryCalibrationOffset *float64 field to Camera struct (JSON: battery_calibration_offset, omitempty)
internal/db/migrations/001_create_tables.sql Added battery_calibration_offset REAL column to CREATE TABLE for fresh databases
internal/db/migrations/002_add_camera_calibration.sql New migration: ALTER TABLE cameras ADD COLUMN battery_calibration_offset REAL
internal/db/db.go Embed migration 002; added runIncrementalMigrations() with pragma_table_info guard for idempotent migration on existing databases
internal/api/cameras.go Updated GetCameraDetail SELECT to include new column
internal/mqtt/subscriber.go Updated getCamera SELECT to include new column

Migration Strategy

  • Fresh databases: column created via 001_create_tables.sql
  • Existing databases: 002_add_camera_calibration.sql runs via pragma_table_info idempotency check — safe to run multiple times
Imported Linear comment from **CubeCraft Creations** at `2026-05-23T02:32:24.411Z` on **CUB-228**: --- **CUB-228: Add battery_calibration_offset to cameras table** — Complete ✅ **Branch**: `agent/hex/CUB-228-battery-calibration-offset` **Commit**: `1704d8a` **Validation**: 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**: https://code.cubecraftcreations.com/CubeCraft-Creations/remote-rig/pulls/7 ### Changes Summary | File | Change | |------|--------| | `pkg/models/camera.go` | Added `BatteryCalibrationOffset *float64` field to `Camera` struct (JSON: `battery_calibration_offset`, omitempty) | | `internal/db/migrations/001_create_tables.sql` | Added `battery_calibration_offset REAL` column to CREATE TABLE for fresh databases | | `internal/db/migrations/002_add_camera_calibration.sql` | New migration: `ALTER TABLE cameras ADD COLUMN battery_calibration_offset REAL` | | `internal/db/db.go` | Embed migration 002; added `runIncrementalMigrations()` with `pragma_table_info` guard for idempotent migration on existing databases | | `internal/api/cameras.go` | Updated `GetCameraDetail` SELECT to include new column | | `internal/mqtt/subscriber.go` | Updated `getCamera` SELECT to include new column | ### Migration Strategy - **Fresh databases**: column created via 001_create_tables.sql - **Existing databases**: 002_add_camera_calibration.sql runs via `pragma_table_info` idempotency check — safe to run multiple times
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CubeCraft-Creations/remote-rig#23