From f35653987fd0f33cffcffb2959b9d0659e99a7a8 Mon Sep 17 00:00:00 2001 From: Rob French Date: Sun, 3 May 2020 23:29:31 -0500 Subject: [PATCH] Updated to allow receiving (via serial) a mode command from the Raduino, and then using that to set rigMode. Note that it doesn't actually do anything beyond that, at the moment, but I *think* this will allow PTT events to be pressed in CW mode (as CW key down). --- audio.ino | 13 +++++++++++++ cat.ino | 16 ++++++++++++++++ config.h | 2 +- ubitx_iop.ino | 19 +++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/audio.ino b/audio.ino index 4451a47..8fc4509 100644 --- a/audio.ino +++ b/audio.ino @@ -76,6 +76,8 @@ void audioInit() //audioCtrl.dacVolume(1.0, 0.0); // we're going to mute TX audio via the DAC unless we're transmitting audioSelectTxInput(TX_MIC_IN); // superfluous I think + + audioCWFilterNarrow(); // test } inline void updateRxRigIn() @@ -538,6 +540,17 @@ void audioCalibrate(IOPConfig* c, char cmd, char subcmd, char parm, float value, } } +int updateFilter[5]; + +void audioCWFilterNarrow() +{ + audioCtrl.audioPreProcessorEnable(); + // calcBiquad(FilterType,FrequencyC,dBgain,Q,QuantizationUnit,SampleRate,int*); + calcBiquad(FILTER_BANDPASS, 700, 0, 2, 524288, 44100, updateFilter); + audioCtrl.eqFilter(0, updateFilter); + audioCtrl.eqFilter(1, updateFilter); +} + //====================================================================== // EOF //====================================================================== diff --git a/cat.ino b/cat.ino index 484f647..fa37ff2 100644 --- a/cat.ino +++ b/cat.ino @@ -10,6 +10,11 @@ #define EEPROM_READ_PREFIX 0xE0 #define EEPROM_WRITE_PREFIX 0xF0 +#define IOP_MODE_COMMAND 0x00 +#define IOP_MODE_SSB 0x01 +#define IOP_MODE_DIGI 0x02 +#define IOP_MODE_CW 0x03 + //====================================================================== // CAT from PC-to-IOP // @@ -44,6 +49,17 @@ void initCAT(long baud, int portConfig) void processIOPCommand(const byte* buf, int len) { + if (len > 0) { + switch(buf[0]) { + case IOP_MODE_COMMAND: + if (len < 2) { + return; + } else { + rigMode = RigMode(buf[1]); + } + break; + } + } } //====================================================================== diff --git a/config.h b/config.h index 9f14aa3..5b1833a 100644 --- a/config.h +++ b/config.h @@ -8,7 +8,7 @@ // 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 +//#define FACTORY_CALIBRATION // IOPConfig // Used to store configuration parameters during runtime, as well as to diff --git a/ubitx_iop.ino b/ubitx_iop.ino index 789a9ce..3d539f7 100644 --- a/ubitx_iop.ino +++ b/ubitx_iop.ino @@ -87,6 +87,25 @@ void setup() { audioInit(); } +//====================================================================== + +void setRigMode(RigMode m) +{ + rigMode = m; + switch(rigMode) { + case MODE_SSB: + break; + + case MODE_DIGI: + break; + + case MODE_CW: + break; + } +} + +//====================================================================== + void loop() { elapsedMillis frame_timer = 0;