From 3287606caa4185f5d11da7db4bdc12db25a694dc Mon Sep 17 00:00:00 2001 From: Mike Brashler Date: Thu, 14 Apr 2022 02:12:14 -0700 Subject: [PATCH 1/2] Issue #21 - rework ct7aup's Rx CW Speed adjustment --- DxOper.pas | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/DxOper.pas b/DxOper.pas index aa25a80..bf7065a 100644 --- a/DxOper.pas +++ b/DxOper.pas @@ -66,31 +66,13 @@ function TDxOperator.GetSendDelay: integer; end; function TDxOperator.GetWpm: integer; -Var - xmin: integer; - xmax: integer; - xupdown: integer; begin if RunMode = rmHst then Result := Ini.Wpm - else begin - if (MaxRxWpm=0) and (MinRxWpm=0) then - Result := Round(Ini.Wpm * 0.5 * (1 + Random)) - else begin - if (MinRxWpm > 0) and (MaxRxWpm > 0) then begin - xupdown := random (2); - end else begin - if MinRxWpm > 0 then - xupdown := 0 - else - xupdown := 1; - end; - if xupdown = 0 then - result := Ini.Wpm - random(MinRxWpm+1) - else - result := Ini.Wpm + random(maxRxWpm+1); - end; - end; + else if (MaxRxWpm = -1) or (MinRxWpm = -1) { use original algorithm } + then Result := Round(Ini.Wpm * 0.5 * (1 + Random)) + else + Result := Round(Ini.Wpm - MinRxWpm + (MinRxWpm + MaxRxWpm) * Random); end; function TDxOperator.GetNR: integer; From 275557474c8d2be50bf24c0448513a409b5642fd Mon Sep 17 00:00:00 2001 From: Mike Brashler Date: Fri, 16 Sep 2022 18:24:36 -0700 Subject: [PATCH 2/2] Issue #21 - fix some if/then/else coding style. --- DxOper.pas | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/DxOper.pas b/DxOper.pas index bf7065a..627f339 100644 --- a/DxOper.pas +++ b/DxOper.pas @@ -57,20 +57,20 @@ function TDxOperator.GetSendDelay: integer; // Result := Max(1, SecondsToBlocks(1 / Sqr(4*Skills))); // Result := Round(RndGaussLim(Result, 0.7 * Result)); - if State = osNeedPrevEnd - then Result := NEVER - else if RunMode = rmHst - then Result := SecondsToBlocks(0.05 + 0.5*Random * 10/Wpm) + if State = osNeedPrevEnd then + Result := NEVER + else if RunMode = rmHst then + Result := SecondsToBlocks(0.05 + 0.5*Random * 10/Wpm) else Result := SecondsToBlocks(0.1 + 0.5*Random); end; function TDxOperator.GetWpm: integer; begin - if RunMode = rmHst - then Result := Ini.Wpm - else if (MaxRxWpm = -1) or (MinRxWpm = -1) { use original algorithm } - then Result := Round(Ini.Wpm * 0.5 * (1 + Random)) + if RunMode = rmHst then + Result := Ini.Wpm + else if (MaxRxWpm = -1) or (MinRxWpm = -1) then { use original algorithm } + Result := Round(Ini.Wpm * 0.5 * (1 + Random)) else Result := Round(Ini.Wpm - MinRxWpm + (MinRxWpm + MaxRxWpm) * Random); end;