diff --git a/htdocs/index.wrx b/htdocs/index.wrx
index 6609d96..c4f828f 100644
--- a/htdocs/index.wrx
+++ b/htdocs/index.wrx
@@ -92,14 +92,14 @@
CW
diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js
index cebeb91..723194d 100644
--- a/htdocs/openwebrx.js
+++ b/htdocs/openwebrx.js
@@ -150,6 +150,13 @@ function zoomOutOneStep () { zoom_set(zoom_level-1); }
function zoomInTotal () { zoom_set(zoom_levels.length-1); }
function zoomOutTotal () { zoom_set(0); }
function setSquelchDefault() { e("openwebrx-panel-squelch").value=0; }
+function setSquelchToAuto() { e("openwebrx-panel-squelch").value=(getLogSmeterValue(smeter_level)+10).toString(); updateSquelch(); }
+function updateSquelch()
+{
+ var sliderValue=parseInt(e("openwebrx-panel-squelch").value);
+ var outputValue=(sliderValue==parseInt(e("openwebrx-panel-squelch").min))?0:getLinearSmeterValue(sliderValue);
+ ws.send("SET squelch_level="+outputValue.toString());
+}
function updateWaterfallColors(which)
{
@@ -197,6 +204,11 @@ function getLogSmeterValue(value)
return 10*Math.log10(value);
}
+function getLinearSmeterValue(db_value)
+{
+ return Math.pow(10,db_value/10);
+}
+
function setSmeterAbsoluteValue(value) //the value that comes from `csdr squelch_and_smeter_cc`
{
var logValue=getLogSmeterValue(value);
@@ -1010,6 +1022,8 @@ zoom_offset_px=0;
zoom_center_rel=0;
zoom_center_where=0;
+smeter_level=0;
+
function mkzoomlevels()
{
zoom_levels=[1];