Skip to content

frontend: wizard: check if there is a board available before running wizard customization step#3821

Open
nicoschmdt wants to merge 1 commit intobluerobotics:masterfrom
nicoschmdt:detect-board
Open

frontend: wizard: check if there is a board available before running wizard customization step#3821
nicoschmdt wants to merge 1 commit intobluerobotics:masterfrom
nicoschmdt:detect-board

Conversation

@nicoschmdt
Copy link
Contributor

@nicoschmdt nicoschmdt commented Mar 6, 2026

fix: #3426

before:
image

after:
image

if the board is disconnected after the customization step the correct error is shown:
image

Summary by Sourcery

Ensure the wizard checks for a connected flight controller board before running customization and firmware installation steps, and surfaces clear feedback when none is detected.

Bug Fixes:

  • Prevent wizard customization steps from running when no flight controller board is connected, avoiding failures later in the flow.
  • Return a clear error message from firmware installation when no flight controller board is detected instead of proceeding silently.

Enhancements:

  • Display a warning alert in the wizard UI when no flight controller board is detected during vehicle setup.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 6, 2026

Reviewer's Guide

Adds a board-presence check to the wizard’s vehicle customization step and firmware installation, showing a warning in the UI and aborting actions when no flight controller is detected.

Sequence diagram for board check in wizard customization and firmware install

sequenceDiagram
  actor User
  participant WizardVue as WizardVue
  participant AutopilotManagerUpdater as AutopilotManagerUpdater
  participant Autopilot as Autopilot

  rect rgb(230,230,255)
    User->>WizardVue: click setupBoat or setupROV
    WizardVue->>AutopilotManagerUpdater: fetchCurrentBoard()
    AutopilotManagerUpdater-->>Autopilot: update current_board
    Autopilot-->>WizardVue: current_board state
    alt current_board is null
      WizardVue->>WizardVue: set board_not_detected = true
      WizardVue-->>User: show warning No flight controller detected
    else current_board present
      WizardVue->>WizardVue: set board_not_detected = false
      WizardVue->>WizardVue: set vehicle_type, vehicle_name, vehicle_image
      WizardVue-->>User: show configured vehicle in customization step
    end
  end

  rect rgb(230,255,230)
    User->>WizardVue: start installLatestStableFirmware(vehicle)
    WizardVue->>AutopilotManagerUpdater: fetchCurrentBoard()
    AutopilotManagerUpdater-->>Autopilot: update current_board
    Autopilot-->>WizardVue: current_board state
    alt current_board is null
      WizardVue-->>User: return status No flight controller board detected
    else current_board present
      WizardVue->>Autopilot: continue firmware installation flow
      Autopilot-->>WizardVue: firmware install result
      WizardVue-->>User: show install status
    end
  end
Loading

Class diagram for Wizard component board detection changes

classDiagram
  class WizardVue {
    bool board_not_detected
    bool model_viewer_supported
    bool model_viewer_ready
    int configuration_page_index
    Vehicle vehicle_type
    string vehicle_name
    string vehicle_image
    +async setupBoat()
    +async setupROV()
    +async installLatestStableFirmware(vehicle Vehicle) ConfigurationStatus
  }

  class AutopilotManagerUpdater {
    +availableFirmwares
    +fetchCurrentBoard()
    +fetchFirmwareInfo()
    +installFirmwareFromUrl()
  }

  class Autopilot {
    Board current_board
  }

  WizardVue ..> AutopilotManagerUpdater : uses fetchCurrentBoard
  WizardVue ..> Autopilot : reads current_board for board detection
Loading

File-Level Changes

Change Details Files
Show a warning message in the wizard customization step when no flight controller (board) is detected.
  • Add a v-alert in step 2 of the wizard that is conditionally rendered when a new board_not_detected flag is true
  • Style the alert as a dense warning with a short "No flight controller detected." message
core/frontend/src/components/wizard/Wizard.vue
Introduce state and logic to track whether a flight controller board is currently detected before running setup flows.
  • Import fetchCurrentBoard from the autopilot updater module
  • Add a new board_not_detected data property defaulting to false
  • Update setupBoat to be async, fetch the current board, set board_not_detected and early-return if no board is present, or clear the flag and proceed if it is
  • Update setupROV to be async with the same fetch-and-early-return behavior based on board presence
core/frontend/src/components/wizard/Wizard.vue
Guard firmware installation against missing flight controller hardware and return a clear status message when none is detected.
  • Make installLatestStableFirmware call fetchCurrentBoard before proceeding
  • If no current_board is available on the autopilot object, immediately return the status string "No flight controller board detected." instead of attempting installation
core/frontend/src/components/wizard/Wizard.vue

Assessment against linked issues

Issue Objective Addressed Explanation
#3426 Detect whether a flight controller board is available before running the wizard customization step, and avoid the configuration process failing when no board is connected.
#3426 Provide a clear, user-visible message in the wizard when no flight controller board is detected instead of failing silently.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The fetchCurrentBoard + autopilot.current_board check is duplicated in setupBoat, setupROV, and installLatestStableFirmware; consider extracting a small helper (e.g., ensureBoardConnected() that also manages board_not_detected) to keep this logic consistent and easier to change.
  • The new async setupBoat/setupROV methods assume fetchCurrentBoard always resolves successfully; it may be worth handling or surfacing errors from that call explicitly so the user sees a clear message if board detection fails for reasons other than no board being present.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `fetchCurrentBoard` + `autopilot.current_board` check is duplicated in `setupBoat`, `setupROV`, and `installLatestStableFirmware`; consider extracting a small helper (e.g., `ensureBoardConnected()` that also manages `board_not_detected`) to keep this logic consistent and easier to change.
- The new async `setupBoat`/`setupROV` methods assume `fetchCurrentBoard` always resolves successfully; it may be worth handling or surfacing errors from that call explicitly so the user sees a clear message if board detection fails for reasons other than no board being present.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

bug: We should detect if there is a board available before running wizard customization step

1 participant