From a26527d2ae3b30ff848d8d67f0c9c81786119c99 Mon Sep 17 00:00:00 2001 From: Smathev Date: Tue, 7 Oct 2025 13:17:17 +0200 Subject: [PATCH] Add handedness support and firmware build scripts for Fingerpunch Sweeeeep keyboard --- BUILD_GUIDE.md | 124 +++++++++++++ CONFIG_HIERARCHY.md | 122 +++++++++++++ FLASH_HANDEDNESS.md | 163 ++++++++++++++++++ LIATRIS_QUICK_START.txt | 81 +++++++++ build_all.sh | 125 ++++++++++++++ .../sweeeeep/keymaps/smathev/config.h | 46 +++++ users/smathev/combos.c | 6 +- users/smathev/combos.h | 2 +- users/smathev/config.h | 17 +- 9 files changed, 673 insertions(+), 13 deletions(-) create mode 100644 BUILD_GUIDE.md create mode 100644 CONFIG_HIERARCHY.md create mode 100644 FLASH_HANDEDNESS.md create mode 100644 LIATRIS_QUICK_START.txt create mode 100755 build_all.sh create mode 100644 keyboards/fingerpunch/sweeeeep/keymaps/smathev/config.h diff --git a/BUILD_GUIDE.md b/BUILD_GUIDE.md new file mode 100644 index 00000000..8c3db97e --- /dev/null +++ b/BUILD_GUIDE.md @@ -0,0 +1,124 @@ +# QMK Firmware Build Guide for Fingerpunch Sweeeeep + +This guide explains how to build and flash firmware for your split keyboard with EE_HANDS. + +## Quick Start + +### Build All Firmware Files + +```bash +./build_all.sh +``` + +This creates three files: +- `fingerpunch_sweeeeep_smathev.uf2` - Regular firmware +- `fingerpunch_sweeeeep_smathev_LEFT.uf2` - LEFT hand initialization +- `fingerpunch_sweeeeep_smathev_RIGHT.uf2` - RIGHT hand initialization + +## First-Time Setup (One-Time Only) + +You only need to do this ONCE to set the handedness in EEPROM: + +1. **Initialize LEFT keyboard half:** + - Unplug both halves + - Plug in the LEFT half + - Double-tap RESET button on Liatris controller + - Drag `fingerpunch_sweeeeep_smathev_LEFT.uf2` to the RPI-RP2 drive + - Wait for it to disconnect/reconnect + +2. **Initialize RIGHT keyboard half:** + - Unplug both halves + - Plug in the RIGHT half + - Double-tap RESET button on Liatris controller + - Drag `fingerpunch_sweeeeep_smathev_RIGHT.uf2` to the RPI-RP2 drive + - Wait for it to disconnect/reconnect + +3. **Test:** Plug either half in via USB - keys should work correctly regardless of which side is plugged in! + +## Regular Firmware Updates + +After handedness is initialized, use the regular firmware for all future updates: + +1. **Flash regular firmware to BOTH halves:** + - Double-tap RESET on each half + - Drag `fingerpunch_sweeeeep_smathev.uf2` to each + +2. **Handedness is preserved:** The EEPROM remembers which half is which, so you don't need the `_LEFT` or `_RIGHT` files anymore (unless you want to change handedness). + +## How It Works + +### EE_HANDS (EEPROM Handedness) + +- Each keyboard half stores its identity (LEFT or RIGHT) in EEPROM +- The handedness firmware (`_LEFT.uf2` and `_RIGHT.uf2`) initializes this EEPROM value on first flash +- After initialization, either half can be plugged in as master +- Regular firmware preserves the EEPROM handedness value + +### Build Process + +The `build_all.sh` script: + +1. **Regular firmware:** Builds with `EE_HANDS` defined +2. **LEFT firmware:** Temporarily adds `INIT_EE_HANDS_LEFT` to config.h and builds +3. **RIGHT firmware:** Temporarily adds `INIT_EE_HANDS_RIGHT` to config.h and builds +4. **Restores:** Original config.h is restored after builds + +The `INIT_EE_HANDS_LEFT/RIGHT` defines tell QMK to write the handedness to EEPROM on boot. + +## Troubleshooting + +### Keys are backwards when plugging in one side + +- You probably flashed the wrong `_LEFT` or `_RIGHT` file to the wrong keyboard half +- Solution: Re-flash with the correct handedness files + +### Master side always seems to be the same regardless of which I plug in + +- The `EE_HANDS` setting may not be properly configured +- Check that `config.h` has `#define EE_HANDS` (not `MASTER_LEFT` or `MASTER_RIGHT`) +- Rebuild and reflash handedness files + +### How do I reset/change handedness? + +- Simply flash the opposite handedness firmware to swap a keyboard half's identity +- Example: Flash `_RIGHT.uf2` to what was previously the LEFT half + +## File Structure + +``` +qmk_userspace/ +├── build_all.sh # Main build script (builds all 3 files) +├── build_handedness_manual.sh # Legacy handedness-only builder +├── fingerpunch_sweeeeep_smathev.uf2 # Regular firmware +├── fingerpunch_sweeeeep_smathev_LEFT.uf2 # LEFT initialization +├── fingerpunch_sweeeeep_smathev_RIGHT.uf2# RIGHT initialization +├── keyboards/ +│ └── fingerpunch/ +│ └── sweeeeep/ +│ └── keymaps/ +│ └── smathev/ +│ ├── config.h # Keyboard-specific config (EE_HANDS) +│ └── keymap.c # Your keymap +└── users/ + └── smathev/ + ├── config.h # Userspace config + ├── combos.c/h # Combo definitions + └── ... +``` + +## Additional Notes + +### Liatris Controller + +- The Liatris uses RP2040 (same as Raspberry Pi Pico) +- Firmware files are `.uf2` format +- Double-tap RESET to enter bootloader mode (appears as RPI-RP2 drive) +- No need for QMK Toolbox - just drag and drop files + +### Configuration Hierarchy + +1. **users/smathev/config.h** - User preferences (applies to all keyboards) +2. **keyboards/.../keymaps/smathev/config.h** - Keyboard-specific overrides +3. **Keyboard defaults** - Base keyboard configuration + +The `EE_HANDS` setting is in the keyboard-specific config because it's hardware-dependent. diff --git a/CONFIG_HIERARCHY.md b/CONFIG_HIERARCHY.md new file mode 100644 index 00000000..5d24e0ae --- /dev/null +++ b/CONFIG_HIERARCHY.md @@ -0,0 +1,122 @@ +# QMK Configuration Hierarchy + +Understanding where to put your settings in QMK userspace. + +## Configuration Priority (Highest to Lowest) + +``` +1. keyboards/.../keymaps/smathev/config.h ← HIGHEST PRIORITY (keyboard-specific) + ↓ overrides +2. users/smathev/config.h ← USER DEFAULTS (all keyboards) + ↓ overrides +3. keyboards/.../config.h ← KEYBOARD DEFAULTS + ↓ overrides +4. QMK defaults ← LOWEST PRIORITY +``` + +## Your Current Setup + +### 📁 `users/smathev/config.h` +**Purpose:** Settings that apply to ALL your keyboards + +**What belongs here:** +- ✅ Tapping terms (`TAPPING_TERM`, `PERMISSIVE_HOLD`) +- ✅ Auto-shift settings (`AUTO_SHIFT_TIMEOUT`, `RETRO_SHIFT`) +- ✅ Combo preferences (`COMBO_REF_DEFAULT`) +- ✅ Personal preferences that don't change between keyboards +- ✅ Layout aliases (`LAYOUT_sweeeeep`) + +**Example:** +```c +#define TAPPING_TERM 140 +#define PERMISSIVE_HOLD +#define CASEMODES_ENABLE +``` + +### 📁 `keyboards/fingerpunch/sweeeeep/keymaps/smathev/config.h` +**Purpose:** Settings specific to THIS keyboard/keymap + +**What belongs here:** +- ✅ Split keyboard settings (`EE_HANDS`, `SPLIT_USB_DETECT`) +- ✅ Hardware-specific features (`OLED_FONT_H`) +- ✅ Keyboard-specific overrides +- ✅ Split communication settings + +**Example:** +```c +#define EE_HANDS +#define SPLIT_USB_DETECT +#define OLED_FONT_H "path/to/font.c" +``` + +## Why This Matters + +### ❌ Wrong Approach: +Putting everything in `users/smathev/config.h` +- Split keyboard settings affect non-split keyboards +- OLED settings break keyboards without OLED +- Hardware-specific settings cause conflicts + +### ✅ Correct Approach: +- **Userspace (`users/`)**: Personal preferences that work everywhere +- **Keymap (`keymaps/`)**: Keyboard-specific hardware and features + +## Common Settings Placement + +| Setting | Location | Reason | +|---------|----------|--------| +| `TAPPING_TERM` | `users/` | Personal preference | +| `EE_HANDS` | `keymaps/` | Split keyboard specific | +| `OLED_FONT_H` | `keymaps/` | Hardware specific | +| `COMBO_REF_DEFAULT` | `users/` | User preference | +| `SPLIT_USB_DETECT` | `keymaps/` | Split keyboard specific | +| `AUTO_SHIFT_TIMEOUT` | `users/` | Personal preference | +| `PERMISSIVE_HOLD` | `users/` | Personal preference | + +## Your Configuration Files + +### Current Structure: +``` +qmk_userspace/ +├── users/smathev/ +│ ├── config.h ← User-wide settings +│ ├── rules.mk ← User-wide features +│ ├── combos.c/h +│ └── ... +└── keyboards/ + └── fingerpunch/sweeeeep/ + └── keymaps/smathev/ + ├── config.h ← Keyboard-specific settings (EE_HANDS here!) + ├── keymap.c + └── keymap.json +``` + +## Testing Your Configuration + +```bash +# Compile to see if settings are applied correctly +qmk compile -kb fingerpunch/sweeeeep -km smathev + +# Check for configuration conflicts in warnings +qmk compile -kb fingerpunch/sweeeeep -km smathev 2>&1 | grep "config.h" +``` + +## Pro Tips + +💡 **Use Comments:** Clearly mark which config file is for what purpose + +💡 **Test on Multiple Keyboards:** If you add more keyboards, userspace settings will automatically apply + +💡 **Override When Needed:** Keymap config.h can override userspace defaults + +💡 **Keep It DRY:** Don't repeat settings - put them in the most appropriate place + +## If You Add More Keyboards + +When you add another keyboard (e.g., a 60% board): + +1. **User settings automatically apply** (tapping, combos, etc.) +2. **Create keyboard-specific config.h** only for that keyboard's unique needs +3. **Split settings don't affect** your non-split boards + +This is the power of QMK userspace! 🚀 diff --git a/FLASH_HANDEDNESS.md b/FLASH_HANDEDNESS.md new file mode 100644 index 00000000..cb2fc59b --- /dev/null +++ b/FLASH_HANDEDNESS.md @@ -0,0 +1,163 @@ +# Flashing Split Keyboard Handedness (EE_HANDS) + +Your fingerpunch/sweeeeep keyboard with **Liatris controllers** uses `EE_HANDS` for split keyboard handedness detection. This means each half needs to be flashed with its handedness information stored in EEPROM. + +> **Note:** The Liatris is an RP2040-based Pro Micro replacement controller. It uses `.uf2` files and bootloader mode for flashing. + +## Visual Guide + +``` +┌─────────────────────────────────────────────────────────┐ +│ STEP 1: Build handedness firmware files │ +│ $ ./build_handedness.sh │ +│ → Creates _LEFT.uf2 and _RIGHT.uf2 │ +└─────────────────────────────────────────────────────────┘ + ↓ +┌─────────────────────────────────────────────────────────┐ +│ STEP 2: Flash LEFT half │ +│ 1. Unplug both halves │ +│ 2. Plug in LEFT half │ +│ 3. Double-tap RESET button on Liatris │ +│ 4. Drag _LEFT.uf2 to RPI-RP2 drive │ +└─────────────────────────────────────────────────────────┘ + ↓ +┌─────────────────────────────────────────────────────────┐ +│ STEP 3: Flash RIGHT half │ +│ 1. Unplug both halves │ +│ 2. Plug in RIGHT half │ +│ 3. Double-tap RESET button on Liatris │ +│ 4. Drag _RIGHT.uf2 to RPI-RP2 drive │ +└─────────────────────────────────────────────────────────┘ + ↓ +┌─────────────────────────────────────────────────────────┐ +│ STEP 4: Test │ +│ • Test each half independently (plug in solo) │ +│ • Both halves should work when connected │ +│ • If one acts wrong, re-flash that specific half │ +└─────────────────────────────────────────────────────────┘ +``` + +## Quick Reference + +### Build Commands + +```bash +# Build LEFT hand firmware with EEPROM handedness +qmk compile -kb fingerpunch/sweeeeep -km smathev -e INIT_EE_HANDS_LEFT=yes + +# Build RIGHT hand firmware with EEPROM handedness +qmk compile -kb fingerpunch/sweeeeep -km smathev -e INIT_EE_HANDS_RIGHT=yes +``` + +### Generated Files + +After building, you'll have: +- `fingerpunch_sweeeeep_smathev.uf2` - The most recent build (left OR right) +- Copy this immediately after building to preserve it! + +### Recommended Workflow + +```bash +cd /home/smathev/git_dev/keyboards/qmk_userspace + +# Build and save LEFT hand +qmk compile -kb fingerpunch/sweeeeep -km smathev -e INIT_EE_HANDS_LEFT=yes +cp fingerpunch_sweeeeep_smathev.uf2 fingerpunch_sweeeeep_smathev_LEFT.uf2 + +# Build and save RIGHT hand +qmk compile -kb fingerpunch/sweeeeep -km smathev -e INIT_EE_HANDS_RIGHT=yes +cp fingerpunch_sweeeeep_smathev.uf2 fingerpunch_sweeeeep_smathev_RIGHT.uf2 + +# Now you have both files ready to flash +ls -lh fingerpunch_sweeeeep_smathev_*.uf2 +``` + +## Flashing Instructions + +### For Liatris Controllers (RP2040-based): + +The **Liatris** has a **RESET button** (small button on the controller). To enter bootloader mode: + +#### Method 1: Double-tap Reset (Recommended) +1. **Left Half:** + - Unplug both halves + - Plug in LEFT half + - **Quickly double-tap the RESET button** on the Liatris controller + - The controller will appear as a USB drive named `RPI-RP2` + - Copy/drag `fingerpunch_sweeeeep_smathev_LEFT.uf2` to the `RPI-RP2` drive + - The board will reboot automatically and disappear + +2. **Right Half:** + - Unplug both halves + - Plug in RIGHT half + - **Quickly double-tap the RESET button** on the Liatris controller + - The controller will appear as a USB drive named `RPI-RP2` + - Copy/drag `fingerpunch_sweeeeep_smathev_RIGHT.uf2` to the `RPI-RP2` drive + - The board will reboot automatically and disappear + +#### Method 2: Hold Boot + Plug In +1. If double-tap doesn't work, you can hold the BOOT button while plugging in the USB cable +2. The Liatris has a small BOOT button - check the controller PCB for its location + +> **💡 Tip:** If the `RPI-RP2` drive doesn't appear, try: +> - Double-tapping faster or slower +> - Using a different USB cable/port +> - Checking that the Liatris is properly seated in the sockets + +3. **Test:** + - Plug in ONLY the left half → keyboard should work + - Plug in ONLY the right half → keyboard should work + - If either half doesn't work solo, re-flash that half + +## After Initial Handedness Setup + +Once each half has been flashed with its handedness, you can flash regular firmware to BOTH halves: + +```bash +# Normal build (no handedness parameter) +qmk compile -kb fingerpunch/sweeeeep -km smathev + +# Flash this to BOTH halves - handedness is preserved in EEPROM +``` + +The handedness information persists in EEPROM through normal firmware updates! + +## Troubleshooting + +### "Wrong half detected" +- Re-flash the problematic half with the handedness firmware +- Make sure you're copying the correct file (LEFT vs RIGHT) +- Verify you're flashing the correct physical half + +### "Both halves act as the same side" +- You need to flash different files to each half +- `*_LEFT.uf2` → left physical half (usually has the TRRS jack on the left side) +- `*_RIGHT.uf2` → right physical half (usually has the TRRS jack on the right side) + +### "RPI-RP2 drive doesn't appear" +- **Liatris-specific:** Try double-tapping the RESET button faster or slower +- The timing can be finicky - practice a few times +- Make sure you're using a data USB cable (not charge-only) +- Try a different USB port +- Check that the Liatris is properly installed in the Pro Micro sockets + +### "Keyboard not detected as USB device" +- Check USB cable (must be a data cable, not charge-only) +- Try a different USB port +- Verify the Liatris is correctly inserted (orientation matters!) +- Check for bent pins on the Liatris controller + +### "Compile fails with 'converter not found'" +- Your keymap should have `"converter": "liatris"` in `keymap.json` +- This tells QMK to build for the Liatris controller + +## File Naming Convention + +To avoid confusion, use this naming: +- `*_LEFT.uf2` - For the **left physical half** +- `*_RIGHT.uf2` - For the **right physical half** +- `*.uf2` (no suffix) - Regular firmware (both halves) + +## Build Script + +Created: `build_handedness.sh` for easier building diff --git a/LIATRIS_QUICK_START.txt b/LIATRIS_QUICK_START.txt new file mode 100644 index 00000000..70b6d3f5 --- /dev/null +++ b/LIATRIS_QUICK_START.txt @@ -0,0 +1,81 @@ +╔══════════════════════════════════════════════════════════════════╗ +║ LIATRIS SPLIT KEYBOARD - HANDEDNESS QUICK REFERENCE ║ +╚══════════════════════════════════════════════════════════════════╝ + +🎯 YOUR SETUP: Fingerpunch Sweeeeep + Liatris (RP2040) Controllers + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + STEP 1: BUILD HANDEDNESS FIRMWARE +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +Run this script to build both files: + $ ./build_handedness.sh + +Or manually: + $ qmk compile -kb fingerpunch/sweeeeep -km smathev -e INIT_EE_HANDS_LEFT=yes + $ cp fingerpunch_sweeeeep_smathev.uf2 fingerpunch_sweeeeep_smathev_LEFT.uf2 + + $ qmk compile -kb fingerpunch/sweeeeep -km smathev -e INIT_EE_HANDS_RIGHT=yes + $ cp fingerpunch_sweeeeep_smathev.uf2 fingerpunch_sweeeeep_smathev_RIGHT.uf2 + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + STEP 2: FLASH LEFT HALF +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +1. ⚡ Unplug BOTH keyboard halves +2. 🔌 Plug in LEFT half to computer +3. 🔘 Double-tap RESET button on Liatris + └─► A drive named "RPI-RP2" will appear +4. 📋 Copy fingerpunch_sweeeeep_smathev_LEFT.uf2 to the RPI-RP2 drive +5. ⏳ Board reboots automatically (drive disappears = success!) + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + STEP 3: FLASH RIGHT HALF +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +1. ⚡ Unplug BOTH keyboard halves +2. 🔌 Plug in RIGHT half to computer +3. 🔘 Double-tap RESET button on Liatris + └─► A drive named "RPI-RP2" will appear +4. 📋 Copy fingerpunch_sweeeeep_smathev_RIGHT.uf2 to the RPI-RP2 drive +5. ⏳ Board reboots automatically (drive disappears = success!) + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + STEP 4: TEST +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +✓ Plug in ONLY left half → Should type normally +✓ Plug in ONLY right half → Should type normally +✓ Connect both halves → Should work as full split keyboard + +If a half types the wrong keys, re-flash that specific half. + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + 💡 TIPS & TROUBLESHOOTING +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +🔘 Finding the RESET button: + - Small tactile button on the Liatris controller PCB + - Usually located near the USB connector + - Requires a small tool or fingernail to press + +📱 Double-tap timing: + - Tap quickly like a mouse double-click + - Too slow = won't work, too fast = won't work + - Practice a few times to get the timing right + +❌ RPI-RP2 drive doesn't appear? + - Try double-tapping faster or slower + - Use a data USB cable (not charge-only) + - Try a different USB port + - Verify Liatris is properly seated in sockets + +🔄 After initial setup: + - Future firmware updates can be flashed to BOTH halves + - Handedness is saved in EEPROM and persists + - Only need handedness files for the FIRST flash or after EEPROM reset + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +📚 Detailed documentation: FLASH_HANDEDNESS.md +🔧 Build script: ./build_handedness.sh diff --git a/build_all.sh b/build_all.sh new file mode 100755 index 00000000..3760c0b0 --- /dev/null +++ b/build_all.sh @@ -0,0 +1,125 @@ +#!/usr/bin/env bash +# Complete firmware builder for fingerpunch/sweeeeep with Liatris +# Builds three versions: +# 1. Regular firmware (for normal use after handedness is set) +# 2. LEFT handedness initialization firmware +# 3. RIGHT handedness initialization firmware + +set -e # Exit on error + +KEYBOARD="fingerpunch/sweeeeep" +KEYMAP="smathev" +OUTPUT_NAME="fingerpunch_sweeeeep_smathev" + +CONFIG_FILE="$HOME/git_dev/keyboards/qmk_userspace/keyboards/fingerpunch/sweeeeep/keymaps/smathev/config.h" +BACKUP_FILE="${CONFIG_FILE}.backup" +QMK_FIRMWARE_DIR="$HOME/git_dev/keyboards/qmk_firmware" +OUTPUT_DIR="$HOME/git_dev/keyboards/latest_firmware" + +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "🔨 Building ALL firmware versions for $KEYBOARD" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "" +echo "⚙️ Keyboard: $KEYBOARD" +echo "⚙️ Keymap: $KEYMAP" +echo "⚙️ Controller: Liatris (RP2040)" +echo "" + +# Clean build +echo "🧹 Cleaning previous build..." +qmk clean > /dev/null 2>&1 +echo "" + +# ============================================================================ +# 1. Build REGULAR firmware (for normal use) +# ============================================================================ +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "📦 [1/3] Building REGULAR firmware..." +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +qmk compile -kb "$KEYBOARD" -km "$KEYMAP" +if [ $? -eq 0 ]; then + cp "$QMK_FIRMWARE_DIR/${OUTPUT_NAME}.uf2" "$OUTPUT_DIR/${OUTPUT_NAME}.uf2" + echo "✅ Regular firmware: ${OUTPUT_NAME}.uf2" +else + echo "❌ Regular firmware build failed!" + exit 1 +fi +echo "" + +# Backup original config for handedness builds +cp "$CONFIG_FILE" "$BACKUP_FILE" + +# ============================================================================ +# 2. Build LEFT handedness initialization firmware +# ============================================================================ +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "📍 [2/3] Building LEFT hand initialization firmware..." +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +# Add INIT_EE_HANDS_LEFT to config +sed -i '/^#define EE_HANDS/a #define INIT_EE_HANDS_LEFT' "$CONFIG_FILE" + +qmk compile -kb "$KEYBOARD" -km "$KEYMAP" +if [ $? -eq 0 ]; then + cp "$QMK_FIRMWARE_DIR/${OUTPUT_NAME}.uf2" "$OUTPUT_DIR/${OUTPUT_NAME}_LEFT.uf2" + echo "✅ LEFT hand firmware: ${OUTPUT_NAME}_LEFT.uf2" +else + echo "❌ LEFT hand build failed!" + cp "$BACKUP_FILE" "$CONFIG_FILE" + rm "$BACKUP_FILE" + exit 1 +fi + +# Restore config +cp "$BACKUP_FILE" "$CONFIG_FILE" +echo "" + +# ============================================================================ +# 3. Build RIGHT handedness initialization firmware +# ============================================================================ +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "📍 [3/3] Building RIGHT hand initialization firmware..." +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +# Add INIT_EE_HANDS_RIGHT to config +sed -i '/^#define EE_HANDS/a #define INIT_EE_HANDS_RIGHT' "$CONFIG_FILE" + +qmk compile -kb "$KEYBOARD" -km "$KEYMAP" +if [ $? -eq 0 ]; then + cp "$QMK_FIRMWARE_DIR/${OUTPUT_NAME}.uf2" "$OUTPUT_DIR/${OUTPUT_NAME}_RIGHT.uf2" + echo "✅ RIGHT hand firmware: ${OUTPUT_NAME}_RIGHT.uf2" +else + echo "❌ RIGHT hand build failed!" + cp "$BACKUP_FILE" "$CONFIG_FILE" + rm "$BACKUP_FILE" + exit 1 +fi + +# Restore original config +cp "$BACKUP_FILE" "$CONFIG_FILE" +rm "$BACKUP_FILE" +rm "$QMK_FIRMWARE_DIR/${OUTPUT_NAME}.uf2" + + +echo "" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "🎉 ALL FIRMWARE FILES BUILT SUCCESSFULLY!" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "" +echo "📁 Files created:" +ls -lh "$OUTPUT_DIR/${OUTPUT_NAME}.uf2" "$OUTPUT_DIR/${OUTPUT_NAME}_LEFT.uf2" "$OUTPUT_DIR/${OUTPUT_NAME}_RIGHT.uf2" +echo "" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "📝 USAGE GUIDE:" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "" +echo "🔧 FIRST-TIME SETUP (Set handedness in EEPROM):" +echo " 1. Flash ${OUTPUT_NAME}_LEFT.uf2 to LEFT keyboard half" +echo " 2. Flash ${OUTPUT_NAME}_RIGHT.uf2 to RIGHT keyboard half" +echo " 3. Only do this ONCE to initialize handedness" +echo "" +echo "🔄 REGULAR UPDATES (After handedness is set):" +echo " 1. Flash ${OUTPUT_NAME}.uf2 to BOTH keyboard halves" +echo " 2. Handedness is preserved in EEPROM" +echo " 3. Either half can be plugged in as master" +echo "" +echo "💡 TIP: To enter bootloader, double-tap RESET on Liatris" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" diff --git a/keyboards/fingerpunch/sweeeeep/keymaps/smathev/config.h b/keyboards/fingerpunch/sweeeeep/keymaps/smathev/config.h new file mode 100644 index 00000000..47d2f9e3 --- /dev/null +++ b/keyboards/fingerpunch/sweeeeep/keymaps/smathev/config.h @@ -0,0 +1,46 @@ +/* Copyright 2022 Sadek Baroudi + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +// ============================================================================ +// KEYBOARD-SPECIFIC CONFIGURATION (fingerpunch/sweeeeep) +// These settings override userspace and keyboard defaults +// ============================================================================ + +// Split keyboard handedness detection method +// IMPORTANT: This must be set for EE_HANDS to work properly +#define EE_HANDS + +// Alternative methods (comment out EE_HANDS and use one of these if needed): +// #define MASTER_LEFT // Left half is always master (USB connection side) +// #define MASTER_RIGHT // Right half is always master (USB connection side) +// #define SPLIT_HAND_PIN // Use a specific pin to detect handedness + +// Split keyboard communication settings +// NOTE: SPLIT_USB_DETECT is NOT needed with EE_HANDS +// EE_HANDS automatically detects USB side as master + +// Split keyboard features synchronization +#define SPLIT_LAYER_STATE_ENABLE // Sync layer state between halves +#define SPLIT_MODS_ENABLE // Sync modifier keys between halves +#define SPLIT_WPM_ENABLE // Sync WPM counter between halves + +// OLED configuration (sweeeeep-specific) +#define OLED_FONT_H "keyboards/fingerpunch/sweeeeep/keymaps/smathev/glcdfont.c" + +// Backwards compatibility with existing keymaps +#define LAYOUT_sweeeeep LAYOUT_split_3x5_3 diff --git a/users/smathev/combos.c b/users/smathev/combos.c index 050ee077..7a22fade 100644 --- a/users/smathev/combos.c +++ b/users/smathev/combos.c @@ -18,7 +18,8 @@ const uint16_t PROGMEM ctcl_combo[] = {FP_SUPER_TAB, KC_PGDN, COMBO_END}; // L1_ const uint16_t PROGMEM cancel_combo[] = {KC_LEFT, KC_HOME, COMBO_END}; // l2_K1 + L2_K2 const uint16_t PROGMEM ctrop_combo[] = {FP_SUPER_TAB, KC_PGDN, KC_UP, COMBO_END}; // L1_K3 + L1_K4 + L1_K5 const uint16_t PROGMEM ffive_combo[] = {KC_U, KC_G, COMBO_END}; // L1_K3 + L1_K4 -const uint16_t PROGMEM reset_keyboard_combo[] = {KC_U, KC_G, KC_J, COMBO_END}; // L1_K3 + L1_K4 + L1_K5 +const uint16_t PROGMEM reset_keyboard_left_combo[] = {KC_J, KC_M, KC_C, COMBO_END}; // L1_K3 + L1_K4 + L1_K5 +const uint16_t PROGMEM reset_keyboard_right_combo[] = {KC_B, KC_P, KC_W, COMBO_END}; // L1_K3 + L1_K4 + L1_K5 combo_t key_combos[COMBO_COUNT] = { COMBO(undo_combo, LCTL(KC_Z)), COMBO(copy_combo, LCTL(KC_C)), @@ -36,7 +37,8 @@ combo_t key_combos[COMBO_COUNT] = { COMBO(bcksp_combo, KC_BSPC), COMBO(del_combo, KC_DEL), COMBO(esc_combo, KC_ESC), - COMBO(reset_keyboard_combo, QK_BOOT) + COMBO(reset_keyboard_left_combo, QK_BOOT), + COMBO(reset_keyboard_right_combo, QK_BOOT) }; diff --git a/users/smathev/combos.h b/users/smathev/combos.h index a27dd912..d39b1aa0 100644 --- a/users/smathev/combos.h +++ b/users/smathev/combos.h @@ -3,7 +3,7 @@ #include QMK_KEYBOARD_H // Define the number of combos -#define COMBO_COUNT 17 +#define COMBO_COUNT 18 // Combo array declaration extern combo_t key_combos[COMBO_COUNT]; diff --git a/users/smathev/config.h b/users/smathev/config.h index d0e2b1fd..9ec7e2af 100644 --- a/users/smathev/config.h +++ b/users/smathev/config.h @@ -16,22 +16,19 @@ #define ENABLE_COMPILE_KEYCODE #pragma once -// Userspace-specific configuration -// Hardware-specific settings should be in the keyboard's config.h or info.json +// ============================================================================ +// USERSPACE-WIDE CONFIGURATION +// These settings apply to ALL keyboards using the smathev userspace +// For keyboard-specific settings, use keyboards/.../keymaps/smathev/config.h +// ============================================================================ // Tapping and timing configuration #define TAPPING_TERM 140 #define PERMISSIVE_HOLD // Activate mod immediately when another key pressed #define AUTO_SHIFT_TIMEOUT 170 // Slightly longer than TAPPING_TERM -#define RETRO_SHIFT -#define RETRO_TAPPING +#define RETRO_SHIFT // Enable retroactive shift +#define RETRO_TAPPING // Enable retroactive tapping // Combo configuration #define CASEMODES_ENABLE #define COMBO_REF_DEFAULT _NORTO - -// Backwards compatibility with existing keymaps -#define LAYOUT_sweeeeep LAYOUT_split_3x5_3 - -// Custom font for OLED (if keyboard has OLED enabled) -#define OLED_FONT_H "keyboards/fingerpunch/sweeeeep/keymaps/smathev/glcdfont.c"