Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions RingBreak/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ struct ContentView: View {
RingBreakView(ringConManager: ringConManager, menubarController: menubarController)
} else {
OnboardingView {
// Re-initialize Ring-Con MCU after onboarding
// This is needed because the user clips in the Ring-Con during onboarding,
// after the Joy-Con has already connected and MCU initialized
ringConManager.reinitializeRingCon()
hasCompletedOnboarding = true
}
}
Expand Down
19 changes: 19 additions & 0 deletions RingBreak/RingConDriver/RingConManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,25 @@ class RingConManager: NSObject, ObservableObject {
yawRestSamples = 0
}

/// Re-initialize Ring-Con MCU configuration
/// Call this after the user clips in the Ring-Con to re-detect it
func reinitializeRingCon() {
guard isConnected else { return }

// Reset Ring-Con state
ringConAttached = false
mcuInitialized = false
mcuReportCount = 0
neutralFlexByte = nil
flexValue = 0.5
lastFlexByte = 0x0A

// Re-run MCU initialization
Task {
await initializeRingCon()
}
}

/// Start calibration process
func calibrate() {
startGuidedCalibration()
Expand Down