have disks have its own struct

This commit is contained in:
Drath
2025-10-29 18:37:53 +01:00
parent 25cee5f669
commit 0ba09a57e4
3 changed files with 15 additions and 10 deletions

View File

@@ -32,7 +32,7 @@ struct Sensors {
sys::TimeDate td;
double avg[3] = {0.0f};
sys::Memory ram;
sys::Memory home;
sys::Disk home;
// sys::Network net;
sys::sysSensors sys;
cpu::cpuSensors cpu;
@@ -68,6 +68,7 @@ void sensorsThread(std::stop_token st, Sensors* s) {
cpu::detectHwmon(&s->cpu, "0000:00:18.3");
gpu::detectHwmon(&s->gpu, "0000:0b:00.0");
sys::detectHwmon(&s->sys, "nct6775.656");
s->home.mountpoint = "/home/drath";
while (!st.stop_requested()) {
auto start = std::chrono::steady_clock::now();
@@ -77,7 +78,7 @@ void sensorsThread(std::stop_token st, Sensors* s) {
sys::getTimeDate(&s->td);
getloadavg(s->avg, 3);
sys::getRam(&s->ram);
sys::getDisk(&s->home, "/home/drath");
sys::getDisk(&s->home);
// sys::getNetwork(&s->net, "enp4s0f0");
sys::updateSensors(&s->sys);
cpu::update(&s->cpu);
@@ -145,7 +146,7 @@ void displayThread(std::stop_token st, Sensors* s) {
lcd.writeBuf(3, 0, pad(pNum(s->cpu.vcore, 2) + "V", 7, true));
lcd.writeBuf(3, 6, std::to_string(s->cpu.avg_freq) + "MHz");
lcd.writeBuf(3, 14, lcd.cc(2) + pad(pBytes(s->home.free), 5));
lcd.writeBuf(3, 14, lcd.cc(2) + pad(pBytes(s->home.usage.free), 5));
lcd.writeBuf(3, 21, pad(std::to_string(s->gpu.clock_core) + "/" + std::to_string(s->gpu.clock_mem) + "MHz ", 13));
lcd.writeBuf(3, 34, pad(pNum(s->gpu.vcore, 3) + "V", 5));
}