Skip to content

fix(firmware): pre-scheduler audio crash, double-click dead zone, wrong serial in envLogConfigChanges#10

Merged
bsatrom merged 6 commits intomainfrom
fix/firmware-critical-bugs
Apr 17, 2026
Merged

fix(firmware): pre-scheduler audio crash, double-click dead zone, wrong serial in envLogConfigChanges#10
bsatrom merged 6 commits intomainfrom
fix/firmware-critical-bugs

Conversation

@bsatrom
Copy link
Copy Markdown
Member

@bsatrom bsatrom commented Apr 15, 2026

Summary

  • Audio crash on init failure: audioPlayMelody was calling vTaskDelay unconditionally between notes, including when called from setup() before the FreeRTOS scheduler starts — calling vTaskDelay pre-scheduler is undefined behavior (likely hard fault on STM32). Applied the same useRtosPrimitives() guard already used by audioPlayTone.
  • Double-click dead zone: The button state machine's double-click condition elapsed < TRIPLE_CLICK_TIMEOUT_MS created a window where a double-click arriving near the timeout boundary was silently dropped (fell through to the orphan reset). Removed the upper bound — triple-click is already handled by the clickCount >= 3 branch above.
  • Wrong serial port: envLogConfigChanges was calling Serial directly instead of DEBUG_SERIAL and had no #ifdef DEBUG_MODE guard — meaning it ran in production builds and may have outputted to the wrong UART. Now consistent with envLogConfig.

Test plan

  • Firmware compiles without errors (pio run)
  • Power-on melody plays correctly even if Notecard init fails on first boot
  • Double-clicking the button reliably triggers the demo lock toggle
  • Triple-click still works correctly
  • Single-click still works correctly
  • No serial output on production UART in release build

🤖 Generated with Claude Code

bsatrom and others added 6 commits April 14, 2026 17:18
…or handling, type safety

- Refactor analytics.ts to use shared apiFetch/apiGet/apiPost helpers instead of
  duplicating fetchAuthSession + raw fetch in every function (~150 lines removed)
- Consolidate useIsAdmin, useUserGroups, useCanSendCommands onto a single shared
  TanStack Query cache entry to eliminate redundant Cognito round-trips
- Fix DisplayPreferences and FleetDefaults to only clear hasChanges on mutation
  onSuccess callback, preventing silent save button disable on API failure
- Add error feedback UI to both settings components on mutation failure
- Fix catch (error: any) in Analytics.tsx with proper TypeScript narrowing
- Replace index-based chat message keys with stable type+timestamp identity
- Tighten QueryResult.data from any[] to QueryRow[] (Record<string, string|number|boolean|null>[])
- Fix missing Satellite import in DeviceDetail.tsx

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tracing.ts

Reduces CloudWatch log volume in production by gating "Creating span",
"Span completed successfully", "Span ended", and flush lifecycle logs
behind DEBUG_TRACING=true. console.error calls are kept unconditionally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vLogConfigChanges serial port

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r + react-query refactors

- Merge origin/main to pull in the test suite from #18; resolve
  DeviceDetail.tsx import conflict (keep Satellite icon added here).
- Rewrite analytics.test.ts to mock the ./client helpers
  (apiFetch/apiGet/apiPost/apiPut/apiPatch/apiDelete) instead of the
  old global fetch + fetchAuthSession pattern, matching analytics.ts's
  refactor to call those helpers.
- Wrap useAuth hook tests in a QueryClientProvider and disable retry/
  retryDelay on the test QueryClient, since useAuth now backs its
  hooks with @tanstack/react-query.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…-bugs

# Conflicts:
#	songbird-dashboard/src/components/settings/FleetDefaults.tsx
#	songbird-dashboard/src/pages/DeviceDetail.tsx
…-bugs

# Conflicts:
#	songbird-dashboard/src/api/analytics.test.ts
@bsatrom bsatrom merged commit 76681a8 into main Apr 17, 2026
@bsatrom bsatrom deleted the fix/firmware-critical-bugs branch April 17, 2026 02:11
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