Waterfall Working
Need to add functions to allow min and gain for wfall to be set Need to speed up!
This commit is contained in:
parent
16289698dc
commit
94d02de911
@ -1,4 +1,6 @@
|
||||
|
||||
uint32_t colourTest;
|
||||
|
||||
/*
|
||||
* Initialise variables and SI4432 for the low frequency sweep
|
||||
*/
|
||||
@ -39,12 +41,16 @@ void initBandscope()
|
||||
|
||||
/*
|
||||
* The "tSprite" is used for displaying the data above the scan grid - we don't use it in this mode
|
||||
* The "sSprite" is for displaying the sidebar stuff, no sidebar in this mode
|
||||
* The "sSprite" is for displaying the sidebar stuff, but reused here for the waterfall
|
||||
*/
|
||||
|
||||
tSprite.deleteSprite();
|
||||
|
||||
sSprite.deleteSprite();
|
||||
sSprite.setColorDepth (16); // we don't need 16bit but its faster
|
||||
sSprite.setAttribute ( PSRAM_ENABLE, false ); // Don't use the PSRAM on the WROVERs
|
||||
sSprite.createSprite ( gridWidth, waterfallHeight ); // Full width
|
||||
sSprite.setScrollRect(0, 0, gridWidth, waterfallHeight, TFT_BLACK);
|
||||
/*
|
||||
* Create and draw the sprite for the gain scale
|
||||
*/
|
||||
@ -113,7 +119,7 @@ static uint32_t peakFreq;
|
||||
static uint16_t peakIndex;
|
||||
static uint16_t pointsPastPeak;
|
||||
static uint16_t pointsPastDip;
|
||||
static uint16_t minRSSI; // Minimum level for the sweep
|
||||
static uint16_t minRSSI = 255; // Minimum level for the sweep
|
||||
static uint16_t lastMinRSSI; // Minimum level for the previous sweep
|
||||
|
||||
static bool resetAverage; // Flag to indicate a setting has changed and average valuesneeds to be reset
|
||||
@ -140,7 +146,6 @@ static uint16_t chunkIndex;
|
||||
{
|
||||
if ( initSweep || changedSetting ) // Something has changed, or a first start, so need to owrk out some basic things
|
||||
{
|
||||
// Serial.println("InitBandscope or changedSetting");
|
||||
sweepPoints = setting.BandscopePoints;
|
||||
autoSweepFreqStep = ( setting.BandscopeSpan ) / sweepPoints;
|
||||
|
||||
@ -227,9 +232,10 @@ static uint16_t chunkIndex;
|
||||
SetPowerLevel ( actualPower );
|
||||
setActualPowerRequested = false;
|
||||
|
||||
// Serial.printf ( "Setting actual Power %f \n", actualPower );
|
||||
}
|
||||
|
||||
lastMinRSSI = minRSSI;
|
||||
minRSSI = 255; // real value should always be less
|
||||
|
||||
DisplayBandscopeInfo (); // Display axis and other info
|
||||
|
||||
@ -265,14 +271,11 @@ static uint16_t chunkIndex;
|
||||
if ( ( nowMicros - setFreqMicros + delaytime > 200 ) &&
|
||||
( (nowMicros - lastWebsocketMicros > websocketInterval) || (numberOfWebsocketClients > 0) ) )
|
||||
{
|
||||
// Serial.print("W");
|
||||
webSocket.loop (); // Check websockets - includes Yield() to allow other events to run
|
||||
// Serial.println("w");
|
||||
webSocket.loop (); // Check websockets - includes Yield() to allow other tasks to run
|
||||
lastWebsocketMicros = nowMicros;
|
||||
}
|
||||
if ( nowMicros - setFreqMicros > 100 ) // Wait some time to allow DMA sprite write to finish!
|
||||
UiProcessTouch (); // Check the touch screen
|
||||
// Serial.println("w");
|
||||
nowMicros = micros();
|
||||
}
|
||||
|
||||
@ -363,6 +366,9 @@ static uint16_t chunkIndex;
|
||||
|
||||
#endif // #ifdef USE_WIFI
|
||||
|
||||
if (rxRSSI < minRSSI) // Detect minimum for sweep
|
||||
minRSSI = rxRSSI;
|
||||
|
||||
|
||||
uint16_t pixelsPerPoint = SCREEN_WIDTH / displayPoints;
|
||||
for (uint16_t i = 0; i< pixelsPerPoint; i++) {
|
||||
@ -425,6 +431,18 @@ static uint16_t chunkIndex;
|
||||
|
||||
if ( tmp > 0 ) // Only push if not first point (two pixel wide img)
|
||||
img.pushSprite ( xOrigin+tmp, yOrigin );
|
||||
|
||||
// put data into the top row of the waterfall
|
||||
// 16 bit colours have 5 bits for Red, 6 bits for Green, 5 bits for Blue
|
||||
// We will just change the green here for first test
|
||||
|
||||
uint32_t pixelColour = (rxRSSI - 17) << 5 ; // testing colours
|
||||
if (rxRSSI < 17)
|
||||
pixelColour = 0;
|
||||
if (colourTest > 0)
|
||||
pixelColour = colourTest;
|
||||
// Serial.printf("rxRSSI %i; colour %i \n", rxRSSI, pixelColour);
|
||||
sSprite.drawPixel ( tmp, 0, pixelColour );
|
||||
|
||||
}
|
||||
|
||||
@ -466,6 +484,10 @@ static uint16_t chunkIndex;
|
||||
}
|
||||
#endif // #ifdef USE_WIFI
|
||||
|
||||
// scroll the waterfall down one pixel
|
||||
sSprite.scroll( 0, 1 );
|
||||
sSprite.pushSprite( 0, gridHeight + 1 );
|
||||
|
||||
} // End of "if ( autoSweepStep >= sweepPoints )"
|
||||
|
||||
} // End of "doBandscope"
|
||||
|
21
cmd.cpp
21
cmd.cpp
@ -97,6 +97,7 @@ extern uint8_t showRSSI; // When true, RSSI readings are displayed
|
||||
extern int initSweep; // Set by the "RSSI" command to restart the sweep
|
||||
extern bool paused;
|
||||
|
||||
extern uint32_t colourTest;
|
||||
|
||||
extern Marker marker[MARKER_COUNT]; // Array of marker objects
|
||||
|
||||
@ -167,6 +168,7 @@ extern void setMode (uint16_t newMode);
|
||||
{ "TGLODRIVE", MSG_TG_LO_DRIVE }, // Set Track Generator LO Drive level
|
||||
{ "IFSIGNAL", MSG_IFSIGNAL }, // IF sweep signal frequency
|
||||
{ "TGOFFSET", MSG_TGOFFSET }, // Offset TG IF from SA IF to reduce pass through
|
||||
{ "CTEST", MSG_COLOURTEST }, // Work out how colours work!
|
||||
{ "", MSG_NONE } // Unrecognized command
|
||||
};
|
||||
|
||||
@ -1574,6 +1576,25 @@ uint8_t reg69; // Ditto
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
case MSG_COLOURTEST:
|
||||
if ( dataLen != 0 ) // Anything entered?
|
||||
{
|
||||
tempValue = atoi ( dataBuff ); // Yes, get new value
|
||||
if ( ( tempValue >= 0 ) && (tempValue <= 65535) )
|
||||
{
|
||||
colourTest = tempValue;
|
||||
return true;
|
||||
}
|
||||
else // Nothing specified
|
||||
{
|
||||
Serial.println ( "Invalid Colour" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
default:
|
||||
return false;
|
||||
} // End of "switch"
|
||||
|
2
cmd.h
2
cmd.h
@ -72,7 +72,7 @@
|
||||
#define MSG_TGOFFSET 43 // Offset TG IF frequency from SA IF
|
||||
#define MSG_BANDSCOPE 44 // Set Bandscope Mode
|
||||
#define MSG_IFSWEEP 45 // Set IF Sweep Mode
|
||||
|
||||
#define MSG_COLOURTEST 46 // test of colours - remove this when done!
|
||||
|
||||
typedef struct // Keeps everything together
|
||||
{
|
||||
|
16
simpleSA.ino
16
simpleSA.ino
@ -2,6 +2,7 @@
|
||||
* "simpleSA.ino"
|
||||
*
|
||||
* This is the main program file for the "TinySA for ESP32" (spectrum analyzer)
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2020 David Wilde (M0WID), John Price (WA2FZW)
|
||||
*
|
||||
@ -22,17 +23,21 @@
|
||||
* The starting point for this version is the "tinySA_touch05" software developed
|
||||
* by David (M0WID).
|
||||
* That software was based on the original version for STM "Blue Pill" by Erik Kaashoek PD0EK.
|
||||
* For more information on that version visit https://groups.io/g/HBTE/topics
|
||||
*
|
||||
* Glen VK3PE has designed a set of PCB - see http://www.carnut.info/tinySA/tinySA.html
|
||||
*
|
||||
* Erik has since gone on to produce a commecial version, google tinySA, and this software
|
||||
* has been renamed simpleSA to avoid confusion.
|
||||
*
|
||||
* Modified by John Price (WA2FZW):
|
||||
*
|
||||
* Version 1.0:
|
||||
*
|
||||
* Just add comments, try to figure out how it all works and move some stuff
|
||||
* around for clarity!
|
||||
*
|
||||
*
|
||||
* Version 1.1:
|
||||
*
|
||||
* Added the file "Si4432.h" which contains symbols for all the Si4432
|
||||
* registers and some other things related to it's operation.
|
||||
*
|
||||
@ -54,12 +59,10 @@
|
||||
*
|
||||
*
|
||||
* Version 1.6:
|
||||
*
|
||||
* Added the file "Si4432.cpp" and moved all of the functions to handle the
|
||||
* interface to the hardware out of here. *
|
||||
*
|
||||
* Version 1.7:
|
||||
*
|
||||
* Moved all the global variables to the top of the file and moved the "setup"
|
||||
* and "loop" functions to the top where they are customarily found.
|
||||
*
|
||||
@ -69,18 +72,15 @@
|
||||
*
|
||||
*
|
||||
* Version 1.8:
|
||||
*
|
||||
* Replaced the original code to handle the Si4432 modules with a class/object
|
||||
* implementation using real SPI protocol.
|
||||
*
|
||||
*
|
||||
* Version 2.0:
|
||||
*
|
||||
* Overhauled the serial command handler and help menu.
|
||||
*
|
||||
*
|
||||
* Version 2.1:
|
||||
*
|
||||
* A major overhaul of the entire architecture! I moved all the functions that
|
||||
* handle reading and processing commands from the serial input into "Cmd.cpp".
|
||||
* This is the first step into being able to use common command processing for
|
||||
@ -88,14 +88,12 @@
|
||||
*
|
||||
*
|
||||
* Version 2.7:
|
||||
*
|
||||
* More restructuring. Added markers . Added more
|
||||
* commands to the serial command handler. Re-organized the touch screen menus
|
||||
* in a more logical hierarchy and added some new capabilities there.
|
||||
*
|
||||
*
|
||||
* Version 2.8 Changes by M0WID:
|
||||
*
|
||||
* Data now pushed to the web clients
|
||||
* Grid y changed to have 10 divisions
|
||||
* Various bug fixes
|
||||
|
Loading…
Reference in New Issue
Block a user