mode detrmines control disable

Different limits for input depending on mode.
This commit is contained in:
M0WID 2020-09-08 23:17:41 +01:00
parent ab03435f55
commit 19f102e3ec
7 changed files with 102 additions and 9 deletions

View File

@ -438,7 +438,11 @@ static uint32_t offsetIF; // IF frequency offset by half the bandwidth to pos
{
Serial.println("webSocketTimeout");
Serial.println(wsBuffer);
numberOfWebsocketClients = 0;
websocketFailCount++;
if (websocketFailCount > 2)
numberOfWebsocketClients = 0;
} else {
websocketFailCount = 0; // reset if OK
}
// Serial.print("j");
}

View File

@ -159,7 +159,8 @@
<div class="setting" >
<label class="setting-label">TrackGen:</label>
<input class="checkbox-input" type="checkbox" id="trackGen" size="1" value="0" />
<input class="value-input" type="number" id="setTrackGenPower" placeholder="setTrackGenPower" maxlength = "9" min="-60" max="20" value="0" />
<label class="setting-label">Level:</label>
<input class="value-input" type="number" id="setTrackGenPower" placeholder="setTrackGenPower" maxlength = "6" min="-60" max="20" value="0" />
dBm
</div>
</div>
@ -727,6 +728,61 @@ var indexUpdateMilliSeconds = 1 * 1000;
function handleSettings (settings)
{
setMode.value = settings.mode;
if (setMode.value == 8) { // RX Sweep (RBW test)
setStart.max = settings.IF;
setStop.max = 600;
setStart.min = 350;
setStop.min = settings.IF;
setStop.disabled = false;
setCenter.disabled = true;
setSpan.disabled = true;
setRBW.disabled = false;
setRefOut.disabled = true;
setSpur.disabled = true;
setTrackgen.disabled = true;
setTrackGenPower.disabled = true;
} else if (settings.mode == 4 ) { // IF Sweep (SAW test)
setStart.max = settings.IF;
setStop.max = 460;
setStart.min = 400;
setStop.min = settings.IF;
setStop.disabled = false;
setCenter.disabled = true;
setSpan.disabled = true;
setRBW.disabled = true;
setRefOut.disabled = true;
setSpur.disabled = true;
setTrackgen.disabled = true;
setTrackGenPower.disabled = true;
} else if (settings.mode == 7 ) { // BANDSCOPE
setStart.max = 350;
setStop.max = 350;
setStart.min = 0;
setStop.min = 0;
setStop.disabled = true;
setCenter.disabled = true;
setSpan.disabled = false;
setRBW.disabled = false;
setRefOut.disabled = true;
setSpur.disabled = true;
setTrackgen.disabled = true;
setTrackGenPower.disabled = true;
} else {
setStart.max = 350;
setStop.max = 350;
setStart.min = 0;
setStop.min = 0;
setStop.disabled = false;
setCenter.disabled = false;
setSpan.disabled = false;
setRBW.disabled = false;
setRefOut.disabled = false;
setSpur.disabled = false;
setTrackgen.disabled = false;
setTrackGenPower.disabled = false;
}
actRBW.value = settings.bandwidth;

View File

@ -25,6 +25,7 @@
#define USE_WIFI true // Changed in Version 2.6 to true/false
// #define USE_ACCESS_POINT // Comment out if want to connect to SSID, leave in to use access point
// #define AP_PASSWORD "none"
#define WIFI_SSID ":)" // SSID of your WiFi if not using access point
#define WIFI_PASSWORD "S0ftR0ckRXTX" // Password for your WiFi

View File

@ -32,7 +32,7 @@
#define PROGRAM_NAME "simpleSA" // These are for the WiFi interface
#define PROGRAM_VERSION "0.01" // Current version is 0.01 - beta!
#define PROGRAM_VERSION "0.03" // Current version - beta!
/*

View File

@ -348,6 +348,7 @@ uint8_t numberOfWebsocketClients; // How many connections
uint16_t wiFiPoints; // Push data to the wifi clinets when this many points collected
unsigned long wiFiTargetTime = WIFI_UPDATE_TARGET_TIME;
unsigned long websocketInterval = WEBSOCKET_INTERVAL;
uint16_t websocketFailCount;
#ifdef USE_WIFI
// Json document buffers

View File

@ -102,7 +102,14 @@ boolean startAP () // Start the WiFi Access Point, keep the user informed.
{
ClearDisplay (); // Fade to black
Serial.println ( "Starting Access Point" ); // Put in the instructions
delay(2000);
// Scan WiFi SSIDs
WiFi.scanNetworks(true);
/*
@ -124,9 +131,9 @@ boolean startAP () // Start the WiFi Access Point, keep the user informed.
DisplayError ( ERR_WARN, "Failed to open AP:", "WiFi Disabled", NULL, NULL );
else
ipAddress = WiFi.localIP ();
ipAddress = WiFi.softAPIP();
Serial.printf ( "Access Point started, result = %b \n", result );
Serial.printf ( "Access Point started, result = %i \n", result );
return result;
}
@ -235,11 +242,34 @@ void webSocketEvent ( uint8_t num, WStype_t type, uint8_t* payload, size_t paylo
switch ( payload[1] )
{
case 'a':
SetSweepStart ( value * 1000000.0 ); // Set sweep start frequency
switch (setting.Mode) {
case SA_LOW_RANGE:
SetSweepStart ( value * 1000000.0 ); // Set Low range sweep start frequency
break;
case IF_SWEEP:
SetIFsweepStart ( value * 1000000.0 ); // Set IF sweep start frequency
break;
case RX_SWEEP:
SetRXsweepStart ( value * 1000000.0 ); // Set RX sweep start frequency
break;
case BANDSCOPE:
SetBandscopeStart ( value * 1000000.0 ); // Set sweep start frequency
break;
}
break;
case 'b':
SetSweepStop ( value * 1000000.0 ); // Set sweep stop frequency
switch (setting.Mode) {
case SA_LOW_RANGE:
SetSweepStop ( value * 1000000.0 ); // Set Low range sweep start frequency
break;
case IF_SWEEP:
SetIFsweepStop ( value * 1000000.0 ); // Set IF sweep start frequency
break;
case RX_SWEEP:
SetRXsweepStop ( value * 1000000.0 ); // Set RX sweep start frequency
break;
}
break;
case 'c':
@ -633,7 +663,7 @@ static DynamicJsonDocument jsonDocument ( capacity ); // buffer for json data to
jsonDocument["dispPoints"] = displayPoints;
jsonDocument["start"] = startFreq_IF / 1000.0;
jsonDocument["stop"] = stopFreq_IF / 1000.0;
jsonDocument["IF"] = sigFreq_IF / 1000000.0;
jsonDocument["IF"] = setting.IF_Freq / 1000000.0;
jsonDocument["attenuation"] = setting.Attenuate;
jsonDocument["extGain"] = setting.ExternalGain;
jsonDocument["levelOffset"] = setting.LevelOffset;

3
ui.cpp
View File

@ -1168,7 +1168,8 @@ void ShowSplash ( void )
tft.setFreeFont ( &FreeSansBold9pt7b ); // Select Free Serif 9 point font
tft.drawString ( "By WA2FZW, M0WID,", 160, 60 );
tft.drawString ( "VK3PE and G3ZQC", 160, 80 );
tft.drawString ( "Version 0.01", 160, 100 );
tft.drawString ( "Version", 160, 100 );
tft.drawString ( PROGRAM_VERSION, 220, 100 );
tft.drawString ( "Original tinySA by Erik (PD0EK)", 160, 120 );
tft.setTextDatum ( TL_DATUM ); // Back to default top left