#include "ext.h"
#include "zoompan.h"
#include "equalizer_menu.h"
+#include "store.h"
// The following calls functions can be called usig g_idle_add
gtk_window_set_title(GTK_WINDOW(top_window),(char *)data);
return 0;
}
+
+int ext_store_memory_slot(void *data) {
+ store_memory_slot(GPOINTER_TO_INT(data));
+ return 0;
+}
+
+int ext_recall_memory_slot(void *data) {
+ recall_memory_slot(GPOINTER_TO_INT(data));
+ return 0;
+}
extern int ext_remote_set_pan(void *data);
extern int ext_set_title(void *data);
+extern int ext_store_memory_slot(void *data);
+extern int ext_recall_memory_slot(void *data);
MIDI_ACTION_PRE, // PREAMP: preamp on/off
MIDI_ACTION_PTTONOFF, // PTT: set PTT state to "on" or "off"
MIDI_ACTION_PS, // PURESIGNAL: toggle PURESIGNAL on/off
+ MIDI_ACTION_MEM_RECALL_M0, // RECALLM0: load current freq/mode/filter from memory slot #0
+ MIDI_ACTION_MEM_RECALL_M1, // RECALLM1: load current freq/mode/filter from memory slot #0
+ MIDI_ACTION_MEM_RECALL_M2, // RECALLM2: load current freq/mode/filter from memory slot #0
+ MIDI_ACTION_MEM_RECALL_M3, // RECALLM3: load current freq/mode/filter from memory slot #0
+ MIDI_ACTION_MEM_RECALL_M4, // RECALLM4: load current freq/mode/filter from memory slot #0
MIDI_ACTION_RF_GAIN, // RFGAIN: receiver RF gain
MIDI_ACTION_TX_DRIVE, // RFPOWER: adjust TX RF output power
MIDI_ACTION_RIT_CLEAR, // RITCLEAR: clear RIT and XIT value
MIDI_ACTION_SAT, // SAT: cycle through SAT modes off/SAT/RSAT
MIDI_ACTION_SNB, // SNB: toggle SNB on/off
MIDI_ACTION_SPLIT, // SPLIT: Split on/off
+ MIDI_ACTION_MEM_STORE_M0, // STOREM0: store current freq/mode/filter in memory slot #0
+ MIDI_ACTION_MEM_STORE_M1, // STOREM1: store current freq/mode/filter in memory slot #1
+ MIDI_ACTION_MEM_STORE_M2, // STOREM2: store current freq/mode/filter in memory slot #2
+ MIDI_ACTION_MEM_STORE_M3, // STOREM3: store current freq/mode/filter in memory slot #3
+ MIDI_ACTION_MEM_STORE_M4, // STOREM4: store current freq/mode/filter in memory slot #4
MIDI_ACTION_SWAP_RX, // SWAPRX: swap active receiver (if there are two receivers)
MIDI_ACTION_SWAP_VFO, // SWAPVFO: swap VFO A/B frequency
MIDI_ACTION_TUNE, // TUNE: toggle "tune" state
{ MIDI_ACTION_PRE, "PREAMP"},
{ MIDI_ACTION_PTTONOFF, "PTT"},
{ MIDI_ACTION_PS, "PURESIGNAL"},
+ { MIDI_ACTION_MEM_RECALL_M0, "RECALLM0"},
+ { MIDI_ACTION_MEM_RECALL_M1, "RECALLM1"},
+ { MIDI_ACTION_MEM_RECALL_M2, "RECALLM2"},
+ { MIDI_ACTION_MEM_RECALL_M3, "RECALLM3"},
+ { MIDI_ACTION_MEM_RECALL_M4, "RECALLM4"},
{ MIDI_ACTION_RF_GAIN, "RFGAIN"},
{ MIDI_ACTION_TX_DRIVE, "RFPOWER"},
{ MIDI_ACTION_RIT_CLEAR, "RITCLEAR"},
{ MIDI_ACTION_SAT, "SAT"},
{ MIDI_ACTION_SNB, "SNB"},
{ MIDI_ACTION_SPLIT, "SPLIT"},
+ { MIDI_ACTION_MEM_STORE_M0, "STOREM0"},
+ { MIDI_ACTION_MEM_STORE_M1, "STOREM1"},
+ { MIDI_ACTION_MEM_STORE_M2, "STOREM2"},
+ { MIDI_ACTION_MEM_STORE_M3, "STOREM3"},
+ { MIDI_ACTION_MEM_STORE_M4, "STOREM4"},
{ MIDI_ACTION_SWAP_RX, "SWAPRX"},
{ MIDI_ACTION_SWAP_VFO, "SWAPVFO"},
{ MIDI_ACTION_TUNE, "TUNE"},
#include "ext.h"
#include "agc.h"
#include "midi.h"
+#include "store.h"
#ifdef LOCALCW
#include "iambic.h"
#endif
}
#endif
break;
+ /////////////////////////////////////////////////////////// "RECALLM[0-4]"
+ case MIDI_ACTION_MEM_RECALL_M0:
+ case MIDI_ACTION_MEM_RECALL_M1:
+ case MIDI_ACTION_MEM_RECALL_M2:
+ case MIDI_ACTION_MEM_RECALL_M3:
+ case MIDI_ACTION_MEM_RECALL_M4:
+ //
+ // only knob supported
+ //
+ if (type == MIDI_TYPE_KNOB) {
+ new = action - MIDI_ACTION_MEM_RECALL_M0,
+ g_idle_add(ext_recall_memory_slot, GINT_TO_POINTER(new));
+ }
+ break;
/////////////////////////////////////////////////////////// "RFGAIN"
case MIDI_ACTION_RF_GAIN: // knob or wheel supported
if (type == MIDI_TYPE_KNOB) {
g_idle_add(ext_split_toggle, NULL);
}
break;
+ /////////////////////////////////////////////////////////// "STOREM[0-4]"
+ case MIDI_ACTION_MEM_STORE_M0:
+ case MIDI_ACTION_MEM_STORE_M1:
+ case MIDI_ACTION_MEM_STORE_M2:
+ case MIDI_ACTION_MEM_STORE_M3:
+ case MIDI_ACTION_MEM_STORE_M4:
+ //
+ // only knob supported
+ //
+ if (type == MIDI_TYPE_KNOB) {
+ new = action - MIDI_ACTION_MEM_STORE_M0;
+ g_idle_add(ext_recall_memory_slot, GINT_TO_POINTER(new));
+ }
+ break;
/////////////////////////////////////////////////////////// "SWAPRX"
case MIDI_ACTION_SWAP_RX: // only key supported
if (type == MIDI_TYPE_KEY && receivers == 2) {
#include "property.h"
#include "store.h"
#include "store_menu.h"
+#include "radio.h"
+#include "ext.h"
+#include "vfo.h"
-
-/*
-struct MEM {
- char title[16]; // Begin BAND Struct
- BANDSTACK *bandstack;
- unsigned char OCrx;
- unsigned char OCtx;
- int preamp;
- int alexRxAntenna;
- int alexTxAntenna;
- int alexAttenuation;
- double pa_calibration;
- long long frequencyMin;
- long long frequencyMax;
- long long frequencyLO;
- int disablePA;
- long long frequency; // Begin BANDSTACK_ENTRY
- int mode;
- int filter;
- int var1Low;
- int var1High;
- int var2Low;
- int var2High;
-}*/
MEM mem[NUM_OF_MEMORYS]; // This makes it a compile time option
-/* */
-/* Memory uses the same format as Band Stack */
-/* Implement NUM_OF_MEMORYS memory locations for now... */
-
void memSaveState() {
char name[128];
char value[128];
int b;
for(b=0;b<NUM_OF_MEMORYS;b++) {
- if(strlen(mem[b].title)>0) {
- sprintf(name,"mem.%d.title",b);
- setProperty(name,mem[b].title);
+ sprintf(value,"%lld",mem[b].frequency);
+ sprintf(name,"mem.%d.freqA",b);
+ setProperty(name,value);
- sprintf(value,"%lld",mem[b].frequency);
- sprintf(name,"mem.%d.freqA",b);
- setProperty(name,value);
+ sprintf(value,"%d",mem[b].mode);
+ sprintf(name,"mem.%d.mode",b);
+ setProperty(name,value);
- sprintf(value,"%d",mem[b].mode);
- sprintf(name,"mem.%d.mode",b);
- setProperty(name,value);
-
- sprintf(value,"%d",mem[b].filter);
- sprintf(name,"mem.%d.filter",b);
- setProperty(name,value);
- }
+ sprintf(value,"%d",mem[b].filter);
+ sprintf(name,"mem.%d.filter",b);
+ setProperty(name,value);
}
-
- //sprintf(value,"%d",band);
- //setProperty("band",value);
}
void memRestoreState() {
// Initialize the array with default values
// Allows this to be a compile time option..
for(b=0; b<NUM_OF_MEMORYS; b++) {
- strcpy(mem[b].title,"10");
mem[b].frequency = 28010000LL;
mem[b].mode = modeCWU;
mem[b].filter = filterF0;
fprintf(stderr,"memRestoreState: restore memory\n");
for(b=0;b<NUM_OF_MEMORYS;b++) {
- sprintf(name,"mem.%d.title",b);
- value=getProperty(name);
- if(value) {
- strcpy(mem[b].title,value);
- fprintf(stderr,"RESTORE: index=%d title=%s\n",b,value);
- }
-
- sprintf(name,"mem.%d.freqA",b);
- value=getProperty(name);
- if(value) {
- mem[b].frequency=atoll(value);
- fprintf(stderr,"RESTORE MEM:Mem %d=FreqA %11lld\n",b,mem[b].frequency);
- }
-
- sprintf(name,"mem.%d.mode",b);
- value=getProperty(name);
- if(value) {
- mem[b].mode=atoi(value);
- fprintf(stderr,"RESTORE: index=%d mode=%d\n",b,mem[b].mode);
- }
-
- sprintf(name,"mem.%d.filter",b);
- value=getProperty(name);
- if(value) {
- mem[b].filter=atoi(value);
- fprintf(stderr,"RESTORE: index=%d filter=%d\n",b,mem[b].filter);
- }
+ sprintf(name,"mem.%d.freqA",b);
+ value=getProperty(name);
+ if(value) {
+ mem[b].frequency=atoll(value);
+ fprintf(stderr,"RESTORE MEM:Mem %d=FreqA %11lld\n",b,mem[b].frequency);
+ }
+
+ sprintf(name,"mem.%d.mode",b);
+ value=getProperty(name);
+ if(value) {
+ mem[b].mode=atoi(value);
+ fprintf(stderr,"RESTORE: index=%d mode=%d\n",b,mem[b].mode);
+ }
+
+ sprintf(name,"mem.%d.filter",b);
+ value=getProperty(name);
+ if(value) {
+ mem[b].filter=atoi(value);
+ fprintf(stderr,"RESTORE: index=%d filter=%d\n",b,mem[b].filter);
+ }
}
+}
+
+void recall_memory_slot(int index) {
+ long long new_freq;
+ int id=active_receiver->id;
+
+ new_freq = mem[index].frequency;
+ fprintf(stderr,"recall_select_cb: Index=%d\n",index);
+ fprintf(stderr,"recall_select_cb: freqA=%11lld\n",new_freq);
+ fprintf(stderr,"recall_select_cb: mode=%d\n",mem[index].mode);
+ fprintf(stderr,"recall_select_cb: filter=%d\n",mem[index].filter);
+
+ //
+ // Recalling a memory slot is equivalent to the following actions
+ //
+ // a) set the new frequency via the "Freq" menu
+ // b) set the new mode via the "Mode" menu
+ // c) set the new filter via the "Filter" menu
+ //
+ // Step b) automatically restores the filter, noise reduction, and
+ // equalizer settings stored with that mode
+ //
+ // Step c) will not only change the filter but also store the new setting
+ // with that mode.
+ //
+ local_set_frequency(active_receiver->id, new_freq);
+ vfo_mode_changed(mem[index].mode);
+ vfo_filter_changed(mem[index].filter);
+ g_idle_add(ext_vfo_update,NULL);
+}
+
+void store_memory_slot(int index) {
+ char workstr[40];
+ int id=active_receiver->id;
+
+ //
+ // Store current frequency, mode, and filter in slot #index
+ //
+ mem[index].frequency = vfo[id].frequency;
+ mem[index].mode = vfo[id].mode;
+ mem[index].filter=vfo[id].filter;
+
+ fprintf(stderr,"store_select_cb: Index=%d\n",index);
+ fprintf(stderr,"store_select_cb: freqA=%11lld\n",mem[index].frequency);
+ fprintf(stderr,"store_select_cb: mode=%d\n",mem[index].mode);
+ fprintf(stderr,"store_select_cb: filter=%d\n",mem[index].filter);
- //value=getProperty("band");
- //if(value) band=atoi(value);
+ memSaveState();
}
* @brief Band definition
*/
struct _MEM_STORE {
- char title[16]; // Begin BAND Struct
- long long frequency; // Begin BANDSTACK_ENTRY
+ long long frequency;
int mode;
int filter;
};
extern MEM mem[];
void memRestoreState();
void memSaveState();
+void recall_memory_slot(int index);
+void store_memory_slot(int index);
#endif
#include "new_menu.h"
#include "store_menu.h"
-#include "band.h"
-#include "bandstack.h"
-#include "filter.h"
-#include "mode.h"
-#include "radio.h"
-#include "rigctl.h"
-#include "band.h"
-#include "vfo.h"
#include "button_text.h"
#include "store.h"
-#include "ext.h"
static GtkWidget *parent_window=NULL;
fprintf(stderr,"STORE BUTTON PUSHED=%d\n",index);
char workstr[40];
- /* Update mem[data] with current info */
+ store_memory_slot(index);
- mem[index].frequency = vfo[active_receiver->id].frequency; // Store current frequency
- mem[index].mode = vfo[active_receiver->id].mode;
- mem[index].filter=vfo[active_receiver->id].filter;
+ sprintf(workstr,"M%d=%8.6f MHz", index,((double) mem[index].frequency)/1000000.0);
+ gtk_button_set_label(GTK_BUTTON(store_button[index]),workstr);
- fprintf(stderr,"store_select_cb: Index=%d\n",index);
- fprintf(stderr,"store_select_cb: freqA=%11lld\n",mem[index].frequency);
- fprintf(stderr,"store_select_cb: mode=%d\n",mem[index].mode);
- fprintf(stderr,"store_select_cb: filter=%d\n",mem[index].filter);
-
- sprintf(workstr,"M%d=%8.6f MHz", index,((double) mem[index].frequency)/1000000.0);
- gtk_button_set_label(GTK_BUTTON(store_button[index]),workstr);
-
- // Save in the file now..
- memSaveState();
- return FALSE;
+ return FALSE;
}
+
static gboolean recall_select_cb (GtkWidget *widget, gpointer data) {
int index = GPOINTER_TO_INT(data);
- long long new_freq;
-
- //new_freq = mem[index].frequency;
- strcpy(mem[index].title,"Active");
- new_freq = mem[index].frequency;
- fprintf(stderr,"recall_select_cb: Index=%d\n",index);
- fprintf(stderr,"recall_select_cb: freqA=%11lld\n",new_freq);
- fprintf(stderr,"recall_select_cb: mode=%d\n",mem[index].mode);
- fprintf(stderr,"recall_select_cb: filter=%d\n",mem[index].filter);
-
- vfo[active_receiver->id].frequency = new_freq;
- vfo[active_receiver->id].band = get_band_from_frequency(new_freq);
- vfo[active_receiver->id].mode = mem[index].mode;
- vfo[active_receiver->id].filter = mem[index].filter;
- //vfo_band_changed(vfo[active_receiver->id].band);
- vfo_filter_changed(mem[index].filter);
- vfo_mode_changed(mem[index].mode);
- g_idle_add(ext_vfo_update,NULL);
-
- return FALSE;
+ recall_memory_slot(index);
+ return FALSE;
}
void store_menu(GtkWidget *parent) {