Skip to content

[VCU] event modes, energy metering#289

Merged
matt-mekha merged 10 commits into
mainfrom
mm/autox
Jun 7, 2026
Merged

[VCU] event modes, energy metering#289
matt-mekha merged 10 commits into
mainfrom
mm/autox

Conversation

@matt-mekha

Copy link
Copy Markdown
Contributor

No description provided.

@matt-mekha matt-mekha requested a review from a team as a code owner June 7, 2026 02:14
@matt-mekha matt-mekha requested review from AaronShet and dhairs and removed request for a team June 7, 2026 02:14
@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lhre-2026 Ready Ready Preview, Comment Jun 7, 2026 9:30pm

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an event_mode parameter to the VCU parameters structure and configures it across various event-specific parameter files. It also updates default sensor calibration values, adjusts the default pedal curve exponent, disables regen by default, and switches the active parameters to endurance mode. The review feedback highlights a critical bug in endurance_params.h where overriding the .regen_linelock sub-struct implicitly resets its other fields to zero, and notes a logic error where regen should be enabled (false) instead of disabled (true) for endurance mode. Additionally, several unnecessary trailing backslashes outside of macro definitions should be removed across the parameter files to prevent compiler warnings or unexpected behavior.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +8 to +11
.regen_linelock = { \
.disable = true, \
}, \
.event_mode = 4, \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

There are two major issues here:

  1. C99 Struct Overriding: Initializing .regen_linelock = { ... } overrides the entire regen_linelock sub-struct. This means all other fields of regen_linelock (such as pack_current_limit_a, pack_terminal_voltage_limit_v, etc.) will be implicitly initialized to 0. To override only the disable field, you must use the nested designator .regen_linelock.disable.
  2. Logic Error: The PR title is "regen off except for endurance". Since regen is disabled by default in default_params.h (.disable = true), endurance mode should enable it by setting .regen_linelock.disable = false. Setting it to true here keeps it disabled.
    .regen_linelock.disable = false,
    .event_mode = 4,

static const vcu_parameters_t acceleration_params = { VCU_DEFAULT_PARAMS };
static const vcu_parameters_t acceleration_params = {
VCU_DEFAULT_PARAMS,
.event_mode = 1, \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The backslash \ at the end of the line is unnecessary because this is a standard C struct initialization, not a preprocessor macro definition. Trailing backslashes outside of macros can lead to compiler warnings or unexpected line-splicing behavior if trailing whitespace is present.

    .event_mode = 1,

static const vcu_parameters_t autocross_params = { VCU_DEFAULT_PARAMS };
static const vcu_parameters_t autocross_params = {
VCU_DEFAULT_PARAMS,
.event_mode = 3, \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The backslash \ at the end of the line is unnecessary because this is a standard C struct initialization, not a preprocessor macro definition. Trailing backslashes outside of macros can lead to compiler warnings or unexpected line-splicing behavior if trailing whitespace is present.

    .event_mode = 3,

Comment on lines +21 to +23
}, \
.torque_map.pedal_curve_exponent = 1.0f, \
.event_mode = 2, \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The backslashes \ at the end of these lines are unnecessary because this is a standard C struct initialization, not a preprocessor macro definition. Trailing backslashes outside of macros can lead to compiler warnings or unexpected line-splicing behavior if trailing whitespace is present.

    },
    .torque_map.pedal_curve_exponent = 1.0f,
    .event_mode = 2,

@cyberneel

Copy link
Copy Markdown
Collaborator

@claude review this.

cyberneel added a commit that referenced this pull request Jun 7, 2026
…ackside

Stacks PR #289 (VCU mm/autox firmware: event-mode params per session +
regen-off-except-endurance) + PR #291 (telemetry & dash for VCU event_mode
toggle) into telemetry/trackside-live-fixes. Result is the READ path for
Controls.event_mode (which params table the VCU is running) end-to-end:

  VCU 0x1C7 byte 6 -> cand decode -> publishd -> kafka-bridge flatten
                  -> dashd CanData.event_mode -> driver-facing MODE pill

Plus bridge now emits line_lock_enabled and bse3 (round-tripped through the
schema-gen chain so they're in proto/sql/Prisma/ORM/generated_mapping/etc.).
0x1C9 VCU Energy Estimate packet (net_energy + regen_energy) also lands.

Conflict resolutions:
- BEVO/dashd/frontend/src/screens/ScreenOne.tsx: kept HEAD's lap-card +
  theme imports and ADDED the new eventModeLabel import from PR #291.
- viewer_tool/src/app/page.tsx, trackside-live/TracksideApp.tsx,
  trackside-live/trackside.css: PR #291 doesn't actually modify these
  (verified with git diff origin/main...origin/mm/autox-telemetry --
  those files). The conflicts were spurious 3-way-merge noise from the
  heavy divergence — took HEAD wholesale to preserve all the recent
  trackside polish work.

Write path (Pi -> VCU mode switch) is still deferred per the bevo-mode-set-tx
memory note — needs the four pieces and is blocked on VCU firmware.
@matt-mekha matt-mekha changed the title [VCU] regen off except for endurance [VCU] event modes, energy metering Jun 7, 2026
mm/autox added event_mode (0x1C7) and net_energy/regen_energy
(0x1C9) to the CSV but didn't run the full schema-gen chain,
so the schema-drift CI was failing on stale artifacts.

Pure regen of the non-firmware codegen outputs:
- drivers/longhorn-lib/can.json + protobuf/can_packets.proto
- BEVO can.json / can_packets.proto / sensor_data.desc / generated_mapping.rs
- telemtry sensor.proto / orion.proto / Prisma / SQL / ORM models

Firmware-side can_ids.h / can_ids.c are intentionally NOT regenerated
here — Matt is updating those alongside the new packet handlers and
will commit them separately.
@cyberneel cyberneel requested review from a team as code owners June 7, 2026 21:21
@cyberneel cyberneel removed the request for review from a team June 7, 2026 21:21

@cyberneel cyberneel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@matt-mekha matt-mekha merged commit 06ef308 into main Jun 7, 2026
8 of 9 checks passed
cyberneel added a commit that referenced this pull request Jun 8, 2026
Resolves a 2-hunk conflict in BEVO/dashd/main.rs in favour of the branch's reboot-durable layout paths (/var/lib/bevo-dash + create_dir_all) over main's stale /tmp tmpfs version from the #295 squash. main's write logic is a strict subset, so nothing is lost. Brings in #289 (event modes/energy), #295 (park screen), #297 (skidpad) so the PR diff is exactly the unmerged trackside work.
@matt-mekha matt-mekha deleted the mm/autox branch June 14, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants