diff --git a/SweepLo.ino b/SweepLo.ino index 722a72e..feee8b2 100644 --- a/SweepLo.ino +++ b/SweepLo.ino @@ -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"); } diff --git a/data/index.html b/data/index.html index 94f0144..876cb09 100644 --- a/data/index.html +++ b/data/index.html @@ -159,7 +159,8 @@
- + + dBm
@@ -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; diff --git a/my_SA.h b/my_SA.h index d5d28f2..51d42ff 100644 --- a/my_SA.h +++ b/my_SA.h @@ -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 diff --git a/simpleSA.h b/simpleSA.h index 93658f2..3cec149 100644 --- a/simpleSA.h +++ b/simpleSA.h @@ -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! /* diff --git a/simpleSA.ino b/simpleSA.ino index c07d69d..8ab6329 100644 --- a/simpleSA.ino +++ b/simpleSA.ino @@ -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 diff --git a/simpleSA_wifi.cpp b/simpleSA_wifi.cpp index bbc3f24..5fd0ac8 100644 --- a/simpleSA_wifi.cpp +++ b/simpleSA_wifi.cpp @@ -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; diff --git a/ui.cpp b/ui.cpp index 2f031ee..3966c79 100644 --- a/ui.cpp +++ b/ui.cpp @@ -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