Commit Graph
44 Commits
Author SHA1 Message Date
MarcelineVPQandClaude Opus 4.7 fb68ea5608 fix(batt-led): force LED off + disarm on disconnect
The low-battery blink would stay frozen mid-cycle (or briefly resume
during reconnect retries) after a controller died and lost connection,
because the stale-report check stopped toggling but never turned the
LED off, and the cached interrupt_in_data[52] still read low.

New `battery_led_on_disconnect()` clears blink state, forces the LED
off, and zeros last_report_us so the stale-check early-return blocks
any new blink until a fresh 0x31 report arrives on the next connection.
Called from bt.cpp's HCI_EVENT_DISCONNECTION_COMPLETE handler.

Stale-check in the tick also now forces LED off when it fires while a
blink was in progress (defense in depth for unclean disconnects).

Same bug exists in upstream awalol/DS5Dongle (their battery_led.cpp is
byte-identical to ours pre-fix) — Sura Academy reported it in their
Discord. Plan to send this back as a PR after we validate it locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 11:19:55 -06:00
MarcelineVPQandClaude Opus 4.7 0593d79f5b rebase: Phase D — multi-slot pairing on top of state_mgr base
bt.h: add OLED accessors (bt_is_connected, bt_get_addr, bt_hci_err_count)
and 6 multi-slot accessors (bt_get_slot, bt_set_slot, bt_forget_slot,
bt_wipe_all_slots, bt_slot_occupied, bt_slot_get_addr).

bt.cpp:
- #include "slots.h"; add g_current_slot + update_discoverable()
  helper that gates gap_discoverable_control on slots_any_empty().
- 3 OLED accessor impls + 6 slot accessor impls.
- bt_init: slots_load() + g_current_slot from Config_body.current_slot,
  then update_discoverable() instead of bare gap_discoverable_control(1).
- HCI_EVENT_INQUIRY_RESULT: slot-ownership filter (skip devices owned
  by other slots; if our slot is occupied, only accept matching addr).
- L2CAP_EVENT_CHANNEL_OPENED HID_CONTROL: slot_assign on empty slot
  (Phase G auto-bond pattern).
- L2CAP_EVENT_CHANNEL_OPENED HID_INTERRUPT: replace upstream's
  gap_*_control(false) pair with update_discoverable() — they wanted
  "non-discoverable once connected"; we want "non-discoverable once
  all 4 slots are full". Strictly looser, which is correct since
  empty slots need to accept new pairings.
- Inquiry-complete + disconnection-complete handlers similarly
  swapped to update_discoverable().

Upstream's state_mgr hooks (state_init / state_set / state_update
calls in L2CAP_EVENT_CHANNEL_OPENED and elsewhere) are preserved
as-is — they're the upstream rumble-fix infrastructure.

Build still fails on oled.cpp references to audio_peak_* / counter
accessors that Phase E adds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 07:58:18 -06:00
awalolandGitHub 154e3a6355 Merge branch 'master' into refactor/state_mgr 2026-05-16 14:06:01 +08:00
9e2de40b9b Add bt_get_signal_strength Comment
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-16 13:51:29 +08:00
awalol c2e0d8468d fix: state init after connected 2026-05-16 12:51:48 +08:00
awalol 7bbe37ba1c refactor: unified controller state by state_mgr 2026-05-15 20:07:12 +08:00
awalol 9a2c2b45e1 disable pico discoverable and connectable after connected 2026-05-14 23:26:29 +08:00
awalol 908bace5c4 feat(bt_rssi): add 0xf9 feature report to get bt rssi 2026-05-14 21:50:39 +08:00
dereckhall 4b4fc8fe1c fix: extend inactivity detection to all primary inputs
Upstream only checks left stick X axis, so pressing buttons, using
the d-pad, or moving the right stick won't prevent disconnection.

