}
void update_diversity_gain(double increment) {
- double g=div_gain+(increment/10);
+ double g=div_gain+(0.1*increment);
if(g<-27.0) g=-27.0;
if(g>27.0) g=27.0;
div_gain=g;
return 0;
}
+int ext_diversity_change_gain(void *data) {
+ double *dp = (double *) data;
+ update_diversity_gain(*dp);
+ free(dp);
+ return 0;
+}
+
+int ext_diversity_change_phase(void *data) {
+ double *dp = (double *) data;
+ update_diversity_phase(*dp);
+ free(dp);
+ return 0;
+}
+
#ifdef PURESIGNAL
int ext_start_ps(void *data) {
start_ps();
int ext_start_rx(void *data);
int ext_start_tx(void *data);
int ext_diversity_update(void *data);
+int ext_diversity_change_gain(void *data);
+int ext_diversity_change_phase(void *data);
int ext_sat_update(void *data);
int ext_set_rf_gain(void *data);
int ext_set_duplex(void *data);
CWL, // CWL: Left paddle pressed (use with ONOFF)
CWR, // CWR: Right paddle pressed (use with ONOFF)
CWSPEED, // CWSPEED: Set speed of (iambic) CW keyer
+ DIV_GAIN, // DIVGAIN: change DIVERSITY gain
+ DIV_PHASE, // DIVPHASE: change DIVERSITY phase
+ DIV_TOGGLE, // DIVTOGGLE: DIVERSITY on/off
MIDI_DUP, // DUP: toggle duplex on/off
FILTER_DOWN, // FILTERDOWN: cycle through filters downwards
FILTER_UP, // FILTERUP: cycle through filters upwards
{ CWL, "CWL"},
{ CWR, "CWR"},
{ CWSPEED, "CWSPEED"},
+ { DIV_GAIN, "DIVGAIN"},
+ { DIV_PHASE, "DIVPHASE"},
+ { DIV_TOGGLE, "DIVTOGGLE"},
{ MIDI_DUP, "DUP"},
{ FILTER_DOWN, "FILTERDOWN"},
{ FILTER_UP, "FILTERUP"},
#endif
g_idle_add(ext_vfo_update, NULL);
break;
+ /////////////////////////////////////////////////////////// "DIVGAIN"
+ case DIV_GAIN: // knob or wheel supported
+ switch (type) {
+ case MIDI_KNOB:
+ dnew = 10.0*(-25.0 + 0.5*val - div_gain);
+ break;
+ case MIDI_WHEEL:
+ dnew= val;
+ break;
+ default:
+ // do not change
+ // we should not come here anyway
+ dnew = 0.0;
+ break;
+ }
+ // dnew is the delta times 10
+ dp=malloc(sizeof(double));
+ *dp=dnew;
+ g_idle_add(ext_diversity_change_gain, dp);
+ break;
+ /////////////////////////////////////////////////////////// "DIVPHASE"
+ case DIV_PHASE: // knob or wheel supported
+ switch (type) {
+ case MIDI_KNOB:
+ dnew = (-180.0 + 3.6*val - div_phase);
+ break;
+ case MIDI_WHEEL:
+ dnew= val;
+ break;
+ default:
+ // do not change
+ // we should not come here anyway
+ dnew = 0.0;
+ break;
+ }
+ // dnew is the delta
+ dp=malloc(sizeof(double));
+ *dp=dnew;
+ g_idle_add(ext_diversity_change_phase, dp);
+ break;
+ /////////////////////////////////////////////////////////// "DIVTOGGLE"
+ case DIV_TOGGLE: // only key supported
+ if (type == MIDI_KEY) {
+ // enable/disable DIVERSITY
+ diversity_enabled = diversity_enabled ? 0 : 1;
+ g_idle_add(ext_vfo_update, NULL);
+ }
+ break;
/////////////////////////////////////////////////////////// "DUP"
case MIDI_DUP:
if (can_transmit && !isTransmitting()) {