From 4d608555cc4a7335beb417022bc7d203cf57cd1a Mon Sep 17 00:00:00 2001 From: grabowski Date: Fri, 24 Oct 2025 15:41:25 +0700 Subject: [PATCH] Change extra button to only work during recording phase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Extra button now only responds during actual recording - Does not work during greeting playback or when on-hook - Updated logic from checking off-hook status to checking recording status - Updated README to reflect recording-only behavior This allows guests to add sound effects to their recorded message without interrupting the initial greeting. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- README.md | 13 +++++++------ rotary_phone_web.py | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ea1bb01..610f067 100644 --- a/README.md +++ b/README.md @@ -189,13 +189,14 @@ The web interface provides four main sections: ### Extra Button Operation (Optional) If enabled in `config.json`: -1. **Guest picks up phone**: Phone goes off-hook -2. **Guest presses button**: System detects GPIO signal (only works when off-hook) -3. **Sound plays**: Configured button sound plays through speaker -4. **Can be pressed multiple times**: Works during greeting or recording -5. **Debounced**: 0.5s delay prevents accidental double-presses +1. **Guest picks up phone**: Phone goes off-hook, greeting plays +2. **Recording starts**: After greeting finishes +3. **Guest presses button**: System detects GPIO signal (only works during recording) +4. **Sound plays**: Configured button sound plays through speaker +5. **Can be pressed multiple times**: Works throughout the recording phase +6. **Debounced**: 0.5s delay prevents accidental double-presses -**Note:** Button only responds when handset is off-hook (during active call) +**Note:** Button only responds during the recording phase (not during greeting or when on-hook) ### Greeting Delay (Optional) diff --git a/rotary_phone_web.py b/rotary_phone_web.py index 0d46679..7a5f301 100644 --- a/rotary_phone_web.py +++ b/rotary_phone_web.py @@ -319,13 +319,13 @@ class RotaryPhone: } def play_extra_button_sound(self): - """Play sound when extra button is pressed (only when off-hook/in call)""" + """Play sound when extra button is pressed (only during recording)""" if not EXTRA_BUTTON_ENABLED: return - # Only play if phone is OFF hook (during a call) - if self.phone_status != "off_hook": - print("Extra button ignored - phone is on hook") + # Only play if currently recording + if not self.recording: + print("Extra button ignored - not recording") return button_sound = self.get_extra_button_sound_path()