MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / vfo_fixup

Function vfo_fixup

src/misc.c:2009–2130  ·  view source on GitHub ↗

we're mapping our VFO here to work with either VFO A/B rigs or Main/Sub Hamlib uses VFO_A and VFO_B as TX/RX as of 2021-04-13 So we map these to Main/Sub as required We need to add some exceptions to this like the ID-5100

Source from the content-addressed store, hash-verified

2007// So we map these to Main/Sub as required
2008// We need to add some exceptions to this like the ID-5100
2009vfo_t HAMLIB_API vfo_fixup(RIG *rig, vfo_t vfo, split_t split)
2010{
2011 struct rig_state *rs = STATE(rig);
2012 vfo_t currvfo = rs->current_vfo;
2013
2014 rig_debug(RIG_DEBUG_TRACE, "%s:(from %s:%d) vfo=%s, vfo_curr=%s, split=%d\n",
2015 __func__, funcname, linenum,
2016 rig_strvfo(vfo), rig_strvfo(currvfo), split);
2017
2018 if (rig->caps->rig_model == RIG_MODEL_ID5100
2019 || rig->caps->rig_model == RIG_MODEL_IC9700)
2020 {
2021 // dualwatch on ID5100 is TX=Main, RX=Sub
2022 if (rig->caps->rig_model == RIG_MODEL_ID5100 && rs->dual_watch)
2023 {
2024 if (vfo == RIG_VFO_TX || vfo == RIG_VFO_MAIN) { return RIG_VFO_MAIN; }
2025
2026 return RIG_VFO_SUB;
2027 }
2028
2029 return vfo; // no change to requested vfo
2030 }
2031 else if (RIG_IS_IC9700)
2032 {
2033 if (vfo == RIG_VFO_A && (currvfo == RIG_VFO_MAIN || currvfo == RIG_VFO_MAIN_A))
2034 {
2035 vfo = RIG_VFO_MAIN_A;
2036
2037 // only have Main/Sub when in satmode
2038 if (CACHE(rig)->satmode) { vfo = RIG_VFO_MAIN; }
2039 }
2040 else if (vfo == RIG_VFO_B && (currvfo == RIG_VFO_MAIN
2041 || currvfo == RIG_VFO_MAIN_A))
2042 {
2043 vfo = RIG_VFO_MAIN_B;
2044 }
2045 else if (vfo == RIG_VFO_A && (currvfo == RIG_VFO_SUB
2046 || currvfo == RIG_VFO_SUB_A || currvfo == RIG_VFO_SUB_B))
2047 {
2048 vfo = RIG_VFO_SUB_A;
2049 }
2050 else if (vfo == RIG_VFO_B && (currvfo == RIG_VFO_SUB
2051 || currvfo == RIG_VFO_SUB_A || currvfo == RIG_VFO_SUB_B))
2052 {
2053 vfo = RIG_VFO_SUB_B;
2054 }
2055 }
2056
2057 if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; }
2058
2059 if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_VFO)
2060 {
2061 rig_debug(RIG_DEBUG_TRACE, "%s: Leaving currVFO alone\n", __func__);
2062 return vfo; // don't modify vfo for RIG_VFO_CURR
2063 }
2064
2065 if (vfo == RIG_VFO_OTHER)
2066 {

Callers 15

dummy_set_freqFunction · 0.85
dummy_set_modeFunction · 0.85
dummy_set_split_vfoFunction · 0.85
icom_get_split_vfosFunction · 0.85
ts590_get_modeFunction · 0.85
kenwood_set_split_vfoFunction · 0.85
rig_openFunction · 0.85
rig_set_freqFunction · 0.85
rig_get_freqFunction · 0.85
rig_set_modeFunction · 0.85
rig_get_modeFunction · 0.85

Calls 2

rig_debugFunction · 0.85
rig_strvfoFunction · 0.85

Tested by

no test coverage detected