Skip to content
Snippets Groups Projects
Commit 27222d13 authored by Jan Cantaert's avatar Jan Cantaert
Browse files

TEMPer fixed

parent 9d0bd5ad
Branches FixTEMPer
No related tags found
1 merge request!8Fix TEMPer
Pipeline #3557 failed
...@@ -42,7 +42,7 @@ class CPUtemperature extends \App\AbstractSensor ...@@ -42,7 +42,7 @@ class CPUtemperature extends \App\AbstractSensor
. "<p>Maybe <code>sensors</code> is not installed.</p>" . "<p>Maybe <code>sensors</code> is not installed.</p>"
. "<p>You can install it with <code>sudo apt install lm-sensors</code></p>";} . "<p>You can install it with <code>sudo apt install lm-sensors</code></p>";}
$Cores = self::parseCPUtemperature($record['cpu-temperature']); $Cores = self::parseCPUtemperature($record['cpu-temperature']);
$CPUS=self::parseCPU($record['cpu-temperature']); $CPUS=self::parseCPU($record['cpu-temperature']);
$return = "<table class='table table-sm'>"; $return = "<table class='table table-sm'>";
$return .= "<tr><th>Name</th><th>Temperature (°C)</th><th>T°crit (°C)</th></tr>"; $return .= "<tr><th>Name</th><th>Temperature (°C)</th><th>T°crit (°C)</th></tr>";
foreach ($CPUS as $CPU) { foreach ($CPUS as $CPU) {
......
...@@ -20,9 +20,9 @@ class USBtemperature extends \App\AbstractSensor ...@@ -20,9 +20,9 @@ class USBtemperature extends \App\AbstractSensor
. "<p>Maybe <code>TEMPer</code> is not installed.</p>" . "<p>Maybe <code>TEMPer</code> is not installed.</p>"
. "<p>You can install it following the tutorial on the Gitlab repository</p>"; . "<p>You can install it following the tutorial on the Gitlab repository</p>";
} }
$temper = self::parse($record["TEMPer"]); $temper = self::parse($record['TEMPer']);
$return= "<p>Ambient temperature (USB TEMPer) : ".$temper->temp[1].".".$temper->temp[2]." °C "."</p>"; $return= "<p>Ambient temperature (USB TEMPer) : " . $temper->temp[1] . "." . $temper->temp[2] . " °C " . "</p>";
return $return;//$record['TEMPer']; return $return;
} }
public function status() public function status()
...@@ -31,16 +31,11 @@ class USBtemperature extends \App\AbstractSensor ...@@ -31,16 +31,11 @@ class USBtemperature extends \App\AbstractSensor
if ($record == null) { if ($record == null) {
return self::STATUS_UNKNOWN; return self::STATUS_UNKNOWN;
} }
//foreach (self::parse($record['TEMPer']) as $USBTemp) {
// /* @var $USBTemp Temper */
$status = self::STATUS_OK; $status = self::STATUS_OK;
/*
$USBTemp = self::parse($record['TEMPer']); $USBTemp = self::parse($record['TEMPer']);
if ((int)($USBTemp->temp[1]) > 75) { if ((int)($USBTemp->temp[1]) > 60) {
$status = self::STATUS_WARNING; $status = self::STATUS_WARNING;
} }
*/
return $status; return $status;
} }
......
...@@ -292,10 +292,10 @@ class ExampleTest extends TestCase ...@@ -292,10 +292,10 @@ class ExampleTest extends TestCase
$string = file_get_contents(__DIR__ . "/TEMPer"); $string = file_get_contents(__DIR__ . "/TEMPer");
$TEMPer = new USBtemperature(new Server()); $TEMPer = new USBtemperature(new Server());
$USBTemp = $TEMPer->parse($string); $USBTemp = $TEMPer->parse($string);
$this->assertEquals("0a", $USBTemp->part1); $this->assertEquals("09", $USBTemp->part1);
$this->assertEquals("6c", $USBTemp->part2); $this->assertEquals("47", $USBTemp->part2);
$this->assertEquals("26", $USBTemp->temp[1]); $this->assertEquals("23", $USBTemp->temp[1]);
$this->assertEquals("68", $USBTemp->temp[2]); $this->assertEquals("75", $USBTemp->temp[2]);
} }
/** /**
* @group multicpu * @group multicpu
......
Device /dev/hidraw4 : 413d:2107 interface 1 : (null) (null) Device /dev/hidraw1 : 413d:2107 interface 1 : (null) (null)
Writing data (9 bytes): Writing data (9 bytes):
00 01 80 33 01 00 00 00 00 00 01 80 33 01 00 00 00 00
Response from device (8 bytes): Response from device (8 bytes):
80 80 0a 6c 4e 20 00 00 80 80 09 47 4e 20 00 00
\ No newline at end of file \ No newline at end of file
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