diff options
author | Roland Reichwein <mail@reichwein.it> | 2025-01-11 11:43:58 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2025-01-11 11:43:58 +0100 |
commit | 171aa5502cfcac1abc5315c8792521790195e4a9 (patch) | |
tree | 4c8e944938501ba2ef3d0a7e0d5980d07b588221 /Temperature.cpp | |
parent | 3c7b85d8355c64dec5b4ce011753196d53774103 (diff) |
Add notes and temperature monitor
Diffstat (limited to 'Temperature.cpp')
-rw-r--r-- | Temperature.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Temperature.cpp b/Temperature.cpp new file mode 100644 index 0000000..dece26a --- /dev/null +++ b/Temperature.cpp @@ -0,0 +1,22 @@ +#include "Temperature.h" + +#include <libreichwein/file.h> + +#include <filesystem> + +namespace fs = std::filesystem; + +namespace { + // e.g. 46000 for 46C + fs::path temp_path{"/sys/class/thermal/thermal_zone0/temp"}; +} + +Temperature::Temperature() +{ +} + +int Temperature::read_degree() const +{ + std::string contents {Reichwein::File::getFile(temp_path)}; + return std::stoul(contents) / 1000; +} |