Subversion Repositories ALCASAR

Rev

Rev 2976 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2976 Rev 3037
Line 20... Line 20...
20
        $temp_max = null;
20
        $temp_max = null;
21
        if (!CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input', $temp, 1, 4096, false)) { // Not Banana Pi
21
        if (!CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input', $temp, 1, 4096, false)) { // Not Banana Pi
22
            CommonFunctions::rfts('/sys/class/thermal/thermal_zone0/temp', $temp, 1);
22
            CommonFunctions::rfts('/sys/class/thermal/thermal_zone0/temp', $temp, 1);
23
            CommonFunctions::rfts('/sys/class/thermal/thermal_zone0/trip_point_0_temp', $temp_max, 1, 4096, PSI_DEBUG);
23
            CommonFunctions::rfts('/sys/class/thermal/thermal_zone0/trip_point_0_temp', $temp_max, 1, 4096, PSI_DEBUG);
24
        }
24
        }
25
        if (!is_null($temp) && (($temp = trim($temp)) != "")) {
25
        if (($temp !== null) && (($temp = trim($temp)) != "")) {
26
            $dev = new SensorDevice();
26
            $dev = new SensorDevice();
27
            $dev->setName("CPU 1");
27
            $dev->setName("CPU 1");
28
            $dev->setValue($temp / 1000);
28
            $dev->setValue($temp / 1000);
29
            if (!is_null($temp_max) && (($temp_max = trim($temp_max)) != "") && ($temp_max > 0)) {
29
            if (($temp_max !== null) && (($temp_max = trim($temp_max)) != "") && ($temp_max > 0)) {
30
                $dev->setMax($temp_max / 1000);
30
                $dev->setMax($temp_max / 1000);
31
            }
31
            }
32
            $this->mbinfo->setMbTemp($dev);
32
            $this->mbinfo->setMbTemp($dev);
33
        }
33
        }
34
    }
34
    }
35
 
35
 
36
    private function _voltage()
36
    private function _voltage()
37
    {
37
    {
38
        $volt = null;
38
        $volt = null;
39
        if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/voltage_now', $volt, 1, 4096, false) && !is_null($volt) && (($volt = trim($volt)) != "")) { // Banana Pi
39
        if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/voltage_now', $volt, 1, 4096, false) && ($volt !== null) && (($volt = trim($volt)) != "")) { // Banana Pi
40
            $dev = new SensorDevice();
40
            $dev = new SensorDevice();
41
            $dev->setName("Voltage 1");
41
            $dev->setName("Voltage 1");
42
            $dev->setValue($volt / 1000000);
42
            $dev->setValue($volt / 1000000);
43
            $this->mbinfo->setMbVolt($dev);
43
            $this->mbinfo->setMbVolt($dev);
44
        }
44
        }
45
    }
45
    }
46
 
46
 
47
    private function _current()
47
    private function _current()
48
    {
48
    {
49
        $current = null;
49
        $current = null;
50
        if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now', $current, 1, 4096, false) && !is_null($current) && (($current = trim($current)) != "")) { // Banana Pi
50
        if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now', $current, 1, 4096, false) && ($current !== null) && (($current = trim($current)) != "")) { // Banana Pi
51
            $dev = new SensorDevice();
51
            $dev = new SensorDevice();
52
            $dev->setName("Current 1");
52
            $dev->setName("Current 1");
53
            $dev->setValue($current / 1000000);
53
            $dev->setValue($current / 1000000);
54
            $this->mbinfo->setMbCurrent($dev);
54
            $this->mbinfo->setMbCurrent($dev);
55
        }
55
        }