2.6 KiB
2.6 KiB
reTerminal DM4 Buzzer Control - Jira Summary
Summary
Implemented buzzer control functionality for reTerminal DM4 device with test scripts and documentation.
Device Information
- Model: reTerminal DM4 (Raspberry Pi CM4)
- Buzzer Location: Bottom right corner of screen
- Control Path:
/sys/class/leds/usr-buzzer/brightness - Control Method: Linux LED subsystem (on/off only)
Implementation
Test Scripts Created
-
Bash Test Script (
test_buzzer.sh)- Location:
/home/pi/buzzer/test_buzzer.shon device - Tests: 8 different buzzer patterns (single, double, triple, long, rapid, slow, success, error)
- Usage:
ssh guard "/home/pi/buzzer/test_buzzer.sh"or/home/pi/buzzer/test_buzzer.sh
- Location:
-
Python Test Script (
test_buzzer.py)- Location:
/home/pi/buzzer/test_buzzer.pyon device - Same test patterns as bash script
- Usage:
ssh guard "python3 /home/pi/buzzer/test_buzzer.py"orpython3 /home/pi/buzzer/test_buzzer.py
- Location:
Basic Control Commands
# Turn ON
echo 1 | sudo tee /sys/class/leds/usr-buzzer/brightness
# Turn OFF
echo 0 | sudo tee /sys/class/leds/usr-buzzer/brightness
# Check Status
cat /sys/class/leds/usr-buzzer/brightness # 0=OFF, 1/255=ON
Python Control Example
import subprocess
import time
BUZZER = '/sys/class/leds/usr-buzzer/brightness'
def beep(duration=0.2):
subprocess.run(['sudo', 'tee', BUZZER], input='1', text=True)
time.sleep(duration)
subprocess.run(['sudo', 'tee', BUZZER], input='0', text=True)
Common Use Cases
- Success Alert: 2 short beeps
- Error Alert: 3 fast beeps
- Notification: 1 short beep
- Warning: 1 long beep
Requirements
sudoprivileges required- Test scripts available on device at
/tmp/ - Buzzer is simple on/off (no volume/frequency control)
Documentation
- Quick Reference:
BUZZER-CONTROL.md- Concise guide with commands and test script references - Detailed Guide:
BUZZER-CONTROL-SIMPLE.md- Comprehensive documentation - Flask API:
FLASK-BUZZER-CONTROL.md- Web API implementation
Testing
Both test scripts have been uploaded to the device and verified working. Scripts test:
- Single beep patterns
- Multiple beep patterns
- Different timing intervals
- Common alert patterns (success, error)
Status
✅ Complete - Test scripts created, uploaded to device, and documentation provided.
Files
test_buzzer.sh- Bash test scripttest_buzzer.py- Python test scriptBUZZER-CONTROL.md- Quick reference documentationBUZZER-CONTROL-SIMPLE.md- Detailed documentationFLASK-BUZZER-CONTROL.md- Flask API documentation