ubitx-iop/ubitx_iop/config.h

163 lines
5.1 KiB
C
Raw Normal View History

2020-05-03 02:00:20 -04:00
//======================================================================
// config.h
//
// NOTE: Let's change the name of this file to RigConfig.h.
2020-05-03 02:00:20 -04:00
//======================================================================
#ifndef __iop_config_h__
#define __iop_config_h__
#include <iopcomm.h>
//#include "rig.h"
#define KEYER_LEFT_PADDLE_PIN 16
#define KEYER_RIGHT_PADDLE_PIN 17
2020-05-03 02:00:20 -04:00
// Uncomment to use the "factory" calibration mode. This is intended to
// allow calibration of IOP settings, separately from the uBITX/Raduino.
// There will be no pass-thru of any CAT.
//#define FACTORY_CALIBRATION
2020-05-03 02:00:20 -04:00
//======================================================================
// AudioConfig
//======================================================================
class AudioConfig {
public:
2020-05-03 02:00:20 -04:00
//--------------------------------------------------------------------
2020-05-03 02:00:20 -04:00
// RECEIVE PARAMETERS
//--------------------------------------------------------------------
2020-05-03 02:00:20 -04:00
// rig-in parameters (RX)
uint8_t rxRigInLevel = 8; //5;
float rxRigInVol = 1.0; //0.7;
float rxRigInCal = 8.0; //1.0;
2020-05-03 02:00:20 -04:00
// USB-in parameters (RX) - debug/monitor use only
bool rxUSBInEnable = false;
float rxUSBInVol = 1.0;
float rxUSBInCal = 1.0;
// speaker-out (DAC) parameters (RX)
float rxSpkrOutCal = 1.0;
// line-out parameters (RX)
uint8_t rxLineOutLevel = 29;
float rxLineOutCal = 1.0;
// USB-out parameters (RX)
float rxUSBOutCal = 1.0;
// sidetone parameters (really a TX thing, but "RX" side of audio)
float sideToneVol = 1.0;
2020-05-03 02:00:20 -04:00
//--------------------------------------------------------------------
2020-05-03 02:00:20 -04:00
// TRANSMIT PARAMETERS
//--------------------------------------------------------------------
2020-05-03 02:00:20 -04:00
//--------------------------------------------------------------------
// NOTE: Default rig-out parameters are based on trying to hit a
// 25mVrms output to the rig. This is based on some discussion at the
// following URL:
2020-05-03 02:00:20 -04:00
//
// https://groups.io/g/BITX20/message/58951
//
// This may or may not be totally applicable. I believe it was for
// IMD/spurs on a pre-V5 version of the uBITX. So it may be OBE for
// my V5. It also alludes to modifications to the transmit audio
// chain, which may be something I need to look into (i.e. increasing
2020-05-03 02:00:20 -04:00
// the gain on the initial mic pre-amp).
//
// Specifically, for the rig-out parameters:
// line out level 31 = 1.16 V p-p
// = 0.58 V peak
// = 0.41 V rms = 410 mV rms
// so output calibration needs to reduce that to 17.5 mV rms (70%
// of 25 mV rms)
2020-05-03 02:00:20 -04:00
// txMicInCal = 0.043 ... seems pretty low...
//
// Likewise, default line-in (TX) parameters assume consumer line
// level input, but with the default audio adaptor line-in level
// setting (5 = 1.33V p-p).
2020-05-03 02:00:20 -04:00
// line in level 5 = 1.33 V p-p
// signal in = 0.894 V p-p
// = 0.447 V peak
// = 0.316 V rms = 316 mV rms
// so input calibration needs to convert that to the 410 mV noted
// above (equivalent for the microphone), so that when that signal
// gets to the rig-out, it gets treated the same as the mic input.
2020-05-03 02:00:20 -04:00
// txLineInCal = 1.30
//--------------------------------------------------------------------
2020-05-03 02:00:20 -04:00
// microphone-in parameters (TX)
uint8_t txMicInGain = 12;
float txMicInVol = 1.0; //0.7;
2020-05-03 02:00:20 -04:00
float txMicInCal = 1.0;
// line-in parameters (TX)
uint8_t txLineInLevel = 5;
float txLineInVol = 1.0; //0.7;
2020-05-03 02:00:20 -04:00
float txLineInCal = 1.30;
// USB-in parameters (TX)
float txUSBInVol = 1.0; //0.7;
2020-05-03 02:00:20 -04:00
float txUSBInCal = 1.0;
// two-tone parameters (TX)
float txSine1Vol = 1.0;
float txSine2Vol = 1.0;
2020-05-03 02:00:20 -04:00
// rig-out parameters (TX) - default settings are based on hitting 70% of 25mVrms w/ mic
uint8_t txRigOutLevel = 31;
float txRigOutCal = 0.1; // 0.061;
2020-05-03 02:00:20 -04:00
// USB-out parameters (TX)- debug/monitor use only
bool txUSBOutEnable = true;
float txUSBOutCal = 1.0;
};
//======================================================================
// RigConfig
// Used to store configuration parameters during runtime, as well as to
// save them to EEPROM.
//======================================================================
class RigConfig {
public:
// audio configuration
AudioConfig audio;
// SSB configuration
SSBConfig lsb{RX_FILTER_WIDE};
SSBConfig usb{RX_FILTER_WIDE};
// DGT configuration
DGTConfig dgl{RX_FILTER_WIDE};
DGTConfig dgu{RX_FILTER_WIDE};
// CW configuration
CWConfig cwl{
KEYER_MODE_IAMBIC_A,
false,
15,
3.0,
700,
RX_FILTER_WIDE,
};
CWConfig cwu{
KEYER_MODE_IAMBIC_A,
false,
15,
3.0,
700,
RX_FILTER_WIDE,
};
// TT configuration
TTConfig ttl{RX_FILTER_WIDE};
TTConfig ttu{RX_FILTER_WIDE};
// General rig configuration entries.
RigMode numModes = NUM_RIG_MODES;
RigMode startMode = RIG_MODE_LSB;
2020-05-03 02:00:20 -04:00
};
extern RigConfig rigConfig;
2020-05-03 02:00:20 -04:00
#endif
//======================================================================
// EOF
//======================================================================