fix: Web Client — Vol+/- и кнопка RMS

Исправления:
- ✅ Vol+/Vol- теперь обновляют currentVolume (работают многократно)
- ✅ Добавлена кнопка REQUEST RMS для запроса обновления audio-level

Изменения:
- currentVolume = newVol в обработчиках VOL+ и VOL-
- requestRmsBtn отправляет trigger_event для запроса RMS
This commit is contained in:
2026-05-21 14:52:54 +03:00
parent 168ec73b7c
commit f9a3731a98
+11 -3
View File
@@ -311,9 +311,7 @@
<div class="command-group"> <div class="command-group">
<button id="volUpBtn" class="neo-btn">➕ VOL+</button> <button id="volUpBtn" class="neo-btn">➕ VOL+</button>
<button id="volDownBtn" class="neo-btn">➖ VOL-</button> <button id="volDownBtn" class="neo-btn">➖ VOL-</button>
<button id="pauseMediaBtn" class="neo-btn">⏸️ PAUSE</button> <button id="requestRmsBtn" class="neo-btn">📊 REQUEST RMS</button>
<button id="resumeMediaBtn" class="neo-btn">▶️ RESUME</button>
<button id="stopMediaBtn" class="neo-btn">⏹️ STOP</button>
</div> </div>
<div class="command-group"> <div class="command-group">
<button id="singlePressBtn" class="neo-btn">🔘 SINGLE</button> <button id="singlePressBtn" class="neo-btn">🔘 SINGLE</button>
@@ -638,6 +636,7 @@
document.getElementById('volUpBtn').addEventListener('click', () => { document.getElementById('volUpBtn').addEventListener('click', () => {
const newVol = Math.min(1.0, currentVolume + 0.1); const newVol = Math.min(1.0, currentVolume + 0.1);
currentVolume = newVol; // ✅ Обновляем currentVolume
sendCommand('set_volume', { level: newVol }); sendCommand('set_volume', { level: newVol });
volumeSlider.value = newVol; volumeSlider.value = newVol;
volumeValueSpan.innerText = newVol.toFixed(2); volumeValueSpan.innerText = newVol.toFixed(2);
@@ -645,11 +644,20 @@
document.getElementById('volDownBtn').addEventListener('click', () => { document.getElementById('volDownBtn').addEventListener('click', () => {
const newVol = Math.max(0.0, currentVolume - 0.1); const newVol = Math.max(0.0, currentVolume - 0.1);
currentVolume = newVol; // ✅ Обновляем currentVolume
sendCommand('set_volume', { level: newVol }); sendCommand('set_volume', { level: newVol });
volumeSlider.value = newVol; volumeSlider.value = newVol;
volumeValueSpan.innerText = newVol.toFixed(2); volumeValueSpan.innerText = newVol.toFixed(2);
}); });
// Request RMS button
document.getElementById('requestRmsBtn').addEventListener('click', () => {
// Запросить обновление audio-level (сателит отправляет их автоматически)
// Отправляем dummy команду для триггера
sendCommand('trigger_event', { event_type: 'request_audio_level', data: {} });
addEventToLog('📊 Запрошено обновление RMS');
});
document.getElementById('pauseMediaBtn').addEventListener('click', () => sendCommand('play_sound', { path: '/home/sirmrak/projects/satellite-dev/sounds/awake.wav' })); document.getElementById('pauseMediaBtn').addEventListener('click', () => sendCommand('play_sound', { path: '/home/sirmrak/projects/satellite-dev/sounds/awake.wav' }));
document.getElementById('resumeMediaBtn').addEventListener('click', () => sendCommand('play_sound', { path: '/home/sirmrak/projects/satellite-dev/sounds/done.wav' })); document.getElementById('resumeMediaBtn').addEventListener('click', () => sendCommand('play_sound', { path: '/home/sirmrak/projects/satellite-dev/sounds/done.wav' }));
document.getElementById('stopMediaBtn').addEventListener('click', () => sendCommand('trigger_event', { event_type: 'stop', data: {} })); document.getElementById('stopMediaBtn').addEventListener('click', () => sendCommand('trigger_event', { event_type: 'stop', data: {} }));