2018-11-07 23:54:03 +00:00
|
|
|
#include "freqmemory.h"
|
2021-02-23 21:21:22 +00:00
|
|
|
#include "logcategories.h"
|
2018-11-07 23:54:03 +00:00
|
|
|
|
2022-03-23 15:45:51 +00:00
|
|
|
// Copyright 2017-2020 Elliott H. Liggett
|
2020-03-12 03:58:31 +00:00
|
|
|
|
2018-11-07 23:54:03 +00:00
|
|
|
freqMemory::freqMemory()
|
|
|
|
{
|
2018-11-24 08:10:05 +00:00
|
|
|
// NOTE: These are also present in the header and
|
|
|
|
// the array must be changed if these are changed.
|
|
|
|
numPresets = 100;
|
|
|
|
maxIndex = numPresets - 1;
|
|
|
|
initializePresets();
|
2018-11-07 23:54:03 +00:00
|
|
|
|
|
|
|
}
|
2018-11-24 08:10:05 +00:00
|
|
|
|
|
|
|
void freqMemory::initializePresets()
|
|
|
|
{
|
2021-05-15 17:53:16 +00:00
|
|
|
// qInfo() << "Initializing " << numPresets << " memory channels";
|
2018-11-24 08:10:05 +00:00
|
|
|
|
|
|
|
for(unsigned int p=0; p < numPresets; p++)
|
|
|
|
{
|
|
|
|
presets[p].frequency = 14.1 + p/1000.0;
|
|
|
|
presets[p].mode = modeUSB;
|
|
|
|
presets[p].isSet = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void freqMemory::setPreset(unsigned int index, double frequency, mode_kind mode)
|
|
|
|
{
|
|
|
|
if(index <= maxIndex)
|
|
|
|
{
|
|
|
|
presets[index].frequency = frequency;
|
|
|
|
presets[index].mode = mode;
|
|
|
|
presets[index].isSet = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
preset_kind freqMemory::getPreset(unsigned int index)
|
|
|
|
{
|
|
|
|
//validate then return
|
|
|
|
|
|
|
|
if(index <= maxIndex)
|
|
|
|
{
|
|
|
|
return presets[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
// else, return something obviously wrong
|
|
|
|
preset_kind temp;
|
|
|
|
temp.frequency=12.345;
|
|
|
|
temp.mode = modeUSB;
|
|
|
|
temp.isSet = false;
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int freqMemory::getNumPresets()
|
|
|
|
{
|
|
|
|
return numPresets;
|
|
|
|
}
|
|
|
|
|
|
|
|
void freqMemory::dumpMemory()
|
|
|
|
{
|
|
|
|
for(unsigned int p=0; p < numPresets; p++)
|
|
|
|
{
|
2021-05-15 17:53:16 +00:00
|
|
|
qInfo(logSystem()) << "Index: " << p << " freq: " << presets[p].frequency << " Mode: " << presets[p].mode << " isSet: " << presets[p].isSet;
|
2018-11-24 08:10:05 +00:00
|
|
|
}
|
|
|
|
}
|