VE3NEA / OmniRig

60 stars 28 forks source link

Rounding error in TRig.ToDPIcom #2

Open jarvisroad opened 4 years ago

jarvisroad commented 4 years ago

Hi, I've been using the DPIcom format in a rig descriptor file I created for the AOR AR-DV1 receiver. I found that there is a rounding error when dividing from Hz to MHz on line 321 of RigObj.pas. If I declare F as double (line 316) this rounding problem can be fixed. Would you be able to make this change and include in your next release please?

stephanandratsch commented 4 years ago

Hello Steve,

I have already changed the declaration of F to double in RigObj.pas.

Here is the new code:

// Added by RA6UAZ for Icom Marine Radio NMEA Command procedure TRig.ToDPIcom(Arr: TByteArray; Value: integer); var S: AnsiString; // Changed by Stephan Andratsch (22.07.20209) // Dataytype change from single to double // Fix inspired by jarvisroad - Steve Holloway (M7FFT) F: double; C: Char; begin C := FormatSettings.DecimalSeparator; FormatSettings.DecimalSeparator := '.'; F := Value / 1000000; S := StringOfChar('0', Length(Arr)) + FloatToStrF(F,ffFixed,10,6); Move(S[Length(S)-Length(Arr)+1], Arr[0], Length(Arr)); FormatSettings.DecimalSeparator := C; end;

Hopefully I will be able to release the new version in a couple of days.

Regards Stephan Andratsch

HB9DTZ commented 2 years ago

Dear Steve & Stephan It seems than one of you has created a rig descriptor file for the AOR DV-1. I tried to do this several times without success. Could you please tell me, if this file is public available? It would be a great help for me to see how it's done ( and to use it ). Kind regards: Christoph / HB9DTZ hb9dtz@icloud.com