1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00
sdrangel/plugins/feature/afc
Daniele Forsi 671438456c Fix memleaks found with AddressSanitizer/LeakSanitizer
Found with:
ASAN_OPTIONS="detect_odr_violation=1,strip_path_prefix=$(pwd)/" build/sdrangel

Fixes:
Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f2360af46b8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x7f2321a07706 in AFC::MsgDeviceSetListsReport::create() sdrangel/plugins/feature/afc/afc.h:151
    #2 0x7f2321a0ac1f in AFC::updateDeviceSetLists() sdrangel/plugins/feature/afc/afc.cpp:290
    #3 0x7f2321a09648 in AFC::handleMessage(Message const&) sdrangel/plugins/feature/afc/afc.cpp:214
    #4 0x7f235dfba569 in Feature::handleInputMessages() sdrangel/sdrbase/feature/feature.cpp:46
    #5 0x7f235ddea09e in Feature::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) build-sdrangel-Desktop_qt5-Debug/sdrbase/sdrbase_autogen/3DM3QXXG3A/moc_feature.cpp:89
    #6 0x7f235b305fcc  (/lib/x86_64-linux-gnu/libQt5Core.so.5+0x305fcc) (BuildId: ed2abb344a128279a866aa6c4a79f3fa5c87c59e)
    #7 0x7f235ddf5d8c in MessageQueue::messageEnqueued() build-sdrangel-Desktop_qt5-Debug/sdrbase/sdrbase_autogen/KH43KSYMFX/moc_messagequeue.cpp:131
    #8 0x7f235e0e1487 in MessageQueue::push(Message*, bool) sdrangel/sdrbase/util/messagequeue.cpp:55
    #9 0x7f2321a32fad in AFCGUI::requestDeviceSetLists() sdrangel/plugins/feature/afc/afcgui.cpp:213
    #10 0x7f2321a32124 in AFCGUI::AFCGUI(PluginAPI*, FeatureUISet*, Feature*, QWidget*) sdrangel/plugins/feature/afc/afcgui.cpp:170
    #11 0x7f2321a308cc in AFCGUI::create(PluginAPI*, FeatureUISet*, Feature*) sdrangel/plugins/feature/afc/afcgui.cpp:32
    #12 0x7f2321a1c229 in AFCPlugin::createFeatureGUI(FeatureUISet*, Feature*) const sdrangel/plugins/feature/afc/afcplugin.cpp:70
    #13 0x7f235fffc534 in MainWindow::featureAddClicked(Workspace*, int) sdrangel/sdrgui/mainwindow.cpp:2890
    #14 0x7f23600172c1 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>, QtPrivate::List<Workspace*, int>, void, void (MainWindow::*)(Workspace*, int)>::call(void (MainWindow::*)(Workspace*, int), MainWindow*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:152
    #15 0x7f2360012b8d in void QtPrivate::FunctionPointer<void (MainWindow::*)(Workspace*, int)>::call<QtPrivate::List<Workspace*, int>, void>(void (MainWindow::*)(Workspace*, int), MainWindow*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:185
    #16 0x7f2360010016 in QtPrivate::QSlotObject<void (MainWindow::*)(Workspace*, int), QtPrivate::List<Workspace*, int>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:418
    #17 0x7f235b3062b1  (/lib/x86_64-linux-gnu/libQt5Core.so.5+0x3062b1) (BuildId: ed2abb344a128279a866aa6c4a79f3fa5c87c59e)
    #18 0x7f235ffcc7fc in Workspace::addFeature(Workspace*, int) build-sdrangel-Desktop_qt5-Debug/sdrgui/sdrgui_autogen/DMHXEJ42XS/moc_workspace.cpp:393
    #19 0x7f23602f56f8 in Workspace::addFeatureEmitted(int) sdrangel/sdrgui/gui/workspace.cpp:413
    #20 0x7f236030d611 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<int>, void, void (Workspace::*)(int)>::call(void (Workspace::*)(int), Workspace*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:152
    #21 0x7f2360308bd9 in void QtPrivate::FunctionPointer<void (Workspace::*)(int)>::call<QtPrivate::List<int>, void>(void (Workspace::*)(int), Workspace*, void**) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:185
    #22 0x7f2360305cdc in QtPrivate::QSlotObject<void (Workspace::*)(int), QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:418
    #23 0x7f235b3062b1  (/lib/x86_64-linux-gnu/libQt5Core.so.5+0x3062b1) (BuildId: ed2abb344a128279a866aa6c4a79f3fa5c87c59e)
    #24 0x7f235ffba7cf in FeatureAddDialog::addFeature(int) build-sdrangel-Desktop_qt5-Debug/sdrgui/sdrgui_autogen/DMHXEJ42XS/moc_featureadddialog.cpp:141
    #25 0x7f23600c2d19 in FeatureAddDialog::apply(QAbstractButton*) sdrangel/sdrgui/gui/featureadddialog.cpp:53
    #26 0x7f235ffba366 in FeatureAddDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) build-sdrangel-Desktop_qt5-Debug/sdrgui/sdrgui_autogen/DMHXEJ42XS/moc_featureadddialog.cpp:82
    #27 0x7f235b305fcc  (/lib/x86_64-linux-gnu/libQt5Core.so.5+0x305fcc) (BuildId: ed2abb344a128279a866aa6c4a79f3fa5c87c59e)
    #28 0x7f235c1029b2 in QDialogButtonBox::clicked(QAbstractButton*) (/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x3029b2) (BuildId: dfefd27f084c0dd066215fc79825fceae604f481)
