Skip to content

Commit 152ea7c

Browse files
committed
Fixed error on class at open port
1 parent 4b4a0a5 commit 152ea7c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: class/Periphery.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ class Serial {
1616
public $xonxoff;
1717
public $rtscts;
1818

19-
private function _testRange($v, $va, $vb)
19+
private function testRange($v, $va, $vb)
2020
{
2121
if (($v >= $va) && ($v <= $vb)) return TRUE;
2222
else return FALSE;
2323
}
2424

25-
private function _testArray($v, $r)
25+
private function testArray($v, $r)
2626
{
2727
foreach($r as $b) {
28-
if ($r == $v)
28+
if ($b == $v)
2929
return TRUE;
3030
}
3131
return FALSE;
@@ -41,20 +41,20 @@ public function __construct()
4141
public function open($device, $baudrate = 9600, $databits = 8, $parity = "none", $stopbits = 1, $xonxoff = 0, $rtscts = 0)
4242
{
4343
$bd_ref = array(50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000);
44-
if (!empty($device)) {
44+
if (empty($device)) {
4545
$this->device = NULL;
4646
return FALSE;
4747
} else {
4848
$this->device = $device;
4949
}
50-
if ($this->_testArray($baudrate, $br_ref) == TRUE)
50+
if ($this->testArray($baudrate, $bd_ref) == TRUE)
5151
{
5252
$this->baudrate = $baudrate;
5353
} else {
5454
$this->baudrate = NULL;
5555
return FALSE;
5656
}
57-
if ($this->_testRange($databits, 5, 8) == TRUE)
57+
if ($this->testRange($databits, 5, 8) == TRUE)
5858
{
5959
$this->databits = $databits;
6060
} else {
@@ -68,21 +68,21 @@ public function open($device, $baudrate = 9600, $databits = 8, $parity = "none",
6868
$this->parity = NULL;
6969
return FALSE;
7070
}
71-
if (_testRange($stopbits, 1, 2) == TRUE)
71+
if ($this->testRange($stopbits, 1, 2) == TRUE)
7272
{
7373
$this->stopbits = $stopbits;
7474
} else {
7575
$this->stopbits = NULL;
7676
return FALSE;
7777
}
78-
if ($this->_testRange($xonxoff, 0, 1) == TRUE)
78+
if ($this->testRange($xonxoff, 0, 1) == TRUE)
7979
{
8080
$this->xonoff = $xonxoff;
8181
} else {
8282
$this->xonoff = NULL;
8383
return FALSE;
8484
}
85-
if ($this->_testRange($rtscts, 0, 1) == TRUE)
85+
if ($this->testRange($rtscts, 0, 1) == TRUE)
8686
{
8787
$this->rtscts = $rtscts;
8888
} else {

0 commit comments

Comments
 (0)