Commit Graph

83 Commits

Author SHA1 Message Date
Forairaaaaa 2c4f556cb6 Merge pull request #35 from wdoekes/feat/CardputerADV-better-keyboard
Various improvements to Keyboard usage
2026-04-13 18:01:06 +08:00
Forairaaaaa e5f404ba7e Merge pull request #36 from wdoekes/feat/CardputerADV-flaky-ble-kbd-fixes
Improvement to the Bluetooth keyboard connection
2026-04-13 17:44:07 +08:00
Walter Doekes 2fdbcd0566 keyboard: Fix ALT/OPT modifiers and key-release drops held modifier
When using the Keyboard BLE feature, pressing ALT-TAB to cycle through
windows was not possible. This is now fixed.

OPT-L (for screen lock) also works.

(Previously ALT and OPT/META keys never set _modifier_mask, so they were
sent as raw scan codes (0xe2/0xe3) in HID keycode slots instead of
setting the modifier byte. The USB sender now skips keycode for
modifier-only events.)

(On non-modifier key release, both BLE and USB senders sent an all-zero
HID report, dropping any held modifiers (e.g. ALT released on TAB-up).
Release now always sends getModifierMask() in the modifier byte so held
modifiers stay active -- enables ALT-TAB window cycling.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 11:14:46 +02:00
Walter Doekes 8317508631 keyboard: Fix KEY_DELETE to correct USB HID value 0x4C
When using the Keyboard BLE feature, the DEL keypress produced ^H
instead of ESC[3~ (forward DEL). This is now fixed.

(Previously, DEL was not a possible key so this went unnoticed.
Now with Fn enabling the RED keys, DEL is a valid keypress.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 11:14:43 +02:00
Walter Doekes 9ce215980c keyboard: Have Fn double as Shift key for the A-Z keys
The previous commit replaces Fn-as-shift with Aa-as-shift. But because
Aa and A are close to each other, that makes pressing Shift-A hard. As a
feature, Fn will do Shift for A-Z.

(No third symbol is printed on letter keys, so this feature made sense.)

The shift is injected via a new extraModifiers field in KeyEvent_t so the
HID modifier byte is set correctly over both BLE and USB, rather than
relying on the physical Aa (shift) key state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 11:14:41 +02:00
Walter Doekes 1319d7feee keyboard: Change CardputerADV keyboard layout (Aa=Shift, Fn=RED)
This change remaps some keyboard modifier keys:

- The front panel shows BLUE for the Shift keys, so it makes sense to
  have the BLUE Aa (row 2, col 1) key mean Shift.

- The Fn key (row 2, col 0) is RED, so it makes sense to have it modify
  to the red ARROW, DEL and ESC keys.

- Caps lock support (previous Aa behaviour) is dropped for now (could be
  reinstated by Fn+Aa).

This results in the following behaviour:

- Fn (2,0): does red keys: (0,0)=ESC, (0,13)=DEL, (2,11)=UP, (3,10)=LEFT,
  (3,11)=DOWN, (3,12)=RIGHT

- Aa (2,1): does Shift: uppercase A-Z, symbols above 0-9, etc.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 11:14:32 +02:00
Forairaaaaa 0a611201ac Merge pull request #37 from wdoekes/feat/CardputerADV-fix-keybaord-typo
cleanup: Rename keybaord to keyboard (fix typo)
2026-04-13 11:09:59 +08:00
Walter Doekes 753674141b cleanup: Rename keybaord to keyboard (fix typo)
Closes: #34
2026-04-06 23:21:10 +02:00
Walter Doekes 3944f20ee8 bluetooth/kbd: Improve BLE HID connection stability / power usage
Peripheral Preferred Connection Parameters (PPCP) characteristic was
previously unset. It is now optimized for a (low-power) keyboard.

Both mechanisms are needed because they serve different roles:

- sdkconfig PPCP (CONFIG_BT_NIMBLE_SVC_GAP_PPCP_*): populates the
  Peripheral Preferred Connection Parameters GATT characteristic in the
  GAP service. A central reads this during service discovery and may
  apply the preferences. Acting on PPCP is optional for the central.

- ble_gap_update_params() in code: sends an active L2CAP connection
  parameter update request immediately after connect. This forces
  negotiation rather than just advertising a preference; most hosts
  accept reasonable HID parameters when actively requested.

Some hosts honour PPCP but ignore the update request; others do the
reverse. Keeping both and setting all values to something sane maximises
compatibility across Linux, macOS, Windows, and Android.

NOTE: Remove any stale 'sdkconfig' in the directory before rebuilding.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 22:55:08 +02:00
Walter Doekes 340c180e9f bluetooth/kbd: Enable BLE bond persistence
Without this, NimBLE held bond and key material only in RAM, so every
power cycle might required re-pairing. In practice this seemed to
auto-pair partially. The keyboard would connect and disconnect often and
keys would be dropped.

Setting CONFIG_BT_NIMBLE_NVS_PERSIST=y writes bond data to the NVS
partition (0x9000-0xCFFF). That partition is not touched by a normal
app-only flash (write_flash 0x10000), so bonds survive both power
cycles and iterative firmware updates.

After a full erase-flash or first flash of new firmware the NVS
partition is wiped and the host must be told to forget the old bond:

    bluetoothctl remove <MAC>

Then re-pair normally.

NOTE: Remove any stale 'sdkconfig' in the directory before rebuilding.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 22:51:07 +02:00
Forairaaaaa 452db44bbc bump version ADV-V0.3 2025-11-17 11:40:36 +08:00
Forairaaaaa c038f5bb16 restore non-letters use_shifted_version handle 2025-11-17 11:36:09 +08:00
Forairaaaaa add0be8399 format 2025-11-17 11:29:15 +08:00
Forairaaaaa ecb4e7435c Merge pull request #30 from onexs-xsi/CardputerADV
1.keyboard优化操作逻辑,现在adv多键输入时将与颜色指示的字符对应。
2025-11-17 11:06:34 +08:00
onexs-xsi 3997eb68e3 1.keyboard优化操作逻辑,现在adv多建输入时将与颜色指示的字符对应。
2.添加StringIR APP用于提供MorseMatrix的IR字符串传输支持
2025-11-12 10:14:14 +08:00
Forairaaaaa 5e2eed2678 Merge pull request #29 from Forairaaaaa/fix-bat-level-reading
Fix bat level reading
ADV-V0.2
2025-10-21 12:18:08 +08:00
Forairaaaaa e824a76be0 restore bat reading interval 2025-10-21 09:40:32 +08:00
Forairaaaaa 5bb3dcaf94 update to latest gfx and unified, add battery level label 2025-10-21 09:32:04 +08:00
Forairaaaaa be4b8b7bf7 update link 2025-09-04 17:24:07 +08:00
Forairaaaaa ead2e95083 Merge pull request #27 from Forairaaaaa/Cardputer-ADV
CardputerADV userdemo
2025-09-04 16:54:03 +08:00
Forairaaaaa f07c34144f lock dependencies 2025-09-04 16:51:06 +08:00
Forairaaaaa 122742e060 update readme 2025-08-29 14:58:02 +08:00
Forairaaaaa f0a0d5b787 init 2025-08-29 14:51:24 +08:00
Forairaaaaa f3169b05d9 Merge pull request #25 from lahirunirmalx/sd-card-issue-fix
conflicting SPI host issue fix
2025-03-03 18:23:50 +08:00
Lahiru 68820a8d5b conflicting SPI host issue fix 2024-11-24 23:11:15 +05:30