Skip to content

Commit 547a4cf

Browse files
author
Igor Anokhin
committed
python: RCInput: add Navio+ support
Add check channel number Add Navio+ entry and auto choice shield
1 parent b64278b commit 547a4cf

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

Python/RCInput.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
1-
import sys, time
1+
import time
22

3-
import navio.rcinput
4-
import navio.util
3+
import navio.Common.util
54

6-
navio.util.check_apm()
5+
import navio.Navio2.RCInput
6+
import navio.Navio.RCInput
77

8-
rcin = navio.rcinput.RCInput()
8+
READ_ERROR = -1
99

10+
def get_rcin():
11+
if navio.Common.util.get_navio_version() == "NAVIO2":
12+
13+
return navio.Navio2.RCInput()
14+
else:
15+
return navio.Navio.RCInput()
16+
17+
18+
navio.Common.util.check_apm()
19+
20+
rcin = get_rcin()
1021
while (True):
1122
period = rcin.read(2)
12-
print period
13-
time.sleep(1)
23+
if (period != READ_ERROR):
24+
print period
25+
time.sleep(1)
26+
else:
27+
exit(READ_ERROR)
28+

0 commit comments

Comments
 (0)