Skip to content

Commit

Permalink
increase non-decimal sample rate to double carson width
Browse files Browse the repository at this point in the history
  • Loading branch information
dernasherbrezon committed Aug 8, 2024
1 parent 427fead commit 3862cc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/ru/r2cloud/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ public static double convertAzimuthToDegress(double azimuth) {
private static long findClosest(long fromSampleRate, long baudRate) {
long carsonCutoff = 5000 + baudRate / 2;
long toSampleRate = baudRate * 3;
if (toSampleRate < carsonCutoff) {
toSampleRate = carsonCutoff;
if (toSampleRate < carsonCutoff * 2) {
toSampleRate = carsonCutoff * 2;
}
int[] primeNumbers = new int[] { 11, 7, 5, 3, 2 };
long result = fromSampleRate;
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/ru/r2cloud/util/UtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,20 @@ public void testGoodSampleRateSdrServer() {
public void testMinDividableSampleRate() {
assertEquals(40_000L, Util.getSmallestDividableSampleRate(5_000, 240_000L));
assertEquals(16_000L, Util.getSmallestDividableSampleRate(5_100, 240_000L));
assertEquals(7_000L, Util.getSmallestDividableSampleRate(1600, 21_000L));
assertEquals(21_000L, Util.getSmallestDividableSampleRate(1600, 21_000L));
}

@Test
public void testDemodulatorInput() {
assertEquals(46_875, Util.getDemodulatorInput(2_400, 46_875));
assertEquals(9_375, Util.getDemodulatorInput(2_600, 46_875));
assertEquals(10_000, Util.getDemodulatorInput(1200, 2000000));
assertEquals(15_625, Util.getDemodulatorInput(2_600, 46_875));
assertEquals(20_000, Util.getDemodulatorInput(1200, 2000000));
}

@Test
public void testSymbolSyncInput() {
assertEquals(9_375L, Util.getSymbolSyncInput(1250, 46_875));
assertEquals(7_000L, Util.getSmallestDividableSampleRate(1600, 21_000L));
assertEquals(21_000L, Util.getSmallestDividableSampleRate(1600, 21_000L));
}

@Test
Expand Down

0 comments on commit 3862cc6

Please sign in to comment.