Skip to content

Cannot switch to a different radio after disconnecting #12

Description

@ten9876

Bug Report

Description

After connecting to one radio and then disconnecting, the user cannot connect to a different radio on the network. The auto-connect logic immediately reconnects to the first radio whenever its discovery broadcast arrives.

Root Cause

The auto-connect lambda in MainWindow triggers on every radioDiscovered signal, checking only if the serial matches lastRadioSerial in QSettings and the radio isn't currently connected. After an intentional disconnect, isConnected() returns false, so the very next discovery broadcast (every ~1 second) reconnects to the original radio before the user can select a different one.

Fix

Added m_userDisconnected flag to MainWindow:

  • Set true when user clicks Disconnect — blocks auto-connect
  • Cleared when user explicitly clicks Connect on any radio — re-enables auto-connect with the new radio's serial
  • Defaults to false on app launch so auto-connect to last radio still works

Files Changed

  • src/gui/MainWindow.h — added m_userDisconnected member
  • src/gui/MainWindow.cpp — guard auto-connect lambda, set flag on disconnect/connect

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions