Skip to content

feat: battery heater overlay on drive detail charts#207

Merged
vide merged 2 commits intomainfrom
feat/battery-heater-overlay
Mar 20, 2026
Merged

feat: battery heater overlay on drive detail charts#207
vide merged 2 commits intomainfrom
feat/battery-heater-overlay

Conversation

@vide
Copy link
Owner

@vide vide commented Mar 20, 2026

Summary

  • Adds Grafana-style annotation bands on Power profile and Battery level charts in Drive Details to highlight periods where battery pre-heating was active
  • Parses battery_info.battery_heater from the TeslaMate API drive detail positions
  • Contiguous heater-on periods are merged into single annotation ranges
  • Rendered as subtle orange semi-transparent bands with thin edge lines

Changes

  • DriveModels.kt: Added DriveBatteryInfo model with battery_heater field; added batteryInfo to DrivePosition
  • ChartDrawUtils.kt: Added AnnotationRange data class and drawAnnotationRanges() drawing function
  • OptimizedLineChart.kt: Added annotationRanges parameter, drawn behind the data line
  • FullscreenLineChart.kt: Threaded annotationRanges through to the underlying chart and fullscreen overlay
  • DriveDetailScreen.kt: Computes heater ranges from positions, passes to Power and Battery chart cards

Test plan

  • Open a drive where battery pre-heating occurred (e.g. drive 7135) — verify orange annotation bands appear on Power and Battery charts
  • Open a drive without heater activity — no annotations should appear
  • Tap fullscreen on an annotated chart — annotations visible in landscape mode
  • Cross-chart sync still works (tap one chart, all charts show synchronized tooltip)

🤖 Generated with Claude Code

vide and others added 2 commits March 20, 2026 14:08
Add Grafana-style annotation bands on Power and Battery charts to
highlight periods where the battery pre-heater was active during a drive.

- Add DriveBatteryInfo model with battery_heater field to DrivePosition
- Add AnnotationRange data class and drawAnnotationRanges() to ChartDrawUtils
- Add annotationRanges parameter to OptimizedLineChart and FullscreenLineChart
- Compute contiguous heater-on ranges from drive positions
- Render as semi-transparent orange bands with thin edge lines
- Thread annotations through ChartCard wrapper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The battery_heater field flaps rapidly (single-point true every ~40
positions). Merge true-runs separated by gaps <= 80 positions into
clean continuous bands instead of 64 tiny slivers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vide vide merged commit de3d0b3 into main Mar 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant