From e9f59e6530c243135f540d2a2aa5b9e487559b78 Mon Sep 17 00:00:00 2001 From: Chi Huu Huynh <73843190+Chi-EEE@users.noreply.github.com> Date: Sat, 6 Jan 2024 19:37:01 +0000 Subject: [PATCH] Add sys_info package --- .../repository/packages/s/sys_info/xmake.lua | 20 +++++++++++++++++++ .../src/car/display/CarConsole.cxx | 4 +++- app/raspberry_pi/xmake.lua | 10 +++++++--- 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 app/raspberry_pi/repository/packages/s/sys_info/xmake.lua diff --git a/app/raspberry_pi/repository/packages/s/sys_info/xmake.lua b/app/raspberry_pi/repository/packages/s/sys_info/xmake.lua new file mode 100644 index 00000000..c76b28a8 --- /dev/null +++ b/app/raspberry_pi/repository/packages/s/sys_info/xmake.lua @@ -0,0 +1,20 @@ +package("sys_info") + set_homepage("https://github.com/Chi-EEE/sys_info") + set_description("c++ crossplatform cpu and memory usage info by current process") + + add_urls("https://github.com/Chi-EEE/sys_info.git") + add_versions("2024.01.06", "1e8dd0275ecf9a94473a0933f746cb5c873afd96") + + on_install(function (package) + local configs = {} + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include "sys_info/ProcessInfo.h" + void test () { + sys_info::ProcessInfo::GetInstance().GetCpuUsage(); + } + ]]}, {configs = {languages = "c++11"}})) + end) diff --git a/app/raspberry_pi/src/car/display/CarConsole.cxx b/app/raspberry_pi/src/car/display/CarConsole.cxx index f9dd3b4a..9fc3fce5 100644 --- a/app/raspberry_pi/src/car/display/CarConsole.cxx +++ b/app/raspberry_pi/src/car/display/CarConsole.cxx @@ -10,6 +10,8 @@ #include #include // ftxui::Loop +#include + #include "../system/CarSystem.h" using namespace car::system; @@ -79,7 +81,6 @@ namespace car::display { if (debounce) return; debounce = true; button_pressed = !button_pressed; - std::cout << "Button pressed: " << button_pressed << std::endl; if (button_pressed) { main_button_text = "Connecting..."; this->car_system->start(); @@ -92,6 +93,7 @@ namespace car::display { } debounce = false; }; + auto main_button = Button(&main_button_text, main_button_lambda, animated_button_style); auto exit = screen.ExitLoopClosure(); diff --git a/app/raspberry_pi/xmake.lua b/app/raspberry_pi/xmake.lua index cbd68ab6..b91dd2cf 100644 --- a/app/raspberry_pi/xmake.lua +++ b/app/raspberry_pi/xmake.lua @@ -15,7 +15,8 @@ add_requires("nlohmann_json") add_requires("spdlog") add_requires("fmt") -add_requires("imath") +-- Get System Info +add_requires("sys_info") if is_plat("linux", "macosx") then -- For the SunFounder Car @@ -32,12 +33,15 @@ target("raspberry_pi") set_kind("binary") set_license("LGPL-2.1") + add_packages("nlohmann_json") add_packages("spdlog") add_packages("fmt") - add_packages("nlohmann_json") - add_packages("imath") + add_packages("tl_expected") + -- Get System Info + add_packages("sys_info") + -- Messaging System add_packages("ixwebsocket") add_packages("nod")