Skip to content

Commit

Permalink
Add sys_info package
Browse files Browse the repository at this point in the history
  • Loading branch information
Chi-EEE committed Jan 6, 2024
1 parent 40016e4 commit e9f59e6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
20 changes: 20 additions & 0 deletions app/raspberry_pi/repository/packages/s/sys_info/xmake.lua
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 3 additions & 1 deletion app/raspberry_pi/src/car/display/CarConsole.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <ftxui/dom/elements.hpp>
#include <ftxui/component/loop.hpp> // ftxui::Loop

#include <sys_info/ProcessInfo.h>

#include "../system/CarSystem.h"

using namespace car::system;
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down
10 changes: 7 additions & 3 deletions app/raspberry_pi/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit e9f59e6

Please sign in to comment.