Below the code I sent to Tomi to fix my QSY button sign error in gMFSK 0.7.1pre.
if (hamlib_qsy) {
gfloat f = conf_get_float("hamlib/cfreq");
hamlib_qsy = FALSE;
G_LOCK(hamlib_mutex);
if (mode == RIG_MODE_LSB || mode == RIG_MODE_RTTYR || mode == RIG_MODE_CWR || mode == RIG_MODE_PKTLSB || mode == RIG_MODE_ECSSLSB)
ret = rig_set_freq(rig, RIG_VFO_CURR, ((gdouble) freq) - trx_get_freq() + f);
else
ret = rig_set_freq(rig, RIG_VFO_CURR, ((gdouble) freq) + trx_get_freq() - f);
G_UNLOCK(hamlib_mutex);
if (ret != RIG_OK) {
str = g_strdup_printf(_("rig_set_freq failed: %s"),
rigerror(ret));
statusbar_set_main(str);
g_free(str);
continue;
}
waterfall_set_frequency(waterfall, f);
}
The corresponding code in fldigi is in hamlib.cxx
if (hamlib_qsy) {
long int fmid = 1000; // this is the sweet spot frequency
long int f = wf->rfcarrier() + wf->carrier() - fmid;
So it would be something like
if (hamlib_qsy) {
long int fmid = 1000; // TODO: Read this from config
long int f = 0;
if (mode == RIG_MODE_LSB || mode == RIG_MODE_RTTYR || mode == RIG_MODE_CWR || mode == RIG_MODE_PKTLSB || mode == RIG_MODE_ECSSLSB)
f = wf->rfcarrier() + wf->carrier() + fmid;
else
f = wf->rfcarrier() + wf->carrier() - fmid;
This doesn't take into account the separation of configuration into 600Hz or so for CW and 1000Hz or so for the digital modes.
73,
Leigh/WA5ZNU