kopia lustrzana https://github.com/Hamlib/Hamlib
Fix bug in vfo_comp calculation in Hamlib
I tried to control my "FUNcube Dongle Pro" SDR with Hamlib. At first it worked fine, but when I tried to correct the frequency divergence with the vfo_comp parameter, I found a bug in the software. Example: $ ./rigctl -m 2513 -C vfo_comp=0.01 Rig command: F 100000000 Rig command: f Frequency: 102010000 The correction must toke place when setting the frequency and when it is read back. But one time the correction must work in on direction, the other time quite opposite. I found the code in the file rig.c and could see, that both times the same calculation is used. The simplest way to correct this is to go to the “rig_get_freq(“ subroutine and change it in the line 1188 from “+=” to “-=” , even that is mathematically not correct. Result: $ ./rigctl -m 2513 -C vfo_comp=0.01 Rig command: F 100000000 Rig command: f Frequency: 99990000 $ ./rigctl -m 2513 -C vfo_comp=0.000022 Rig command: F 100000000 Rig command: f Frequency: 99999999 You can see, that the result is quite good for small divergences of some ppm, but there is still an error for bigger divergences. So I changed the line 1188 to the form I hope it is the mathematically correct one: *freq = (freq_t)(*freq/(1.0+(double)rig->state.vfo_comp)); Result: $ ./rigctl -m 2513 -C vfo_comp=0.01 Rig command: F 100000000 Rig command: f Frequency: 100000000 $ ./rigctl -m 2513 -C vfo_comp=0.000022 Rig command: F 100000000 Rig command: f Frequency: 100000000 Now the result looks good for small and for bigger divergences. Best regards Dieter Röver (DK6OV)pull/1/head
rodzic
c8a8d18d18
commit
1a272f5b0e
|
@ -1183,7 +1183,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
|
|||
/* VFO compensation */
|
||||
if (rig->state.vfo_comp != 0.0)
|
||||
{
|
||||
*freq += (freq_t)(rig->state.vfo_comp * (*freq));
|
||||
*freq = (freq_t)(*freq/(1.0+(double)rig->state.vfo_comp));
|
||||
}
|
||||
|
||||
if (retcode == RIG_OK
|
||||
|
|
Ładowanie…
Reference in New Issue