Skip to content
Snippets Groups Projects
Verified Commit a41d07f7 authored by Thomas Flori's avatar Thomas Flori
Browse files

update hugga and log when fans go over 30% speed

parent f060d3f1
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ use Hugga\Console;
class Daemon extends AbstractCommand
{
const PID_PATH = '/run/fan-ctrl.pid';
const UPDATE_INTERVAL = 500_000; // in micro seconds
protected $name = 'daemon';
......@@ -48,13 +49,15 @@ class Daemon extends AbstractCommand
// prepare
$rules = $fanConfig->getRules();
$this->console->setLogger($this->app->logger);
$this->info('Fan Control started');
// main loop
while (true) {
foreach ($rules as $rule) {
$rule->apply($this->console);
}
sleep(1);
usleep(self::UPDATE_INTERVAL);
}
}
}
......@@ -84,7 +84,7 @@ class CurveRule extends Rule
$percentage,
$lastPercentage,
$lastPercentage
), Console::WEIGHT_DEBUG);
), $speed > 30 ? Console::WEIGHT_LOW : Console::WEIGHT_DEBUG);
$this->setSpeed($speed);
}
break;
......
......@@ -3,7 +3,7 @@
"bin": ["bin/fan-ctrl"],
"require": {
"tflori/riki-framework": "dev-master",
"tflori/hugga": "^1.1",
"tflori/hugga": "^1.2",
"ulrichsg/getopt-php": "^4.0",
"filp/whoops": "^2.14",
"monolog/monolog": "^1.9",
......
......@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "cddd1ddd64b18141de6444950d1076f4",
"content-hash": "dc0a733546b0eca25d08dbfda7ed570c",
"packages": [
{
"name": "filp/whoops",
"version": "2.14.6",
"version": "2.15.2",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "f7948baaa0330277c729714910336383286305da"
"reference": "aac9304c5ed61bf7b1b7a6064bf9806ab842ce73"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/f7948baaa0330277c729714910336383286305da",
"reference": "f7948baaa0330277c729714910336383286305da",
"url": "https://api.github.com/repos/filp/whoops/zipball/aac9304c5ed61bf7b1b7a6064bf9806ab842ce73",
"reference": "aac9304c5ed61bf7b1b7a6064bf9806ab842ce73",
"shasum": ""
},
"require": {
......@@ -67,7 +67,7 @@
],
"support": {
"issues": "https://github.com/filp/whoops/issues",
"source": "https://github.com/filp/whoops/tree/2.14.6"
"source": "https://github.com/filp/whoops/tree/2.15.2"
},
"funding": [
{
......@@ -75,7 +75,7 @@
"type": "github"
}
],
"time": "2022-11-02T16:23:29+00:00"
"time": "2023-04-12T12:00:00+00:00"
},
{
"name": "monolog/monolog",
......@@ -456,16 +456,16 @@
},
{
"name": "tflori/hugga",
"version": "v1.1.0",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/tflori/hugga.git",
"reference": "204f03ccf04a5381a117dc6025364f74a70923d9"
"reference": "ece10d4e60d7208318bd14d7146d2fc3151ba7da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tflori/hugga/zipball/204f03ccf04a5381a117dc6025364f74a70923d9",
"reference": "204f03ccf04a5381a117dc6025364f74a70923d9",
"url": "https://api.github.com/repos/tflori/hugga/zipball/ece10d4e60d7208318bd14d7146d2fc3151ba7da",
"reference": "ece10d4e60d7208318bd14d7146d2fc3151ba7da",
"shasum": ""
},
"require": {
......@@ -497,9 +497,9 @@
"description": "library for console applications with input and output handling",
"support": {
"issues": "https://github.com/tflori/hugga/issues",
"source": "https://github.com/tflori/hugga/tree/v1.1.0"
"source": "https://github.com/tflori/hugga/tree/v1.2.0"
},
"time": "2022-03-18T16:46:56+00:00"
"time": "2023-06-01T20:11:36+00:00"
},
{
"name": "tflori/riki-framework",
......@@ -612,6 +612,7 @@
"prefer-lowest": false,
"platform": {
"ext-pcntl": "*",
"ext-posix": "*",
"php": ">=7.4"
},
"platform-dev": [],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment