First commit
Needs web page for Sig gen mode and mechanism to load new page on certain modes
This commit is contained in:
parent
4aa452c2f2
commit
ab03435f55
@ -55,7 +55,20 @@
|
||||
|
||||
<div class = "Grid-cell-side" id="postSweepSettings" >
|
||||
<!--<form style="width: 90vw; margin-left: 80px" action="doSetSweep" method="get"> -->
|
||||
<h1>Sweep</h1>
|
||||
<div class="setting" >
|
||||
<select class="Sweep-select" id="setMode" name="setMode">
|
||||
<option class="sweep-option" value="0">Sweep Low</option>
|
||||
<!-- <option class="sweep-option" value="1">Sweep High</option> -->
|
||||
<option class="sweep-option" value="2">Sig Gen</option>
|
||||
<!-- <option class="sweep-option" value="3">Sig Gen High</option> -->
|
||||
<option class="sweep-option" value="4">SAW Test</option>
|
||||
<option class="sweep-option" value="5">Zero Span</option>
|
||||
<!-- <option class="sweep-option" value="6">Zero Span High</option> -->
|
||||
<option class="sweep-option" value="7">Bandscope</option>
|
||||
<option class="sweep-option" value="8">RBW Test</option>
|
||||
</select>
|
||||
<img src="refresh.png" id="refresh" name = "refresh" height = "18">
|
||||
</div>
|
||||
<div class="setting" >
|
||||
<label for="setStart" class="setting-label">Start:</label>
|
||||
<input class="value-input" name='setStart' type="number" id="setStart" maxlength="9" min="0" max="350" required>
|
||||
@ -114,6 +127,7 @@
|
||||
<div class="setting" >
|
||||
<label for="setAtten" class="setting-label">Atten:</label>
|
||||
<input class="value-input" name='setAtten' type="number" step="1" id ="setAtten" maxlength="3" min="0" max="31" required>
|
||||
dB
|
||||
<label for="setExtern" class="setting-label">External:</label>
|
||||
<input class="value-input" name='setExtern' type="number" step="1" id ="setExtern" maxlength="3" min="-60" max="60" required>
|
||||
<!--<select class="select-input" id="setAtten" name="setAtten"></select> -->
|
||||
@ -270,6 +284,8 @@
|
||||
<script type="text/javascript">
|
||||
var refreshInterval = document.getElementById('refreshInterval');
|
||||
|
||||
var refresh = document.getElementById('refresh');
|
||||
var setMode = document.getElementById('setMode');
|
||||
var sweepStart = document.getElementById('sweepStart');
|
||||
var sweepStop = document.getElementById('sweepStop');
|
||||
var setStart = document.getElementById('setStart');
|
||||
@ -526,9 +542,16 @@ renderChart();
|
||||
|
||||
// Add handlers for the change events in the input fields
|
||||
|
||||
refresh.addEventListener('click', (event) => {
|
||||
sendValue("r", 0);
|
||||
});
|
||||
|
||||
setMode.addEventListener('change', (event) => {
|
||||
sendValue("m", setMode.value);
|
||||
});
|
||||
|
||||
setStart.addEventListener('change', (event) => {
|
||||
sendValue("a", setStart.value);
|
||||
sendValue("a", setStart.value);
|
||||
});
|
||||
|
||||
setStop.addEventListener('change', (event) => {
|
||||
@ -703,6 +726,8 @@ var indexUpdateMilliSeconds = 1 * 1000;
|
||||
|
||||
function handleSettings (settings)
|
||||
{
|
||||
setMode.value = settings.mode;
|
||||
|
||||
actRBW.value = settings.bandwidth;
|
||||
|
||||
|
||||
@ -1095,17 +1120,19 @@ function connect(host)
|
||||
connection.send('Hello from Browser :-) ' + new Date());
|
||||
sendMessage();
|
||||
sendPingVar = setInterval(function(){ sendPing() }, 30000);
|
||||
|
||||
sendValue("r",0); // request settings
|
||||
|
||||
// Get the settings to make sure current
|
||||
$.getJSON( "getSettings")
|
||||
.done(function (settings) {
|
||||
handleSettings(settings);
|
||||
})
|
||||
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
var err = textStatus +", " + error;
|
||||
console.log("Settings Request Failed: " + err);
|
||||
});
|
||||
//$.getJSON( "getSettings")
|
||||
// .done(function (settings) {
|
||||
// handleSettings(settings);
|
||||
// })
|
||||
//
|
||||
// .fail(function(jqxhr, textStatus, error) {
|
||||
// var err = textStatus +", " + error;
|
||||
// console.log("Settings Request Failed: " + err);
|
||||
// });
|
||||
|
||||
var items = document.querySelectorAll(".value-input");
|
||||
var i;
|
||||
@ -1176,7 +1203,7 @@ function connect(host)
|
||||
}
|
||||
else if (myObject.mType == "chunkSweep")
|
||||
{
|
||||
console.log("handle chunk Sweep:" + myObject.StartIndex);
|
||||
//console.log("handle chunk Sweep:" + myObject.StartIndex);
|
||||
handleChunkData(myObject);
|
||||
}
|
||||
else
|
||||
@ -1210,9 +1237,11 @@ function sendValue(c, val)
|
||||
// s Span
|
||||
// d Local Oscillator Drive
|
||||
// g PreAmpGain/Mode
|
||||
// p set actual power to peak value
|
||||
// i IF frequency
|
||||
// m mode
|
||||
// p set actual power to peak value
|
||||
// o RefOut
|
||||
// r request Settings are pushed
|
||||
// A internal attenuation (PE4302)
|
||||
// E external gain ( eg attenuator(-ve) or preamp(+ve) )
|
||||
// R requested RBW
|
||||
|
@ -627,7 +627,7 @@ store1.addEventListener('change', (event) => {
|
||||
});
|
||||
|
||||
store2.addEventListener('change', (event) => {
|
||||
if (store1.checked) {
|
||||
if (store2.checked) {
|
||||
var b = parseInt(levelOffset.value) + parseInt(setAtten.value) - 120;
|
||||
chartSA.options.data[6].dataPoints = chartSA.options.data[1].dataPoints.map(obj => {
|
||||
let rObj = {}
|
||||
@ -641,7 +641,7 @@ store2.addEventListener('change', (event) => {
|
||||
});
|
||||
|
||||
store3.addEventListener('change', (event) => {
|
||||
if (store1.checked) {
|
||||
if (store3.checked) {
|
||||
var b = parseInt(levelOffset.value) + parseInt(setAtten.value) - 120;
|
||||
chartSA.options.data[7].dataPoints = chartSA.options.data[1].dataPoints.map(obj => {
|
||||
let rObj = {}
|
||||
@ -655,7 +655,7 @@ store3.addEventListener('change', (event) => {
|
||||
});
|
||||
|
||||
store4.addEventListener('change', (event) => {
|
||||
if (store1.checked) {
|
||||
if (store4.checked) {
|
||||
var b = parseInt(levelOffset.value) + parseInt(setAtten.value) - 120;
|
||||
chartSA.options.data[8].dataPoints = chartSA.options.data[1].dataPoints.map(obj => {
|
||||
let rObj = {}
|
||||
|
BIN
data/refresh.png
Normal file
BIN
data/refresh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 655 B |
@ -159,11 +159,27 @@ input[type="number"] {
|
||||
width: 75px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.Sweep-select {
|
||||
border: solid 1px grey;
|
||||
text-align: left;
|
||||
text-align-last: left;
|
||||
width: 150px;
|
||||
display: inline-block;
|
||||
color: black;
|
||||
font-weight: bolder;
|
||||
background-repeat: no-repeat;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.select-option {
|
||||
text-align: right;
|
||||
text-align-last: right;
|
||||
}
|
||||
.sweep-option {
|
||||
text-align: left;
|
||||
text-align-last: left;
|
||||
}
|
||||
|
||||
.set-button {
|
||||
font-size: 14px;
|
||||
|
@ -186,7 +186,7 @@
|
||||
*/
|
||||
|
||||
enum { SA_LOW_RANGE, SA_HIGH_RANGE, SIG_GEN_LOW_RANGE, SIG_GEN_HIGH_RANGE,
|
||||
IF_SWEEP, ZERO_SPAN_LOW_RANGE, ZERO_SPAN_HIGH_RANGE, TRACKING_GENERATOR, BANDSCOPE, RX_SWEEP };
|
||||
IF_SWEEP, ZERO_SPAN_LOW_RANGE, ZERO_SPAN_HIGH_RANGE, BANDSCOPE, RX_SWEEP };
|
||||
|
||||
|
||||
/*
|
||||
|
@ -380,7 +380,7 @@ int16_t minGrid;
|
||||
* Some varibales for the various operating modes
|
||||
*/
|
||||
uint16_t tinySA_mode = SA_LOW_RANGE; // Low frequency range
|
||||
const char *modeText[] = { "SALo", "SAHi", "SGLo", "SGHi", "IFSw", "0SpL", "0SpH", "TrGn", "BScp", "RXSw" }; // For mode display
|
||||
const char *modeText[] = { "SALo", "SAHi", "SGLo", "SGHi", "IFSw", "0SpL", "0SpH", "BScp", "RXSw" }; // For mode display
|
||||
|
||||
|
||||
float bandwidth; // The current bandwidth (not * 10)
|
||||
|
@ -39,6 +39,7 @@ extern int updateSidebar; // Flag to indicate no of clients has changed
|
||||
extern void ClearDisplay ();
|
||||
extern void DisplayError ( uint8_t severity, const char *l1, const char *l2, const char *l3, const char *l4 );
|
||||
|
||||
extern void setMode (uint16_t newMode);
|
||||
|
||||
/*
|
||||
* In Version 1.8, the transmitter and receiver Si4432 modules are implemented as
|
||||
@ -257,6 +258,10 @@ void webSocketEvent ( uint8_t num, WStype_t type, uint8_t* payload, size_t paylo
|
||||
SetIFFrequency ( (int32_t) ( value * 1000000.0 ));
|
||||
break;
|
||||
|
||||
case 'm': // Set mode
|
||||
setMode ( (int16_t) ( value ));
|
||||
break;
|
||||
|
||||
case 'o': // Ref Output (LO GPIO2)
|
||||
SetRefOutput ( (int) value );
|
||||
break;
|
||||
@ -265,6 +270,31 @@ void webSocketEvent ( uint8_t num, WStype_t type, uint8_t* payload, size_t paylo
|
||||
RequestSetPowerLevel( value );
|
||||
break;
|
||||
|
||||
case 'r': // request of settings by client
|
||||
switch (setting.Mode)
|
||||
{
|
||||
case (SA_LOW_RANGE):
|
||||
pushSettings();
|
||||
break;
|
||||
|
||||
case (IF_SWEEP):
|
||||
pushIFSweepSettings();
|
||||
break;
|
||||
|
||||
case (RX_SWEEP):
|
||||
pushRXSweepSettings();
|
||||
break;
|
||||
|
||||
case (BANDSCOPE):
|
||||
pushBandscopeSettings();
|
||||
break;
|
||||
|
||||
default:
|
||||
Serial.println("Invalid mode in Request setting handler - simpleSA_wifi.cpp");
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 's': // Adjust sweep span
|
||||
SetSweepSpan ( (int32_t) ( value * 1000000.0 ));
|
||||
break;
|
||||
@ -508,6 +538,7 @@ void onGetSettings (AsyncWebServerRequest *request)
|
||||
JsonObject root = response->getRoot();
|
||||
|
||||
root["mType"] = "Settings";
|
||||
root["mode"] = setting.Mode;
|
||||
root["dispPoints"] = displayPoints;
|
||||
root["start"] = setting.ScanStart / 1000.0;
|
||||
root["stop"] = setting.ScanStop / 1000.0;
|
||||
@ -546,10 +577,11 @@ if ( numberOfWebsocketClients == 0 )
|
||||
return;
|
||||
|
||||
size_t capacity = JSON_ARRAY_SIZE ( SCREEN_WIDTH )
|
||||
+ SCREEN_WIDTH*JSON_OBJECT_SIZE ( 2 ) + JSON_OBJECT_SIZE ( 16 );
|
||||
+ SCREEN_WIDTH*JSON_OBJECT_SIZE ( 2 ) + JSON_OBJECT_SIZE ( 17 );
|
||||
static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to be pushed to the web clients
|
||||
|
||||
jsonDocument["mType"] = "Settings";
|
||||
jsonDocument["mode"] = setting.Mode;
|
||||
jsonDocument["dispPoints"] = displayPoints;
|
||||
jsonDocument["start"] = setting.ScanStart / 1000.0;
|
||||
jsonDocument["stop"] = setting.ScanStop / 1000.0;
|
||||
@ -593,10 +625,11 @@ static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to
|
||||
void pushIFSweepSettings ()
|
||||
{
|
||||
size_t capacity = JSON_ARRAY_SIZE ( SCREEN_WIDTH )
|
||||
+ SCREEN_WIDTH*JSON_OBJECT_SIZE ( 2 ) + JSON_OBJECT_SIZE ( 13 );
|
||||
+ SCREEN_WIDTH*JSON_OBJECT_SIZE ( 2 ) + JSON_OBJECT_SIZE ( 17 );
|
||||
static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to be pushed to the web clients
|
||||
|
||||
jsonDocument["mType"] = "Settings";
|
||||
jsonDocument["mode"] = setting.Mode;
|
||||
jsonDocument["dispPoints"] = displayPoints;
|
||||
jsonDocument["start"] = startFreq_IF / 1000.0;
|
||||
jsonDocument["stop"] = stopFreq_IF / 1000.0;
|
||||
@ -610,6 +643,8 @@ static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to
|
||||
jsonDocument["Drive"] = setting.Drive;
|
||||
jsonDocument["sweepPoints"] = sweepPoints;
|
||||
jsonDocument["spur"] = setting.Spur;
|
||||
jsonDocument["tg"] = trackGenSetting.Mode;
|
||||
jsonDocument["tgPower"] = trackGenSetting.Power;
|
||||
|
||||
if ( AGC_On )
|
||||
jsonDocument["PreAmp"] = 0x60; // Auto
|
||||
@ -638,10 +673,11 @@ static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to
|
||||
void pushRXSweepSettings ()
|
||||
{
|
||||
size_t capacity = JSON_ARRAY_SIZE ( SCREEN_WIDTH )
|
||||
+ SCREEN_WIDTH*JSON_OBJECT_SIZE ( 2 ) + JSON_OBJECT_SIZE ( 13 );
|
||||
+ SCREEN_WIDTH*JSON_OBJECT_SIZE ( 2 ) + JSON_OBJECT_SIZE ( 17 );
|
||||
static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to be pushed to the web clients
|
||||
|
||||
jsonDocument["mType"] = "Settings";
|
||||
jsonDocument["mode"] = setting.Mode;
|
||||
jsonDocument["dispPoints"] = displayPoints;
|
||||
jsonDocument["start"] = startFreq_RX / 1000.0;
|
||||
jsonDocument["stop"] = stopFreq_RX / 1000.0;
|
||||
@ -655,6 +691,8 @@ static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to
|
||||
jsonDocument["Drive"] = setting.Drive;
|
||||
jsonDocument["sweepPoints"] = sweepPoints;
|
||||
jsonDocument["spur"] = setting.Spur;
|
||||
jsonDocument["tg"] = trackGenSetting.Mode;
|
||||
jsonDocument["tgPower"] = trackGenSetting.Power;
|
||||
|
||||
if ( AGC_On )
|
||||
jsonDocument["PreAmp"] = 0x60; // Auto
|
||||
@ -683,10 +721,11 @@ static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to
|
||||
void pushBandscopeSettings ()
|
||||
{
|
||||
size_t capacity = JSON_ARRAY_SIZE ( SCREEN_WIDTH )
|
||||
+ SCREEN_WIDTH*JSON_OBJECT_SIZE ( 2 ) + JSON_OBJECT_SIZE ( 13 );
|
||||
+ SCREEN_WIDTH*JSON_OBJECT_SIZE ( 2 ) + JSON_OBJECT_SIZE ( 17 );
|
||||
static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to be pushed to the web clients
|
||||
|
||||
jsonDocument["mType"] = "Settings";
|
||||
jsonDocument["mode"] = setting.Mode;
|
||||
jsonDocument["dispPoints"] = setting.BandscopePoints;
|
||||
jsonDocument["start"] = setting.BandscopeStart / 1000.0;
|
||||
jsonDocument["stop"] = ( setting.BandscopeStart + setting.BandscopeSpan ) / 1000.0;
|
||||
@ -700,6 +739,8 @@ static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to
|
||||
jsonDocument["Drive"] = setting.Drive;
|
||||
jsonDocument["sweepPoints"] = sweepPoints;
|
||||
jsonDocument["spur"] = setting.Spur;
|
||||
jsonDocument["tg"] = trackGenSetting.Mode;
|
||||
jsonDocument["tgPower"] = trackGenSetting.Power;
|
||||
|
||||
if ( AGC_On )
|
||||
jsonDocument["PreAmp"] = 0x60; // Auto
|
||||
|
@ -40,14 +40,17 @@
|
||||
* Function prototypes:
|
||||
*/
|
||||
|
||||
extern boolean startAP ();
|
||||
extern boolean connectWiFi ();
|
||||
extern void buildServer ();
|
||||
extern void addTagNameValue ( char *b, char *_name, char *value );
|
||||
extern char *escapeXML ( char *s );
|
||||
extern void webSocketEvent ( uint8_t num, WStype_t type, uint8_t* payload, size_t lenght );
|
||||
extern char *FormatIPAddress ( IPAddress ipAddress );
|
||||
|
||||
boolean startAP ();
|
||||
boolean connectWiFi ();
|
||||
void buildServer ();
|
||||
void addTagNameValue ( char *b, char *_name, char *value );
|
||||
char *escapeXML ( char *s );
|
||||
void webSocketEvent ( uint8_t num, WStype_t type, uint8_t* payload, size_t lenght );
|
||||
char *FormatIPAddress ( IPAddress ipAddress );
|
||||
void pushSettings ();
|
||||
void pushIFSweepSettings ();
|
||||
void pushRXSweepSettings ();
|
||||
void pushBandscopeSettings ();
|
||||
|
||||
/*
|
||||
* Functions outside of "TinySA_wifi:
|
||||
|
Loading…
Reference in New Issue
Block a user