set wrong audio level just once

This commit is contained in:
DJ2LS 2023-10-26 14:33:47 +02:00
parent efae8fe06e
commit e041772bb3

View file

@ -30,7 +30,7 @@ const split_char = "0;1;";
// global to keep track of Modem connection error emissions // global to keep track of Modem connection error emissions
var modemShowConnectStateError = 1; var modemShowConnectStateError = 1;
var setTxAudioLevelOnce = true
// network connection Timeout // network connection Timeout
setTimeout(connectModem, 2000); setTimeout(connectModem, 2000);
@ -172,13 +172,16 @@ client.on("data", function (socketdata) {
stateStore.mode = data["mode"]; stateStore.mode = data["mode"];
stateStore.bandwidth = data["bandwidth"]; stateStore.bandwidth = data["bandwidth"];
stateStore.tx_audio_level = data["audio_level"]; stateStore.tx_audio_level = data["audio_level"];
// if audio level is different from config one, send new audio level to modem // if audio level is different from config one, send new audio level to modem
//console.log(parseInt(stateStore.tx_audio_level))
//console.log(parseInt(settings.tx_audio_level))
if ( if (
parseInt(stateStore.tx_audio_level) !== parseInt(stateStore.tx_audio_level) !==
parseInt(settings.tx_audio_level) parseInt(settings.tx_audio_level) &&
setTxAudioLevelOnce === true
) { ) {
setTxAudioLevel(settings.tx_audio_level); setTxAudioLevelOnce = false
setTxAudioLevel(settings.tx_audio_level);
} }
stateStore.dbfs_level = data["audio_dbfs"]; stateStore.dbfs_level = data["audio_dbfs"];