Extends the same dead zone pattern to cover both sticks (all 4 axes),
both button bytes, and d-pad/misc bytes.
2026-05-13 18:43:11 -04:00
awalol d3311a35d9 adjust l2cap mtu 2026-05-13 16:45:48 +08:00
462ddcb4c7 typo
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-13 16:19:09 +08:00
awalol 3a31bd75af refactor: add SetStateData and audio send priority 2026-05-13 16:19:08 +08:00
awalol 897beedeac fix: new pair
(cherry picked from commit 30e11f0f76fff6035fd36908662c87ba55abdef7)
2026-05-13 16:19:07 +08:00
awalol 9c668a73e4 fix: hid input stutter
(cherry picked from commit 3a179c74b325b9a8a9a54d6b4061c33a5be1b734)
2026-05-13 16:19:03 +08:00
julen 8960987156 fix: integer overflow when inactive_time exceeds 35
When the inactive_time configuration value exceeds 35, the expression
`get_config().inactive_time * 60 * 1000 * 1000`
overflows the maximum int value due to implicit integer conversion.
2026-05-10 12:59:33 +08:00
awalol bb1c8f4a97 add Log Verbose option 2026-05-09 14:22:46 +08:00
awalol 1014a13ed0 fix: controller auto mode 2026-05-08 19:31:24 +08:00
awalol f8f86a29ef fix: ENABLE_SERIAL conditional compilation 2026-05-08 17:37:53 +08:00
awalol be01dc439e add usb serial for debug firmware
Code by gpt5.5-xhigh
2026-05-08 13:54:07 +08:00
awalol 6ded3361f9 auto switch ds mode 2026-05-07 23:00:19 +08:00
awalol 33c44907b6 increase bt interrupt mtu 2026-05-07 20:28:08 +08:00
awalol 3ef74c8542 refactor(bt): replace std::queue with queue_t 2026-05-06 17:30:53 +08:00
awalol 7358a81d11 fix: DSE Profile Save. Thanks @fuhuasxflwb 2026-05-05 21:14:29 +08:00
awalol a887c6fb39 使用 absolute_time_t 替代 time_us_32 作为计时器 2026-05-05 18:47:39 +08:00
awalolandGitHub c665eab4d5 Merge pull request #27 from dereckhall/fix/get-feature-overread
fix buffer overread in get_feature_data
2026-05-05 15:45:36 +08:00
awalol 351d71dfe1 cmd: controller mode switch 2026-05-05 15:19:22 +08:00
Dereck b54bd2452e fix buffer overread in get_feature_data
l2cap_send was passed the caller's `len` (expected response size) instead of
the actual array size. The get_feature array is only 2 bytes (transaction
header + report ID), so this read up to 62 bytes of uninitialized stack.

Use sizeof(get_feature) to send only the 2-byte GET_REPORT request.
2026-05-05 00:07:35 -04:00
awalol fb8624b61b feat: config manager 2026-05-05 01:17:15 +08:00
awalol d1d54eaa41 add watchdog 2026-04-30 14:25:31 +08:00
awalol 137535c8cf fix: ds5 does not fully disconnect 2026-04-29 13:04:30 +08:00
awalol c7472e81a1 refactor: get test command result 2026-04-28 14:14:09 +08:00
awalol 3300e084bc clean std:: 2026-04-28 13:17:55 +08:00
awalol 6c992af459 feat: support test command 2026-04-28 13:15:20 +08:00
awalol 17627eebe4 feat: usb device auto disconnect 2026-04-26 14:33:06 +08:00
awalol ed4f7ac8e6 修复静默时间bug 增加静默时间到30分钟 2026-04-04 00:44:35 +08:00
awalol 63c15e435c fix: mic mute 2026-03-22 14:03:43 +08:00
awalol 845656aedd feat:adjust gain in speaker volume. add led and auto-disconnect toggle in mute. 2026-03-22 00:33:30 +08:00
awalol 49eba414cb fix: auto-disconnect reset time 2026-03-21 13:16:14 +08:00
awalol 831b1e9b73 feat: disconnect when inactive 2026-03-21 12:17:13 +08:00
awalol 8c8af7b97c set buffer length 2026-03-21 11:01:52 +08:00
awalol 5251ae1f5b fix gyro 2026-03-15 13:35:45 +08:00
awalol 51157ce997 我也不知道改了什么 2026-03-14 21:37:47 +08:00
awalol 0fd9c2bdd3 fix reconnect 2026-03-10 16:14:05 +08:00
awalol 9a929530d9 First Commit 2026-03-05 16:21:25 +08:00