add network, commented, need to find space on the lcd for it

This commit is contained in:
Drath Vader
2025-10-24 15:13:29 +02:00
parent 58e8e80ad1
commit b8dcba8582

View File

@@ -33,6 +33,7 @@ struct Sensors {
double avg[3] = {0.0f};
sys::Memory ram;
sys::Memory home;
// sys::Network net;
sys::sysSensors sys;
cpu::cpuSensors cpu;
gpu::gpuSensors gpu;
@@ -77,6 +78,7 @@ void sensorsThread(std::stop_token st, Sensors* s) {
getloadavg(s->avg, 3);
sys::getRam(&s->ram);
sys::getDisk(&s->home, "/home/drath");
// sys::getNetwork(&s->net, "enp4s0f0");
sys::updateSensors(&s->sys);
cpu::update(&s->cpu);
gpu::update(&s->gpu);
@@ -132,7 +134,6 @@ void displayThread(std::stop_token st, Sensors* s) {
lcd.writeBuf(2, 0, pad(pNum(s->cpu.ptotal, 1) + "W", 8, true));
lcd.writeBuf(2, 5, pad(std::to_string(cpu_fan) + "R", 5)); // avg fan speed
lcd.writeBuf(2, 16, pad(pNum(s->hass_state) + "W", 4));
// lcd.writeBuf(2, 21, pad(std::to_string(s->gpu.fan_pwm) + "%", 4));
lcd.writeBuf(2, 26, pad(std::to_string(s->gpu.fan_speed) + "R", 5));
lcd.writeBuf(2, 31, pad(std::to_string(s->gpu.power_avg) + "/" + std::to_string(s->gpu.power_cap) + "W", 9));
@@ -165,8 +166,7 @@ int main(int argc, char* argv[]) {
/* what the fucking kind of code is this
this code below spins up display/sensors/homeassistant functions as threads and halts until sem::main is released in sighandler
then the program leaves the scope, but before that, it destroys the std::jthreads in the "threads" vector
this causes all threads to gracefully close and join back into main thread, so we can safely destroy pSensors without segfault
*/
this causes all threads to gracefully close and join back into main thread, so we can safely destroy pSensors without segfault */
{
std::vector<std::jthread> threads;