Track Gen sig gen mode
Track gen sig gen mode added, still to do on web page
This commit is contained in:
parent
0015491a5e
commit
8928adfeed
43
SigLo.ino
43
SigLo.ino
@ -119,6 +119,7 @@ void initSigLow()
|
|||||||
void doSigGenLow ()
|
void doSigGenLow ()
|
||||||
{
|
{
|
||||||
static uint32_t oldIF; // to store the current IF
|
static uint32_t oldIF; // to store the current IF
|
||||||
|
static uint16_t oldSigGenOutputOn;
|
||||||
|
|
||||||
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
|
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
|
||||||
|
|
||||||
@ -172,21 +173,6 @@ void doSigGenLow ()
|
|||||||
|
|
||||||
case 15: // toggle the output on/off
|
case 15: // toggle the output on/off
|
||||||
sigGenOutputOn = !sigGenOutputOn;
|
sigGenOutputOn = !sigGenOutputOn;
|
||||||
if (sigGenOutputOn) {
|
|
||||||
SetRX(3); // both LO and RX in transmit. Output levels have been set in the init function
|
|
||||||
key[b].drawButton(true, sig_keys[b].activeText);
|
|
||||||
tft.setCursor(sig_keys[b].x + 30, sig_keys[b].y);
|
|
||||||
tft.fillRect(sig_keys[b].x + 30, sig_keys[b].y, sig_keys[b].x + 60, sig_keys[b].y + 10, SIG_BACKGROUND_COLOR);
|
|
||||||
tft.setTextColor(TFT_GREEN, SIG_BACKGROUND_COLOR );
|
|
||||||
tft.print(" ON");
|
|
||||||
} else {
|
|
||||||
SetRX(1); // Both in receive
|
|
||||||
key[b].drawButton(false, sig_keys[b].text);
|
|
||||||
tft.setCursor(sig_keys[b].x + 30, sig_keys[b].y);
|
|
||||||
tft.fillRect(sig_keys[b].x + 30, sig_keys[b].y, sig_keys[b].x + 60, sig_keys[b].y + 10, SIG_BACKGROUND_COLOR);
|
|
||||||
tft.setTextColor(TFT_WHITE, SIG_BACKGROUND_COLOR );
|
|
||||||
tft.print("OFF");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 16: // launch menu
|
case 16: // launch menu
|
||||||
@ -224,6 +210,32 @@ void doSigGenLow ()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if state changed - can change from command or from wifi
|
||||||
|
switch (b) {
|
||||||
|
case 15: // On/Off button
|
||||||
|
if (oldSigGenOutputOn != sigGenOutputOn)
|
||||||
|
{
|
||||||
|
if (sigGenOutputOn) {
|
||||||
|
SetRX(3); // both LO and RX in transmit. Output levels have been set in the init function
|
||||||
|
key[b].drawButton(true, sig_keys[b].activeText);
|
||||||
|
tft.setCursor(sig_keys[b].x + 30, sig_keys[b].y);
|
||||||
|
tft.fillRect(sig_keys[b].x + 30, sig_keys[b].y, sig_keys[b].x + 60, sig_keys[b].y + 10, SIG_BACKGROUND_COLOR);
|
||||||
|
tft.setTextColor(TFT_GREEN, SIG_BACKGROUND_COLOR );
|
||||||
|
tft.print(" ON");
|
||||||
|
} else {
|
||||||
|
SetRX(1); // Both in receive
|
||||||
|
key[b].drawButton(false, sig_keys[b].text);
|
||||||
|
tft.setCursor(sig_keys[b].x + 30, sig_keys[b].y);
|
||||||
|
tft.fillRect(sig_keys[b].x + 30, sig_keys[b].y, sig_keys[b].x + 60, sig_keys[b].y + 10, SIG_BACKGROUND_COLOR);
|
||||||
|
tft.setTextColor(TFT_WHITE, SIG_BACKGROUND_COLOR );
|
||||||
|
tft.print("OFF");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
} // on of state change switch
|
||||||
|
|
||||||
|
|
||||||
} // end of keys loop
|
} // end of keys loop
|
||||||
|
|
||||||
@ -272,6 +284,7 @@ void doSigGenLow ()
|
|||||||
|
|
||||||
oldFreq = sigGenSetting.Frequency;
|
oldFreq = sigGenSetting.Frequency;
|
||||||
oldIF = setting.IF_Freq;
|
oldIF = setting.IF_Freq;
|
||||||
|
oldSigGenOutputOn = sigGenOutputOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
22
SweepLo.ino
22
SweepLo.ino
@ -73,6 +73,7 @@ static bool resetAverage; // Flag to indicate a setting has changed and avera
|
|||||||
static bool jsonDocInitialised = false;
|
static bool jsonDocInitialised = false;
|
||||||
static uint16_t chunkIndex;
|
static uint16_t chunkIndex;
|
||||||
static uint32_t offsetIF; // IF frequency offset by half the bandwidth to position in the centre of the filter
|
static uint32_t offsetIF; // IF frequency offset by half the bandwidth to position in the centre of the filter
|
||||||
|
static uint32_t tgIF; // Track gen IF - SA IF plus any offset if both SI4432 defined
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -181,6 +182,15 @@ static uint32_t offsetIF; // IF frequency offset by half the bandwidth to pos
|
|||||||
tg_lo.RxMode();
|
tg_lo.RxMode();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(SI_TG_IF_CS) && defined(SI_TG_LO_CS)
|
||||||
|
if (tgLO_OK && tgIF_OK && (trackGenSetting.Mode == 2) ) // tracking gen as signal generator
|
||||||
|
{
|
||||||
|
tg_if.SetFrequency ( setting.IF_Freq + trackGenSetting.Offset );
|
||||||
|
tg_lo.SetFrequency ( setting.IF_Freq + trackGenSetting.Offset + trackGenSetting.Frequency );
|
||||||
|
tg_lo.TxMode ( trackGenSetting.LO_Drive ); // Set tracking generator LO on
|
||||||
|
tg_if.TxMode ( trackGenSetting.IF_Drive ); // Set tracking generator IF on
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // initSweep || changedSetting
|
} // initSweep || changedSetting
|
||||||
|
|
||||||
@ -208,6 +218,12 @@ static uint32_t offsetIF; // IF frequency offset by half the bandwidth to pos
|
|||||||
tempIF = offsetIF;
|
tempIF = offsetIF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// track gen IF follows LO if only one SI4432, otherwise its offset by an amount to reduce blow by
|
||||||
|
if (tgLO_OK)
|
||||||
|
tgIF = tempIF + trackGenSetting.Offset;
|
||||||
|
else
|
||||||
|
tgIF = tempIF;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
spurToggle = !spurToggle;
|
spurToggle = !spurToggle;
|
||||||
@ -226,7 +242,7 @@ static uint32_t offsetIF; // IF frequency offset by half the bandwidth to pos
|
|||||||
|
|
||||||
#ifdef SI_TG_IF_CS
|
#ifdef SI_TG_IF_CS
|
||||||
if (tgIF_OK && (trackGenSetting.Mode == 1) )
|
if (tgIF_OK && (trackGenSetting.Mode == 1) )
|
||||||
tg_if.SetFrequency ( tempIF + trackGenSetting.Offset ); // Set tracking generator IF for the sweep
|
tg_if.SetFrequency ( tgIF ); // Set tracking generator IF for the sweep
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,13 +250,11 @@ static uint32_t offsetIF; // IF frequency offset by half the bandwidth to pos
|
|||||||
|
|
||||||
#ifdef SI_TG_LO_CS
|
#ifdef SI_TG_LO_CS
|
||||||
if (tgLO_OK && (trackGenSetting.Mode == 1) )
|
if (tgLO_OK && (trackGenSetting.Mode == 1) )
|
||||||
tg_lo.SetFrequency ( tempIF + autoSweepFreq + trackGenSetting.Offset ); // Set tracking generator LO
|
tg_lo.SetFrequency ( tgIF + autoSweepFreq ); // Set tracking generator LO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setFreqMicros = micros(); // Store the time the frequency was changed
|
setFreqMicros = micros(); // Store the time the frequency was changed
|
||||||
|
|
||||||
// if (trackGenSetting.Mode == 1) // debug
|
|
||||||
// Serial.printf("tglo start %i at %i\n", tg_lo.GetFrequency(), setFreqMicros);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actual frequency in the SI4432 is rounded and is limited by the possible resolution
|
* Actual frequency in the SI4432 is rounded and is limited by the possible resolution
|
||||||
|
122
cmd.cpp
122
cmd.cpp
@ -106,6 +106,7 @@ extern uint32_t colourTest;
|
|||||||
|
|
||||||
extern Marker marker[MARKER_COUNT]; // Array of marker objects
|
extern Marker marker[MARKER_COUNT]; // Array of marker objects
|
||||||
|
|
||||||
|
extern uint16_t sigGenOutputOn; // signal generator state - 0 = off, 1 = on
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions still in the main program file. Maybe some need to move here?
|
* Functions still in the main program file. Maybe some need to move here?
|
||||||
@ -183,6 +184,12 @@ extern uint8_t dBmToRSSI ( double dBm );
|
|||||||
{ "RXSWEEP", MSG_RX_SWEEP }, // Set RX Sweep Mode
|
{ "RXSWEEP", MSG_RX_SWEEP }, // Set RX Sweep Mode
|
||||||
{ "RXSIGNAL", MSG_RXSIGNAL }, // IF sweep signal frequency
|
{ "RXSIGNAL", MSG_RXSIGNAL }, // IF sweep signal frequency
|
||||||
{ "EXTGAIN", MSG_EXTGAIN }, // External gain or attenuation
|
{ "EXTGAIN", MSG_EXTGAIN }, // External gain or attenuation
|
||||||
|
{ "SGON", MSG_SGON }, // turn on signal generator output
|
||||||
|
{ "SGOFF", MSG_SGOFF }, // turn off signal generator output
|
||||||
|
{ "TRACKON", MSG_TGON }, // turn on tracking generator output
|
||||||
|
{ "TRACKOFF", MSG_TGOFF }, // turn off tracking generator output
|
||||||
|
{ "TRACKSIG", MSG_TGSIG }, // turn off tracking generator output
|
||||||
|
{ "TGFREQ", MSG_TGFREQ }, // Set Track gen freq for sig gen mode
|
||||||
{ "", MSG_NONE } // Unrecognized command
|
{ "", MSG_NONE } // Unrecognized command
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -248,10 +255,15 @@ void ShowMenu ()
|
|||||||
Serial.printf ( " WFMIN.........Set the minimum RSSI level for waterfall colouring: %i\n", setting.WaterfallMin );
|
Serial.printf ( " WFMIN.........Set the minimum RSSI level for waterfall colouring: %i\n", setting.WaterfallMin );
|
||||||
Serial.printf ( " WFGAIN........Set the gain for waterfall colouring: %d\n", setting.WaterfallGain );
|
Serial.printf ( " WFGAIN........Set the gain for waterfall colouring: %d\n", setting.WaterfallGain );
|
||||||
|
|
||||||
Serial.println ( "\nOther Commands:\n" );
|
|
||||||
|
|
||||||
Serial.print ( " DRIVE.........Local oscillator drive level [0 to 7]; currently: " );
|
Serial.println ( "\nSignal Generator Commands:\n" );
|
||||||
Serial.println ( setting.Drive );
|
|
||||||
|
Serial.println ( " SGON..........Turn on signal generator output" );
|
||||||
|
Serial.print ( " SGOFF.........Turn off signal generator output; currently " );
|
||||||
|
Serial.println ( sigGenOutputOn );
|
||||||
|
|
||||||
|
Serial.print ( " SGFREQ........Signal Generator frequency, currently: " );
|
||||||
|
Serial.println ( FormatFrequency ( sigGenSetting.Frequency ));
|
||||||
|
|
||||||
Serial.print ( " SGLODRIVE.....Local oscillator drive level in signal generator mode [0 to 7]; currently: " );
|
Serial.print ( " SGLODRIVE.....Local oscillator drive level in signal generator mode [0 to 7]; currently: " );
|
||||||
Serial.println ( sigGenSetting.LO_Drive );
|
Serial.println ( sigGenSetting.LO_Drive );
|
||||||
@ -259,14 +271,35 @@ void ShowMenu ()
|
|||||||
Serial.print ( " SGRXDRIVE.....Local oscillator drive level in signal generator mode [0 to 7]; currently: " );
|
Serial.print ( " SGRXDRIVE.....Local oscillator drive level in signal generator mode [0 to 7]; currently: " );
|
||||||
Serial.println ( sigGenSetting.RX_Drive );
|
Serial.println ( sigGenSetting.RX_Drive );
|
||||||
|
|
||||||
|
#ifdef SI_TG_IF_CS
|
||||||
|
Serial.println ( "\nTracking Generator Commands:\n" );
|
||||||
|
|
||||||
|
Serial.println ( " TRACKON.......Turn on tracking generator output" );
|
||||||
|
#ifdef SI_TG_LO_CS
|
||||||
|
Serial.println ( " TRACKSIG......Turn on tracking generator signal generator output" );
|
||||||
|
#endif
|
||||||
|
Serial.print ( " TRACKOFF......Turn off tracking generator output; currently " );
|
||||||
|
Serial.println ( trackGenSetting.Mode );
|
||||||
|
|
||||||
|
#ifdef SI_TG_LO_CS
|
||||||
Serial.print ( " TGLODRIVE.....Local oscillator drive level in tracking generator mode [0 to 7]; currently: " );
|
Serial.print ( " TGLODRIVE.....Local oscillator drive level in tracking generator mode [0 to 7]; currently: " );
|
||||||
Serial.println ( trackGenSetting.LO_Drive );
|
Serial.println ( trackGenSetting.LO_Drive );
|
||||||
|
#endif
|
||||||
Serial.print ( " TGIFDRIVE.....Local oscillator drive level in tracking generator mode [0 to 7]; currently: " );
|
Serial.print ( " TGIFDRIVE.....Local oscillator drive level in tracking generator mode [0 to 7]; currently: " );
|
||||||
Serial.println ( trackGenSetting.IF_Drive );
|
Serial.println ( trackGenSetting.IF_Drive );
|
||||||
|
#ifdef SI_TG_LO_CS
|
||||||
Serial.print ( " TGOFFSET......Tracking generator offset from SA IF; currently: " );
|
Serial.print ( " TGOFFSET......Tracking generator offset from SA IF; currently: " );
|
||||||
Serial.println ( trackGenSetting.Offset );
|
Serial.println ( trackGenSetting.Offset );
|
||||||
|
Serial.print ( " TGFREQ........Tracking generator signal generator frequency; currently: " );
|
||||||
|
Serial.println ( trackGenSetting.Frequency );
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Serial.println ( "\nOther Commands:\n" );
|
||||||
|
|
||||||
|
Serial.print ( " DRIVE.........Local oscillator drive level [0 to 7]; currently: " );
|
||||||
|
Serial.println ( setting.Drive );
|
||||||
|
|
||||||
Serial.println ( " SAVE .........Save the current scan configuration [0 to 4]" );
|
Serial.println ( " SAVE .........Save the current scan configuration [0 to 4]" );
|
||||||
|
|
||||||
@ -759,6 +792,17 @@ uint8_t reg69; // Ditto
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Signal Generator On/Off commands
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
case MSG_SGON:
|
||||||
|
SetSGState(1);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case MSG_SGOFF:
|
||||||
|
SetSGState(0);
|
||||||
|
return true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The "SGLODRIVE" command sets the local oscillator "drive" level in signal generator mode.
|
* The "SGLODRIVE" command sets the local oscillator "drive" level in signal generator mode.
|
||||||
@ -800,8 +844,26 @@ uint8_t reg69; // Ditto
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tracking Generator On/Off commands
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
case MSG_TGON:
|
||||||
|
SetTracking(1);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case MSG_TGOFF:
|
||||||
|
SetTracking(0);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
#ifdef SI_TG_LO_CS
|
#ifdef SI_TG_LO_CS
|
||||||
|
|
||||||
|
case MSG_TGSIG:
|
||||||
|
SetTracking(2);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The "TGLODRIVE" command sets the local oscillator "drive" level in tracking generator mode.
|
* The "TGLODRIVE" command sets the local oscillator "drive" level in tracking generator mode.
|
||||||
* (only valid if two SI4432 used for the tracking generator)
|
* (only valid if two SI4432 used for the tracking generator)
|
||||||
@ -1578,6 +1640,14 @@ uint8_t reg69; // Ditto
|
|||||||
Serial.printf ( "Tracking Generator IF offset: %i\n", trackGenSetting.Offset ); // sort out signed version of format frequency!!!!!!!!!!!!!!!!!!!
|
Serial.printf ( "Tracking Generator IF offset: %i\n", trackGenSetting.Offset ); // sort out signed version of format frequency!!!!!!!!!!!!!!!!!!!
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case MSG_TGFREQ:
|
||||||
|
if ( dataLen != 0 ) // Frequency specified?
|
||||||
|
{
|
||||||
|
freq1 = ParseFrequency ( dataBuff ); // Yes, get new frequency
|
||||||
|
SetTGFreq (freq1);
|
||||||
|
}
|
||||||
|
Serial.printf ( "Tracking Signal Generator frequency: %i\n", FormatFrequency ( trackGenSetting.Frequency ));
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2433,6 +2503,26 @@ int oldLevel = setting.Drive;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Set SGFreq sets the signal generator Frequency
|
||||||
|
* Signal generator frequency may change frequently, so don't save the setting
|
||||||
|
* Settings are saved when leaving the mode
|
||||||
|
* parameter is in Hz
|
||||||
|
*/
|
||||||
|
void SetSGFreq (uint32_t f)
|
||||||
|
{
|
||||||
|
if ( ( f >= MIN_SIGLO_FREQ ) && ( f <= MAX_SIGLO_FREQ ) )
|
||||||
|
sigGenSetting.Frequency = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sig gen state is not saved - always want to start in off state
|
||||||
|
*/
|
||||||
|
|
||||||
|
void SetSGState (uint16_t s)
|
||||||
|
{
|
||||||
|
sigGenOutputOn = s;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "SetSGLoDrive" sets the transmitter max output level in signal generator mode.
|
* "SetSGLoDrive" sets the transmitter max output level in signal generator mode.
|
||||||
*
|
*
|
||||||
@ -2618,6 +2708,28 @@ int32_t GetTGOffset ( )
|
|||||||
return trackGenSetting.Offset;
|
return trackGenSetting.Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the IF frequency - M0WID addition
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool SetTGFreq ( int32_t freq )
|
||||||
|
{
|
||||||
|
int32_t oldFreq = trackGenSetting.Frequency;
|
||||||
|
|
||||||
|
if (( freq < MIN_SIGLO_FREQ ) || ( freq > MAX_SIGLO_FREQ )) // If out of limits
|
||||||
|
return false; // Don't change it
|
||||||
|
|
||||||
|
trackGenSetting.Frequency = freq;
|
||||||
|
|
||||||
|
if ( oldFreq != trackGenSetting.Frequency )
|
||||||
|
{
|
||||||
|
changedSetting = true;
|
||||||
|
WriteTrackGenSettings ();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // Frequency was good
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "SetSweepStart" and "GetSweepStart" were added in Version 2.3. They used to be in
|
* "SetSweepStart" and "GetSweepStart" were added in Version 2.3. They used to be in
|
||||||
|
9
cmd.h
9
cmd.h
@ -78,6 +78,13 @@
|
|||||||
#define MSG_RX_SWEEP 49 // Set the RX Sweep Mode
|
#define MSG_RX_SWEEP 49 // Set the RX Sweep Mode
|
||||||
#define MSG_RXSIGNAL 50 // Set frequency of injected signal for IF Sweep
|
#define MSG_RXSIGNAL 50 // Set frequency of injected signal for IF Sweep
|
||||||
#define MSG_EXTGAIN 51 // Set external gain or attenuation
|
#define MSG_EXTGAIN 51 // Set external gain or attenuation
|
||||||
|
#define MSG_SGON 52 // Turn Signal Generator output on
|
||||||
|
#define MSG_SGOFF 53 // Turn Signal Generator output off
|
||||||
|
#define MSG_SG_FREQ 54 // Set Signal Generator Frequency
|
||||||
|
#define MSG_TGON 55 // Turn Tracking Generator output on
|
||||||
|
#define MSG_TGOFF 56 // Turn Tracking Generator output off
|
||||||
|
#define MSG_TGFREQ 57 // Set Track Gen frequency for sig gen mode
|
||||||
|
#define MSG_TGSIG 58 // Set Track Gen sig gen mode
|
||||||
|
|
||||||
#define MSG_COLOURTEST 99 // test of waterfall colours - remove this when done!
|
#define MSG_COLOURTEST 99 // test of waterfall colours - remove this when done!
|
||||||
|
|
||||||
@ -139,6 +146,7 @@ void SetGenerate ( int8_t g ); // Puts the unit into or out of signal generat
|
|||||||
bool SetIFFrequency ( int32_t f ); // Sets the IF frequency
|
bool SetIFFrequency ( int32_t f ); // Sets the IF frequency
|
||||||
|
|
||||||
void SetLoDrive ( uint8_t level ); // Sets LO Si4432 output level
|
void SetLoDrive ( uint8_t level ); // Sets LO Si4432 output level
|
||||||
|
void SetSGState (uint16_t s);
|
||||||
void SetSGLoDrive ( uint8_t level );
|
void SetSGLoDrive ( uint8_t level );
|
||||||
void SetSGRxDrive ( uint8_t level );
|
void SetSGRxDrive ( uint8_t level );
|
||||||
|
|
||||||
@ -146,6 +154,7 @@ void SetTracking ( int8_t m ); // set tracking generator mode
|
|||||||
void SetTGLoDrive ( uint8_t level ); // set tracking generator drive
|
void SetTGLoDrive ( uint8_t level ); // set tracking generator drive
|
||||||
void SetTGIfDrive ( uint8_t level );
|
void SetTGIfDrive ( uint8_t level );
|
||||||
bool SetTGOffset ( int32_t offset); // set tracking generator offset - returns false if invalid
|
bool SetTGOffset ( int32_t offset); // set tracking generator offset - returns false if invalid
|
||||||
|
bool SetTGFreq ( int32_t freq); // set tracking generator freq for sig gen mode - returns false if invalid
|
||||||
int32_t GetTGOffset (void );
|
int32_t GetTGOffset (void );
|
||||||
void SetTGPower ( int16_t dBm ); // Set TG attenuator and drive levels
|
void SetTGPower ( int16_t dBm ); // Set TG attenuator and drive levels
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ function handleSettings (settings)
|
|||||||
setRBW.disabled = false;
|
setRBW.disabled = false;
|
||||||
setRefOut.disabled = true;
|
setRefOut.disabled = true;
|
||||||
setSpur.disabled = true;
|
setSpur.disabled = true;
|
||||||
setTrackgen.disabled = true;
|
setTrackGen.disabled = true;
|
||||||
setTrackGenPower.disabled = true;
|
setTrackGenPower.disabled = true;
|
||||||
} else if (settings.mode == 4 ) { // IF Sweep (SAW test)
|
} else if (settings.mode == 4 ) { // IF Sweep (SAW test)
|
||||||
setStart.max = settings.IF;
|
setStart.max = settings.IF;
|
||||||
@ -752,7 +752,7 @@ function handleSettings (settings)
|
|||||||
setRBW.disabled = true;
|
setRBW.disabled = true;
|
||||||
setRefOut.disabled = true;
|
setRefOut.disabled = true;
|
||||||
setSpur.disabled = true;
|
setSpur.disabled = true;
|
||||||
setTrackgen.disabled = true;
|
setTrackGen.disabled = true;
|
||||||
setTrackGenPower.disabled = true;
|
setTrackGenPower.disabled = true;
|
||||||
} else if (settings.mode == 7 ) { // BANDSCOPE
|
} else if (settings.mode == 7 ) { // BANDSCOPE
|
||||||
setStart.max = 350;
|
setStart.max = 350;
|
||||||
@ -765,7 +765,7 @@ function handleSettings (settings)
|
|||||||
setRBW.disabled = false;
|
setRBW.disabled = false;
|
||||||
setRefOut.disabled = true;
|
setRefOut.disabled = true;
|
||||||
setSpur.disabled = true;
|
setSpur.disabled = true;
|
||||||
setTrackgen.disabled = true;
|
setTrackGen.disabled = true;
|
||||||
setTrackGenPower.disabled = true;
|
setTrackGenPower.disabled = true;
|
||||||
} else {
|
} else {
|
||||||
setStart.max = 350;
|
setStart.max = 350;
|
||||||
@ -778,7 +778,7 @@ function handleSettings (settings)
|
|||||||
setRBW.disabled = false;
|
setRBW.disabled = false;
|
||||||
setRefOut.disabled = false;
|
setRefOut.disabled = false;
|
||||||
setSpur.disabled = false;
|
setSpur.disabled = false;
|
||||||
setTrackgen.disabled = false;
|
setTrackGen.disabled = false;
|
||||||
setTrackGenPower.disabled = false;
|
setTrackGenPower.disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1339
data/siggen.html
Normal file
1339
data/siggen.html
Normal file
File diff suppressed because it is too large
Load Diff
@ -504,7 +504,7 @@ uint16_t spacing = 10000;
|
|||||||
|
|
||||||
bool paused = false;
|
bool paused = false;
|
||||||
|
|
||||||
bool sigGenOutputOn = false;
|
uint16_t sigGenOutputOn = false;
|
||||||
uint32_t oldFreq; // to store the current Signal Generator frequency
|
uint32_t oldFreq; // to store the current Signal Generator frequency
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -672,6 +672,7 @@ bool fsStatus = false; // True if SPIFFS loads ok
|
|||||||
|
|
||||||
// If the tracking generator IF SI4432 is defined, then check to see if it is connected
|
// If the tracking generator IF SI4432 is defined, then check to see if it is connected
|
||||||
tgIF_OK = false;
|
tgIF_OK = false;
|
||||||
|
|
||||||
#ifdef SI_TG_IF_CS
|
#ifdef SI_TG_IF_CS
|
||||||
// pinMode (SI_TG_IF_CS, INPUT); //Start off in input mode, no pullup
|
// pinMode (SI_TG_IF_CS, INPUT); //Start off in input mode, no pullup
|
||||||
// delay(2);
|
// delay(2);
|
||||||
@ -709,6 +710,7 @@ bool fsStatus = false; // True if SPIFFS loads ok
|
|||||||
|
|
||||||
// If the tracking generator LO SI4432 is defined, then check to see if it is connected
|
// If the tracking generator LO SI4432 is defined, then check to see if it is connected
|
||||||
tgLO_OK = false;
|
tgLO_OK = false;
|
||||||
|
|
||||||
#ifdef SI_TG_LO_CS
|
#ifdef SI_TG_LO_CS
|
||||||
// pinMode (SI_TG_LO_CS, INPUT); //Start off in input mode, no pullup
|
// pinMode (SI_TG_LO_CS, INPUT); //Start off in input mode, no pullup
|
||||||
// delay(2);
|
// delay(2);
|
||||||
@ -730,7 +732,9 @@ bool fsStatus = false; // True if SPIFFS loads ok
|
|||||||
// pinMode (SI_TG_LO_CS, OUTPUT);
|
// pinMode (SI_TG_LO_CS, OUTPUT);
|
||||||
// digitalWrite(SI_TG_LO_CS, HIGH); // make sure it doesn't get selected
|
// digitalWrite(SI_TG_LO_CS, HIGH); // make sure it doesn't get selected
|
||||||
// }
|
// }
|
||||||
|
#else
|
||||||
|
pinMode (25, OUTPUT);
|
||||||
|
digitalWrite(25, HIGH); // make sure it doesn't get selected
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,10 +220,31 @@ void webSocketEvent ( uint8_t num, WStype_t type, uint8_t* payload, size_t paylo
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Format of message to process
|
|
||||||
*
|
*
|
||||||
* #a 123.123 Start frequency
|
* Message format
|
||||||
* #b 123.123 Stop frequency
|
* #(code) value where code is a single char. Case is important
|
||||||
|
*
|
||||||
|
* a start freq (MHz) - sig gen freq if in sig gen mode
|
||||||
|
* b stop frequency
|
||||||
|
* c centre frequency
|
||||||
|
* s Span
|
||||||
|
* d Local Oscillator Drive
|
||||||
|
* g PreAmpGain/Mode
|
||||||
|
* 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
|
||||||
|
* S Spur reduction Off/On
|
||||||
|
* t trackGen Off/On/Fixed
|
||||||
|
* T trackGen output level
|
||||||
|
* F Sig Gen frequency
|
||||||
|
* L Sig Gen level (dBm)
|
||||||
|
* G Sig Gen Off/On
|
||||||
|
* P Sig Gen set max output level (dBm)
|
||||||
*
|
*
|
||||||
* Other formats are ignored
|
* Other formats are ignored
|
||||||
*/
|
*/
|
||||||
@ -248,6 +269,9 @@ void webSocketEvent ( uint8_t num, WStype_t type, uint8_t* payload, size_t paylo
|
|||||||
case SA_LOW_RANGE:
|
case SA_LOW_RANGE:
|
||||||
SetSweepStart ( value * 1000000.0 ); // Set Low range sweep start frequency
|
SetSweepStart ( value * 1000000.0 ); // Set Low range sweep start frequency
|
||||||
break;
|
break;
|
||||||
|
case SIG_GEN_LOW_RANGE:
|
||||||
|
SetSweepStart ( value * 1000000.0 ); // Set Low range sweep start frequency
|
||||||
|
break;
|
||||||
case IF_SWEEP:
|
case IF_SWEEP:
|
||||||
SetIFsweepStart ( value * 1000000.0 ); // Set IF sweep start frequency
|
SetIFsweepStart ( value * 1000000.0 ); // Set IF sweep start frequency
|
||||||
break;
|
break;
|
||||||
|
58
ui.cpp
58
ui.cpp
@ -197,7 +197,7 @@ uint8_t operation_requested = OP_NONE; // No operations so far
|
|||||||
enum { KM_START, KM_STOP, KM_CENTER, KM_SPAN, KM_FOCUS,
|
enum { KM_START, KM_STOP, KM_CENTER, KM_SPAN, KM_FOCUS,
|
||||||
KM_REFPOS, KM_ATTENUATION, KM_ACTUALPOWER, KM_IFFREQ, KM_PREAMP,
|
KM_REFPOS, KM_ATTENUATION, KM_ACTUALPOWER, KM_IFFREQ, KM_PREAMP,
|
||||||
KM_TUNE, KM_SGFREQ, KM_SGLEVEL, KM_SGLEVCAL, KM_IFSTART, KM_IFSTOP,
|
KM_TUNE, KM_SGFREQ, KM_SGLEVEL, KM_SGLEVCAL, KM_IFSTART, KM_IFSTOP,
|
||||||
KM_IFSIG, KM_TGOFFSET, KM_TGLO_DRIVE, KM_TGIF_DRIVE, KM_BANDSCOPESTART,
|
KM_IFSIG, KM_TGOFFSET, KM_TGFREQ, KM_TGLO_DRIVE, KM_TGIF_DRIVE, KM_BANDSCOPESTART,
|
||||||
KM_WFMIN, KM_WFGAIN, KM_BANDSCOPELEVEL, KM_RXSPAN, KM_RXSIG, KM_RBW,
|
KM_WFMIN, KM_WFGAIN, KM_BANDSCOPELEVEL, KM_RXSPAN, KM_RXSIG, KM_RBW,
|
||||||
KM_EXTERN };
|
KM_EXTERN };
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ static const char * const keypad_mode_label[] =
|
|||||||
"START", "STOP", "CENTER", "SPAN", "FOCUS",
|
"START", "STOP", "CENTER", "SPAN", "FOCUS",
|
||||||
"REFPOS", "ATTEN", "POWER", "IF FREQ", "PREAMP",
|
"REFPOS", "ATTEN", "POWER", "IF FREQ", "PREAMP",
|
||||||
"XTAL CAL", "SG FREQ", "dBm", "Max dBm", "IF START", "IF STOP",
|
"XTAL CAL", "SG FREQ", "dBm", "Max dBm", "IF START", "IF STOP",
|
||||||
"IF Sig Freq", "TG OFFSET", "TG LO Drive", "TG IF Drive", "START",
|
"IF Sig Freq", "TG OFFSET", "TG FREQ", "TG LO Drive", "TG IF Drive", "START",
|
||||||
"WF MIN", "WF GAIN", "REF LEVEL", "RX SPAN", "RX Sig Freq", "RBW",
|
"WF MIN", "WF GAIN", "REF LEVEL", "RX SPAN", "RX Sig Freq", "RBW",
|
||||||
"EXTERNAL"
|
"EXTERNAL"
|
||||||
};
|
};
|
||||||
@ -291,6 +291,7 @@ static void menu_WaterfallGain_cb ( int item );
|
|||||||
|
|
||||||
static void menu_tracking_cb(int item); // M0WID - added in 3.0e
|
static void menu_tracking_cb(int item); // M0WID - added in 3.0e
|
||||||
static void menu_tg_offset_cb(int item); // M0WID - added in 3.0e
|
static void menu_tg_offset_cb(int item); // M0WID - added in 3.0e
|
||||||
|
static void menu_tg_frequency_cb(int item); // M0WID - added in 3.0e
|
||||||
static void menu_tgIF_drive_cb(int item); // M0WID - added in 3.0e
|
static void menu_tgIF_drive_cb(int item); // M0WID - added in 3.0e
|
||||||
static void menu_tgLO_drive_cb(int item); // M0WID - added in 3.0e
|
static void menu_tgLO_drive_cb(int item); // M0WID - added in 3.0e
|
||||||
|
|
||||||
@ -489,11 +490,13 @@ static Menuitem menu_tracking[] = // Tracking generator mode
|
|||||||
{
|
{
|
||||||
Menuitem ( MT_FUNC, "OFF", menu_tracking_cb ),
|
Menuitem ( MT_FUNC, "OFF", menu_tracking_cb ),
|
||||||
Menuitem ( MT_FUNC, "ON", menu_tracking_cb ),
|
Menuitem ( MT_FUNC, "ON", menu_tracking_cb ),
|
||||||
Menuitem ( MT_FUNC, "OFFSET", menu_tg_offset_cb ),
|
|
||||||
Menuitem ( MT_FUNC, "\2IF\0DRIVE", menu_tgIF_drive_cb ),
|
|
||||||
#ifdef SI_TG_LO_CS
|
#ifdef SI_TG_LO_CS
|
||||||
|
Menuitem ( MT_FUNC, "GENERATE", menu_tracking_cb ),
|
||||||
|
Menuitem ( MT_FUNC, "FREQUENCY",menu_tg_frequency_cb ),
|
||||||
|
Menuitem ( MT_FUNC, "OFFSET", menu_tg_offset_cb ),
|
||||||
Menuitem ( MT_FUNC, "\2LO\0DRIVE", menu_tgLO_drive_cb ),
|
Menuitem ( MT_FUNC, "\2LO\0DRIVE", menu_tgLO_drive_cb ),
|
||||||
#endif
|
#endif
|
||||||
|
Menuitem ( MT_FUNC, "\2IF\0DRIVE", menu_tgIF_drive_cb ),
|
||||||
Menuitem ( MT_BACK, "<-BACK" ), // Next level up
|
Menuitem ( MT_BACK, "<-BACK" ), // Next level up
|
||||||
Menuitem ( MT_END ) // End marker
|
Menuitem ( MT_END ) // End marker
|
||||||
};
|
};
|
||||||
@ -1388,6 +1391,17 @@ void menu_tg_offset_cb ( int item )
|
|||||||
ui_process_keypad ();
|
ui_process_keypad ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "menu_tg_frequency_cb" - Handles setting the tracking generator frequency when in sig gen mode
|
||||||
|
*/
|
||||||
|
|
||||||
|
void menu_tg_frequency_cb ( int item )
|
||||||
|
{
|
||||||
|
int km = KM_TGFREQ;
|
||||||
|
tft.fillScreen ( bg );
|
||||||
|
ui_mode_keypad ( km );
|
||||||
|
ui_process_keypad ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1450,6 +1464,11 @@ static void menu_tracking_cb (int item )
|
|||||||
ui_mode_normal (); // Back to sweep
|
ui_mode_normal (); // Back to sweep
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 2: // Turn Sig gen mode
|
||||||
|
SetTracking (2);
|
||||||
|
ui_mode_normal (); // Back to sweep
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2133,6 +2152,7 @@ static const keypads_t * const keypads_mode_tbl[] =
|
|||||||
keypads_freq, // KM_IFSTOP.........IF Sweep stop frequency
|
keypads_freq, // KM_IFSTOP.........IF Sweep stop frequency
|
||||||
keypads_freq, // KM_IFSIG..........IF Sweep signal frequency
|
keypads_freq, // KM_IFSIG..........IF Sweep signal frequency
|
||||||
keypads_signed_freq, // KM_TGOFFSET.......Offset Frequency of TG IF compared to SA IF
|
keypads_signed_freq, // KM_TGOFFSET.......Offset Frequency of TG IF compared to SA IF
|
||||||
|
keypads_freq, // KM_TGFREQ.........Frequency of TG in sig gen mode
|
||||||
keypads_level, // KM_TGLO_DRIVE.....Tracking generator LO drive
|
keypads_level, // KM_TGLO_DRIVE.....Tracking generator LO drive
|
||||||
keypads_level, // KM_TGIF_DRIVE.....Tracking generator IF drive
|
keypads_level, // KM_TGIF_DRIVE.....Tracking generator IF drive
|
||||||
keypads_freq, // KM_BANDSCOPESTART.IF Sweep start frequency
|
keypads_freq, // KM_BANDSCOPESTART.IF Sweep start frequency
|
||||||
@ -2522,6 +2542,10 @@ static void fetch_numeric_target ( void )
|
|||||||
uistat.value = trackGenSetting.Offset;
|
uistat.value = trackGenSetting.Offset;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case KM_TGFREQ:
|
||||||
|
uistat.value = trackGenSetting.Frequency;
|
||||||
|
break;
|
||||||
|
|
||||||
case KM_TGIF_DRIVE:
|
case KM_TGIF_DRIVE:
|
||||||
uistat.value = trackGenSetting.IF_Drive;
|
uistat.value = trackGenSetting.IF_Drive;
|
||||||
break;
|
break;
|
||||||
@ -2945,6 +2969,23 @@ static int keypad_click ( int key )
|
|||||||
SetTGOffset ( (int32_t)value );
|
SetTGOffset ( (int32_t)value );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case KM_TGFREQ:
|
||||||
|
if ( (value > MAX_SIGLO_FREQ) || (value < MIN_SIGLO_FREQ) )
|
||||||
|
{
|
||||||
|
strcpy ( fBuff, FormatSignedFrequency (( int32_t ) value ));
|
||||||
|
|
||||||
|
DisplayError ( ERR_WARN,
|
||||||
|
fBuff,
|
||||||
|
"Invalid Frequency!",
|
||||||
|
NULL,
|
||||||
|
NULL );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SetTGFreq ( (int32_t)value );
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case KM_TGIF_DRIVE:
|
case KM_TGIF_DRIVE:
|
||||||
if ( (value > MAX_DRIVE) || (value < MIN_DRIVE) )
|
if ( (value > MAX_DRIVE) || (value < MIN_DRIVE) )
|
||||||
{
|
{
|
||||||
@ -2958,6 +2999,8 @@ static int keypad_click ( int key )
|
|||||||
SetTGIfDrive ( (uint8_t)value );
|
SetTGIfDrive ( (uint8_t)value );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef SI_TG_LO_CS
|
||||||
case KM_TGLO_DRIVE:
|
case KM_TGLO_DRIVE:
|
||||||
if ( (value > MAX_DRIVE) || (value < MIN_DRIVE) )
|
if ( (value > MAX_DRIVE) || (value < MIN_DRIVE) )
|
||||||
{
|
{
|
||||||
@ -2970,7 +3013,8 @@ static int keypad_click ( int key )
|
|||||||
else
|
else
|
||||||
SetTGLoDrive ( (uint8_t)value );
|
SetTGLoDrive ( (uint8_t)value );
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
case KM_BANDSCOPESTART: // Bandscope Start frequency entered?
|
case KM_BANDSCOPESTART: // Bandscope Start frequency entered?
|
||||||
SetBandscopeStart (( int32_t ) value );
|
SetBandscopeStart (( int32_t ) value );
|
||||||
@ -3228,21 +3272,25 @@ void UiProcessTouch ( void )
|
|||||||
if ( (touch_y < 10) && (touch_x < 160) )
|
if ( (touch_y < 10) && (touch_x < 160) )
|
||||||
{
|
{
|
||||||
marker[0].Toggle(); // marker 1
|
marker[0].Toggle(); // marker 1
|
||||||
|
setting.MkrStatus[0] = marker[0].Status();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ( (touch_y < 10) && (touch_x > 160) )
|
else if ( (touch_y < 10) && (touch_x > 160) )
|
||||||
{
|
{
|
||||||
marker[2].Toggle(); // marker 3
|
marker[2].Toggle(); // marker 3
|
||||||
|
setting.MkrStatus[2] = marker[2].Status();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ( (touch_y < 20) && (touch_x < 160) )
|
else if ( (touch_y < 20) && (touch_x < 160) )
|
||||||
{
|
{
|
||||||
marker[1].Toggle(); // marker 2
|
marker[1].Toggle(); // marker 2
|
||||||
|
setting.MkrStatus[1] = marker[1].Status();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ( (touch_y < 20) && (touch_x > 160) )
|
else if ( (touch_y < 20) && (touch_x > 160) )
|
||||||
{
|
{
|
||||||
marker[3].Toggle(); // marker 4
|
marker[3].Toggle(); // marker 4
|
||||||
|
setting.MkrStatus[3] = marker[3].Status();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ( (touch_y < 40) && (touch_x > 30) )
|
else if ( (touch_y < 40) && (touch_x > 30) )
|
||||||
|
Loading…
Reference in New Issue
Block a user