diff --git a/ai_omniscope-v2-communication_sw b/ai_omniscope-v2-communication_sw index 960e50fa..9f392cb9 160000 --- a/ai_omniscope-v2-communication_sw +++ b/ai_omniscope-v2-communication_sw @@ -1 +1 @@ -Subproject commit 960e50fad868c4ab2bf27c152a45781e2cbcdc19 +Subproject commit 9f392cb9ccc5798994397c2c54ea67cd47616d2d diff --git a/src/main.cpp b/src/main.cpp index a10051c9..17fff33c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,18 +8,19 @@ int main() { set_config(configpath); nlohmann::json config = load_json_file(configpath); set_json(config); - set_inital_config(config); nlohmann::json language = load_json_file(load_json(config, "languagepath") + load_json(config, "language") + ".json"); // local variables bool flagPaused{true}, development{false}, open_generate_training_data{false}, open_settings{false}; + std::once_flag flag; auto loadedFiles = captureData; std::map loadedFilenames; // main loop auto render = [&]() { + std::call_once(flag, set_inital_config, std::ref(config)); SetupImGuiStyle(false, 0.99f); ImGui::SetNextWindowPos({0.f, 0.f}); auto windowSize{ImGui::GetIO().DisplaySize}; @@ -88,31 +89,29 @@ int main() { // Check if time base for axes are same // check if egu and timescale for plot are same // error if third device is added - addPlots( - "Recording the data", - [&flagPaused](double x_max, std::string yLabel, ImAxis_ axis, - double yMin, double yMax) { - ImPlot::SetupLegend(ImPlotLocation_NorthEast, - ImPlotLegendFlags_Outside); - // auto auxFlagsMeasuring = - // ImPlotAxisFlags_AutoFit | ImPlotAxisFlags_NoGridLines; - // auto auxFlagsPaused = ImPlotAxisFlags_NoGridLines; - ImPlot::SetupAxisTicks(ImAxis_Y1, -10, 200, 22, nullptr, true); + addPlots("Recording the data", [&flagPaused]( + double x_max, std::string yLabel, + ImAxis_ axis, double yMin, double yMax) { + ImPlot::SetupLegend(ImPlotLocation_NorthEast, ImPlotLegendFlags_Outside); + // auto auxFlagsMeasuring = + // ImPlotAxisFlags_AutoFit | ImPlotAxisFlags_NoGridLines; + // auto auxFlagsPaused = ImPlotAxisFlags_NoGridLines; + ImPlot::SetupAxisTicks(ImAxis_Y1, -10, 200, 22, nullptr, true); - if (!flagPaused) { - ImPlot::SetupAxis(axis, yLabel.c_str(), ImPlotAxisFlags_AutoFit); - ImPlot::SetupAxis(ImAxis_X1, "time [s]", ImPlotAxisFlags_AutoFit); - ImPlot::SetupAxisLimits(axis, yMin - 2, yMax + 2, ImGuiCond_Always); - ImPlot::SetupAxisLimits(ImAxis_X1, x_max - 1, x_max + 9, - ImGuiCond_Always); + if (!flagPaused) { + ImPlot::SetupAxis(axis, yLabel.c_str(), ImPlotAxisFlags_AutoFit); + ImPlot::SetupAxis(ImAxis_X1, "time [s]", ImPlotAxisFlags_AutoFit); + ImPlot::SetupAxisLimits(axis, yMin - 2, yMax + 2, ImGuiCond_Always); + ImPlot::SetupAxisLimits(ImAxis_X1, x_max - 1, x_max + 9, + ImGuiCond_Always); - } else { - ImPlot::SetupAxis(ImAxis_X1, "time [s]"); - ImPlot::SetupAxis(axis, yLabel.c_str()); - ImPlot::SetupAxisLimits(ImAxis_X1, 0, 10); - ImPlot::SetupAxisLimits(axis, yMin - 2, yMax + 2); - } - }); + } else { + ImPlot::SetupAxis(ImAxis_X1, "time [s]"); + ImPlot::SetupAxis(axis, yLabel.c_str()); + ImPlot::SetupAxisLimits(ImAxis_X1, 0, 10); + ImPlot::SetupAxisLimits(axis, yMin - 2, yMax + 2); + } + }); ImGui::EndChild(); // end child Record Data ImGui::PopStyleVar(); PopPlotRegionColors();