Niceities when working with the webpage.

This commit is contained in:
cnlohr
2024-10-09 02:16:14 -07:00
parent 933a3d4347
commit 147fdc514d
2 changed files with 24 additions and 14 deletions
+22 -12
View File
@@ -28,14 +28,16 @@ var lastGmhz;
var lastGfr; var lastGfr;
var lastGbrf; var lastGbrf;
var lastGexact; var lastGexact;
var lastTargetMHz;
function Goertz( n, mhz, fr, brf, exact_compute ) function Goertz( n, mhz, fr, brf, exact_compute, targetmhz )
{ {
lastGn = n; lastGn = n;
lastGmhz = mhz; lastGmhz = mhz;
lastGfr = fr; lastGfr = fr;
lastGbrf = brf; lastGbrf = brf;
lastGexact = exact_compute; lastGexact = exact_compute;
lastTargetMHz = targetmhz;
SendGoertz(); SendGoertz();
} }
@@ -91,8 +93,8 @@ function SendGoertz()
] ); ] );
// Update toggle control // Update toggle control
let target = Number(document.getElementById("targetmhz").value ); let target = lastTargetMHz;
var tz = (target * 10000000.0); var tz = (target * 10000000.0) + 0.05;
for( var i = 0|0; i < 10; i++ ) for( var i = 0|0; i < 10; i++ )
{ {
var tc = (tz / 1000000000.0) % 10; var tc = (tz / 1000000000.0) % 10;
@@ -158,7 +160,7 @@ function mhzm( event, ths )
quantaA = tquanta; quantaA = tquanta;
tgoertzelp = h; tgoertzelp = h;
Goertz( n, freq * (h+tgoertzelpoint), (tgoertzelpoint), quantaA , 1); Goertz( n, freq * (h+tgoertzelpoint), (tgoertzelpoint), quantaA , 1, target);
return false; return false;
} }
@@ -210,7 +212,7 @@ function computeTable()
if( goertzels || quadrature ) if( goertzels || quadrature )
{ {
contents += "<input type=checkbox ID=toggle_adc_buffer onchange='toggleBuffer(this)'><label for=toggle_buffer>ADC Buffer Enable</label><BR>Scroll Wheel Control:<BR>"; contents += "<BR>Scroll Wheel Control:<BR>";
contents += "<TABLE BORDER=1>"; contents += "<TABLE BORDER=1>";
contents += '<TR><TH>d\\h</div></TH>'; contents += '<TR><TH>d\\h</div></TH>';
for( let h = 0|min_harmonics; h <= max_harmonics; h++ ) for( let h = 0|min_harmonics; h <= max_harmonics; h++ )
@@ -284,7 +286,7 @@ function computeTable()
if( mode == 0 ) if( mode == 0 )
{ {
contents += "<TD COLSPAN=2>" contents += "<TD COLSPAN=2>"
if( tgoertzelp == h ) contents += "<INPUT TYPE=SUBMIT ONCLICK='Goertz(" + n + ", " + freq * (h+goertzelpoint) + ", " + (goertzelpoint) + ", " + quantaA + ", 0)' VALUE='↑" + (goertzelpoint).toFixed(6) + "'/>"; if( tgoertzelp == h ) contents += "<INPUT TYPE=SUBMIT ONCLICK='Goertz(" + n + ", " + freq * (h+goertzelpoint) + ", " + (goertzelpoint) + ", " + quantaA + ", 0, " + freq + ")' VALUE='↑" + (goertzelpoint).toFixed(6) + "'/>";
contents += "</TD>"; contents += "</TD>";
} }
else if( mode == 1 ) else if( mode == 1 )
@@ -294,7 +296,7 @@ function computeTable()
else if( mode == 2 ) else if( mode == 2 )
{ {
contents += "<TD COLSPAN=2>" contents += "<TD COLSPAN=2>"
if( tgoertzelpi == h-1 ) contents += "<INPUT TYPE=SUBMIT ONCLICK='Goertz(" + n + ", " + freq * (h-goertzelpointinv) + ", " + goertzelpointinv + ", " + quantaINV + ", 0)' VALUE='↓" + goertzelpointinv.toFixed(6) + "'/>"; if( tgoertzelpi == h-1 ) contents += "<INPUT TYPE=SUBMIT ONCLICK='Goertz(" + n + ", " + freq * (h-goertzelpointinv) + ", " + goertzelpointinv + ", " + quantaINV + ", 0, " + freq + ")' VALUE='↓" + goertzelpointinv.toFixed(6) + "'/>";
contents += "</TD>"; contents += "</TD>";
} }
else if( mode == 3 ) else if( mode == 3 )
@@ -314,7 +316,7 @@ function computeTable()
contents += "<TABLE><TR><TD><TEXTAREA ROWS=6 COLS=120 ID=goertzeloutput></TEXTAREA></TD><TD><DIV>"; contents += "<TABLE><TR><TD><TEXTAREA ROWS=6 COLS=120 ID=goertzeloutput></TEXTAREA></TD><TD><DIV>";
// Add widget to control various things, realtime. // Add widget to control various things, realtime.
contents += "<input type=checkbox ID=toggle_adc_buffer onchange='toggleBuffer(this)'><label for=toggle_buffer>ADC Buffer Enable</label><BR>Scroll Wheel Control:<BR>"; contents += "<BR>Scroll Wheel Control:<BR>";
contents += "<input id=mhzm0 onwheel='mhzm(event, this)' size=1>"; contents += "<input id=mhzm0 onwheel='mhzm(event, this)' size=1>";
contents += "<input id=mhzm1 onwheel='mhzm(event, this)' size=1>"; contents += "<input id=mhzm1 onwheel='mhzm(event, this)' size=1>";
contents += "<input id=mhzm2 onwheel='mhzm(event, this)' size=1>."; contents += "<input id=mhzm2 onwheel='mhzm(event, this)' size=1>.";
@@ -363,7 +365,7 @@ function computeTable()
if( rid == 0 ) if( rid == 0 )
{ {
contents += "<TD COLSPAN=1 ROWSPAN=2>" contents += "<TD COLSPAN=1 ROWSPAN=2>"
contents += "<INPUT TYPE=SUBMIT ONCLICK='Goertz(" + n + ", " + freq * (h+tgoertzelpoint) + ", " + (tgoertzelpoint) + ", " + quantaA + ", 1)' VALUE='↑" + n + "'/>"; contents += "<INPUT TYPE=SUBMIT ONCLICK='Goertz(" + n + ", " + freq * (h+tgoertzelpoint) + ", " + (tgoertzelpoint) + ", " + quantaA + ", 1, " + target + " )' VALUE='↑" + n + "'/>";
contents += "</TD>" contents += "</TD>"
} }
} }
@@ -391,7 +393,7 @@ function computeTable()
document.getElementById( "TABLE" ).innerHTML = contents; document.getElementById( "TABLE" ).innerHTML = contents;
} }
const savedFields = ["crystalmhz", "targetmhz", "QUADRATURE", "GOERTZELS", "GOERTZELS2", "quanta", "quantasearch"]; const savedFields = ["crystalmhz", "targetmhz", "quanta", "quantasearch", "toggle_adc_buffer"];
function SaveDefaults() function SaveDefaults()
{ {
@@ -412,9 +414,16 @@ function LoadDefaults()
{ {
let f = savedFields[i]; let f = savedFields[i];
let e = document.getElementById(f); let e = document.getElementById(f);
if( e && localStorage.getItem( f ) ) let v = localStorage.getItem( f );
console.log( `Loading: ${e} ${f} ${v}`);
if( e && v )
{ {
e.value = localStorage.getItem( f ); if( v == 'on' )
e.checked = true;
else if( v == 'off' )
e.checked = false;
else
e.value = v;
} }
} }
} }
@@ -467,6 +476,7 @@ Live Control:
</TD> </TD>
</TR> </TR>
</TABLE> </TABLE>
<input type=checkbox ID=toggle_adc_buffer onchange='toggleBuffer(this)'><label for=toggle_buffer>ADC Buffer Enable</label>
<DIV ID=TABLE></DIV> <DIV ID=TABLE></DIV>
+2 -2
View File
@@ -187,7 +187,7 @@ async function toggleAudio()
gainParam.setValueAtTime( 0, audioContext.currentTime ); gainParam.setValueAtTime( 0, audioContext.currentTime );
} }
var newVal = 0.5 - targetGain; var newVal = 1.0 - targetGain;
console.log( "Setting gain to: " + newVal ); console.log( "Setting gain to: " + newVal );
let gainParam = playingAudioProcessor.parameters.get("gain"); let gainParam = playingAudioProcessor.parameters.get("gain");
gainParam.setValueAtTime( newVal, audioContext.currentTime); gainParam.setValueAtTime( newVal, audioContext.currentTime);
@@ -441,7 +441,7 @@ async function sendLoop()
var po = FMphaseout = FMphaseout * 0.993 + diffphase; var po = FMphaseout = FMphaseout * 0.993 + diffphase;
if( po < 0.0 ) po += 1.0; if( po < 0.0 ) po += 1.0;
if( po > 1.0 ) po -= 1.0; if( po > 1.0 ) po -= 1.0;
demodbuffer[i] = po; demodbuffer[i] = po * .3; // Turn down FM it's really loud.
} }
IQHistoryHead = (IQHistoryHead+1)%IQHistoryLen; IQHistoryHead = (IQHistoryHead+1)%IQHistoryLen;