2024-05-19 19:44:45 +02:00
..
afc.cpp Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afc.h Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afcgui.cpp Fix memleaks found with AddressSanitizer/LeakSanitizer 2024-05-19 19:44:45 +02:00
afcgui.h Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afcgui.ui Massive UI revamping (v7): Fixed sizing of feature windows. Part of #1209 2022-04-24 19:34:48 +02:00
afcplugin.cpp Updated versions and changelogs 2024-04-14 11:41:00 +02:00
afcplugin.h Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afcreport.cpp Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afcreport.h Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afcsettings.cpp Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afcsettings.h Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afcwebapiadapter.cpp Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afcwebapiadapter.h Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
afcworker.cpp Remove unused includes and use more direct includes 2024-04-11 23:31:34 +02:00
afcworker.h Rewriting of copyright notices for plugins/features. Part of #1893 2023-11-18 13:12:18 +01:00
CMakeLists.txt Update CMakeLists.txt to support both Qt5 and Qt6. Add option ENABLE_QT6 2022-11-17 14:34:54 +00:00
readme.md AFC: added documentation 2020-10-27 22:34:39 +01:00

Automatic Frequency Control plugin

Introduction

This plugin makes the link between a frequency tracker and other channels in order to have them controlled by the frequency tracker. Thus it closes the loop to effectively make an automatic frequency control system.

Interface

File source channel plugin GUI

1: Start/Stop plugin

This button starts or stops the plugin

2: Update device sets lists

It updates the tracker device set and tracked device set combo boxes (3) and (4) respectively with the available device sets.

3: Tracker device set selection

The first frequency tracker in this device set will be used to control frequency. Thus only Rx device sets can be selected.

4: Tracked device set selection

All channels but frequency tracker(s) in this device set will have their offset frequency controlled by the frequency tracker selected with (3).

5: (Re)apply device sets selection

Use this button to force evaluation of selected device sets i.e. the first frequency tracker used for tracking and the tracked channels.

6: Automatic target frequency readjustment

When the frequency tracker drifts following the signal it is tracking its effective frequency will move accordingly. To avoid it going too far from a nominal frequency set by (7) the device or transverter frequency can be used to re-adjust the frequency tracker center frequency periodically.

7: Tracker target frequency

This is the nominal frequency of the signal being tracked. For example (as in the picture) when tracking the QO-100 center beacon this is 10489.750 MHz thus with the transverter shift set at -250 kHz this is 489.750 MHz (The actual downconverted Rx frequency is 739.750 MHz).

8: Use transverter shift to adjust target frequency

When unset the device center frequency is used and when set the device center frequency setting is unchanged and the transverter shift is adjusted.

You would use the transverter adjustment for QO-100 tracking for example thus the resulting IF frequency is unchanged maintaining the center beacon around 489.750 MHz.

The transverter shift can be adjusted down to the Hz but depending on the device actual steps such granularity may not be effectively achievable.

9: Target frequency tolerance

Frequency readjustment will actually take place only if the frequency tracker frequency moves further away than ± this value from the nominal frequency (7).

You should not choose a value that is too tight else the frequency tracker frequency will keep moving around the target frequency without stabilizing. In practice you may set a low value and trigger a single shot adjustment with the (11) button and once stabilized choose a value significantly higher than the offset from nominal that is obtained.

Please note that if the device frequency adjustment is used the steps are in kHz so multiples of the kHz should be used.

10. Target frequency readjustment period (seconds)

The target frequency readjustment is periodically activated and frequency change is effectively activated if the tracker frequency offset from nominal is larger than the tolerance (9).

Depending on how fast the frequency drift occurs you should set a value in combination with the frequency tolerance (9) so that the frequency is not readjusted too frequently.

11. Activate target frequency readjustment immediately

This forces target readjustment process described above immediately.

12. Target readjustement indicator

This indicator will flash briefly when the readjustment process takes place. Its color is green if the frequency is not changed and is red if frequency changes. The tooltip shows the last frequency difference that was calculated.