From 8a769c701101ea68d83f80709fd680242200feca Mon Sep 17 00:00:00 2001
From: Michael Black W9MDB <mdblack98@yahoo.com>
Date: Mon, 19 Oct 2020 22:22:59 -0500
Subject: [PATCH] Add VFO_CURR to set_cache_freq and get_cache_freq
 https://github.com/Hamlib/Hamlib/issues/300

---
 include/hamlib/rig.h | 1 +
 src/rig.c            | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h
index a4c1a6782..851462b6d 100644
--- a/include/hamlib/rig.h
+++ b/include/hamlib/rig.h
@@ -1947,6 +1947,7 @@ struct rig_cache {
     split_t split;
     vfo_t split_vfo;  // split caches two values
     struct timespec time_freq;
+    struct timespec time_freqCurr;
     struct timespec time_freqMainA;
     struct timespec time_freqMainB;
     struct timespec time_freqMainC;
diff --git a/src/rig.c b/src/rig.c
index 35ff5f9d6..95460ae3e 100644
--- a/src/rig.c
+++ b/src/rig.c
@@ -1257,6 +1257,11 @@ static int set_cache_freq(RIG *rig, vfo_t vfo, freq_t freq)
 {
     switch (vfo)
     {
+    case RIG_VFO_CURR:
+        rig->state.cache.freqCurr = freq;
+        elapsed_ms(&rig->state.cache.time_freqCurr, HAMLIB_ELAPSED_SET);
+        break;
+
     case RIG_VFO_A:
     case RIG_VFO_MAIN:
     case RIG_VFO_MAIN_A:
@@ -1301,6 +1306,9 @@ static int get_cache_freq(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms)
     // VFO_C to be implemented
     switch (vfo)
     {
+    case RIG_VFO_CURR:
+        *freq = rig->state.cache.freqCurr;
+        break;
     case RIG_VFO_A:
     case RIG_VFO_MAIN:
     case RIG_VFO_MAIN_A: