From 95357e2755041c6cede7ea52f8a06a577316559a Mon Sep 17 00:00:00 2001 From: Aang23 Date: Wed, 23 Feb 2022 12:00:34 +0100 Subject: [PATCH] Slim things down further in the UI --- src-interface/global.cpp | 15 --------------- src-interface/global.h | 6 ------ src-interface/main_ui.cpp | 6 +++--- src-interface/main_ui.h | 12 +----------- src-interface/processing.cpp | 4 ++-- src-ui/main.cpp | 13 ++++--------- 6 files changed, 10 insertions(+), 46 deletions(-) diff --git a/src-interface/global.cpp b/src-interface/global.cpp index 60220aaa8..6fe86de38 100644 --- a/src-interface/global.cpp +++ b/src-interface/global.cpp @@ -4,18 +4,3 @@ std::shared_ptr>> uiCallList; std::shared_ptr uiCallListMutex; ctpl::thread_pool processThreadPool(8); - -#ifdef BUILD_LIVE -std::vector> radio_devices; - -bool first_init = true; -void findRadioDevices() -{ - if (first_init) - { - initSDRs(); - first_init = false; - } - radio_devices = getAllDevices(); -} -#endif \ No newline at end of file diff --git a/src-interface/global.h b/src-interface/global.h index d1bf0b8a5..44c7bd8b5 100644 --- a/src-interface/global.h +++ b/src-interface/global.h @@ -7,9 +7,3 @@ extern std::shared_ptr>> uiCallLis extern std::shared_ptr uiCallListMutex; extern ctpl::thread_pool processThreadPool; - -#ifdef BUILD_LIVE -#include "sdr/sdr.h" -extern std::vector> radio_devices; -void findRadioDevices(); -#endif \ No newline at end of file diff --git a/src-interface/main_ui.cpp b/src-interface/main_ui.cpp index eb18b3434..a41477f36 100644 --- a/src-interface/main_ui.cpp +++ b/src-interface/main_ui.cpp @@ -14,17 +14,17 @@ //#include "projection/projection_menu.h" //#include "projection/overlay.h" -satdump_ui_status satdumpUiStatus = MAIN_MENU; +//satdump_ui_status satdumpUiStatus = MAIN_MENU; void initMainUI() { } -bool first = true; +bool isProcessing = false; void renderMainUI(int wwidth, int wheight) { - if (satdumpUiStatus == OFFLINE_PROCESSING) + if (isProcessing) { uiCallListMutex->lock(); float winheight = uiCallList->size() > 0 ? wheight / uiCallList->size() : wheight; diff --git a/src-interface/main_ui.h b/src-interface/main_ui.h index 819e249b0..40da47c3a 100644 --- a/src-interface/main_ui.h +++ b/src-interface/main_ui.h @@ -1,16 +1,6 @@ #pragma once -enum satdump_ui_status -{ - OFFLINE_PROCESSING, - LIVE_PROCESSING, - BASEBAND_RECORDER, - PROJECTION, - OVERLAY, - MAIN_MENU, -}; - -extern satdump_ui_status satdumpUiStatus; +extern bool isProcessing; void initMainUI(); void renderMainUI(int wwidth, int wheight); \ No newline at end of file diff --git a/src-interface/processing.cpp b/src-interface/processing.cpp index 403928c8f..c4fbb55db 100644 --- a/src-interface/processing.cpp +++ b/src-interface/processing.cpp @@ -16,7 +16,7 @@ namespace processing std::string output_file, nlohmann::json parameters) { - satdumpUiStatus = OFFLINE_PROCESSING; + isProcessing = true; logger->info("Starting processing pipeline " + downlink_pipeline + "..."); logger->debug("Input file (" + input_level + ") : " + input_file); @@ -34,6 +34,6 @@ namespace processing logger->critical("Pipeline " + downlink_pipeline + " does not exist!"); logger->info("Done! Goodbye"); - satdumpUiStatus = MAIN_MENU; + isProcessing = false; } } \ No newline at end of file diff --git a/src-ui/main.cpp b/src-ui/main.cpp index 90fd836e0..1ae733161 100644 --- a/src-ui/main.cpp +++ b/src-ui/main.cpp @@ -37,11 +37,6 @@ int main(int argc, char *argv[]) uiCallList = std::make_shared>>(); uiCallListMutex = std::make_shared(); -// Ignore SIGPIPE -#ifndef _WIN32 - signal(SIGPIPE, SIG_IGN); -#endif - initLogger(); if (argc < 6) // Check overall command @@ -51,8 +46,8 @@ int main(int argc, char *argv[]) logger->error(" --samplerate [baseband_samplerate] --baseband_format [f32/i16/i8/w8] --dc_block --iq_swap"); return 1; } - - satdumpUiStatus = OFFLINE_PROCESSING; + else + isProcessing = true; // Init SatDump initSatdump(); @@ -134,7 +129,7 @@ int main(int argc, char *argv[]) style::setDarkStyle((std::string)RESOURCES_PATH); } - if (satdumpUiStatus == OFFLINE_PROCESSING) + if (isProcessing) processThreadPool.push([&](int) { processing::process(downlink_pipeline, input_level, input_file, output_level, output_file, parameters); }); @@ -183,7 +178,7 @@ int main(int argc, char *argv[]) logger->info("UI Exit"); // If we're doing live processing, we want this to kill all threads quickly. Hence don't call destructors - if (satdumpUiStatus == OFFLINE_PROCESSING) + if (isProcessing) #ifdef __APPLE__ exit(0); #else