diff --git a/moc_test/gortlsdr/librtlsdr.c b/moc_test/gortlsdr/librtlsdr.c index f67c30d..88c57ec 100644 --- a/moc_test/gortlsdr/librtlsdr.c +++ b/moc_test/gortlsdr/librtlsdr.c @@ -116,7 +116,7 @@ void do_init(void) { .test_mode = 0, .agc_mode = 0, .direct_sampling_mode = 1, - .offset_tuning =1000, + .offset_tuning = 1, .type = RTLSDR_TUNER_R828D, .eeprom_buffer = {0x28, 0x32, 0x09, 0x01, 0x01, 0x01, 0xA5, 0x03, 0x1F, 0x03, 'R', 0x00, 'E', 0x00, 'A', 0x00, 'L', 0x00, 'T', 0x00, 'E', 0x00, 'K', 0x00, @@ -141,7 +141,7 @@ void do_init(void) { .test_mode = 1, .agc_mode = 1, .direct_sampling_mode = 0, - .offset_tuning =1001, + .offset_tuning = 0, .type = RTLSDR_TUNER_R820T, .eeprom_buffer = {0x28, 0x32, 0x09, 0x01, 0x01, 0x01, 0xA5, 0x03, 0x1F, 0x03, 'R', 0x00, 'E', 0x00, 'A', 0x00, 'L', 0x00, 'T', 0x00, 'E', 0x00, 'K', 0x00, @@ -166,7 +166,7 @@ void do_init(void) { .test_mode = 0, .agc_mode = 1, .direct_sampling_mode = 1, - .offset_tuning =1002, + .offset_tuning = 1, .type = RTLSDR_TUNER_E4000, .eeprom_buffer = {0x28, 0x32, 0x09, 0x01, 0x01, 0x01, 0xA5, 0x03, 0x1F, 0x03, 'R', 0x00, 'E', 0x00, 'A', 0x00, 'L', 0x00, 'T', 0x00, 'E', 0x00, 'K', 0x00, @@ -424,10 +424,8 @@ int rtlsdr_get_direct_sampling(rtlsdr_dev_t *dev){ } int rtlsdr_set_offset_tuning(rtlsdr_dev_t *dev, int on) { - if (!dev) + if (!dev || !dev_valid(dev)) return -1; - if (!dev_valid(dev)) - return -2; dev->offset_tuning = on; return 0; diff --git a/moc_test/main.go b/moc_test/main.go index 3e4a1e3..4f30974 100644 --- a/moc_test/main.go +++ b/moc_test/main.go @@ -93,7 +93,7 @@ func SetFreqCorrection(d *rtl.Context, i int) { } func GetFreqCorrection(d *rtl.Context, i int) { - if ppm := d.GetFreqCorrection(); ppm != -1 { + if ppm := d.GetFreqCorrection(); ppm < 0 { log.Printf("--- FAILED, GetFreqCorrection i:%d - %d\n", i, ppm) } else { log.Printf("--- PASSED, GetFreqCorrection i:%d\n", i) @@ -168,7 +168,7 @@ func SetTunerGainMode(d *rtl.Context, i int) { } func SetSampleRate(d *rtl.Context, i int) { - rateHz := 3500000 + rateHz := 225001 if err := d.SetSampleRate(rateHz); err != nil { log.Printf("--- FAILED, SetSampleRate i:%d - %s\n", i, err) } else { @@ -272,17 +272,17 @@ func main() { for i := 0; i < cnt; i++ { if len(GetDeviceName(i)) == 0 { - log.Printf("--- FAILED, GetDeviceName i:%d\n") + log.Printf("--- FAILED, GetDeviceName i:%d\n", i) } else { - log.Printf("--- PASSED, GetDeviceName i:%d\n") + log.Printf("--- PASSED, GetDeviceName i:%d\n", i) } } for i := 3; i < 6; i++ { if len(GetDeviceName(i)) != 0 { - log.Printf("--- FAILED, GetDeviceName i:%d\n") + log.Printf("--- FAILED, GetDeviceName i:%d\n", i) } else { - log.Printf("--- PASSED, GetDeviceName i:%d\n") + log.Printf("--- PASSED, GetDeviceName i:%d\n", i) } } @@ -292,7 +292,7 @@ func main() { log.Printf("--- FAILED, GetDeviceUsbStrings i:%d, %s\n", i, err) } else { serials = append(serials, s) - log.Printf("--- PASSED, GetDeviceUsbStrings i:%d\n") + log.Printf("--- PASSED, GetDeviceUsbStrings i:%d\n", i) } } @@ -300,7 +300,7 @@ func main() { if _, _, _, err := GetDeviceUsbStrings(i); err == nil { log.Printf("--- FAILED, GetDeviceUsbStrings i:%d, %s\n", i, err) } else { - log.Printf("--- PASSED, GetDeviceUsbStrings i:%d\n") + log.Printf("--- PASSED, GetDeviceUsbStrings i:%d\n", i) } }