Skip to content

Commit

Permalink
wireless plug protocol almost done,I can control the devboard from we…
Browse files Browse the repository at this point in the history
…binterface..
  • Loading branch information
marco committed Nov 14, 2016
1 parent 60857eb commit 6cd9e03
Show file tree
Hide file tree
Showing 18 changed files with 552 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ void loop() {

}

else if ((millis()-sync_time)>500){ //every 5000 ms
else if ((millis()-sync_time)>2000){ //every 5000 ms


sync_time=millis();
Expand Down
3 changes: 3 additions & 0 deletions bug
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

se un nodo ha un solo oggetto allora la zona non ne mostra nessuno...


the zoneDict json is deleted sometimes..

se si disconnette l'arduino dalla seriale e poi si riconnette, onos non recupera la connessione seriale
Expand Down
28 changes: 26 additions & 2 deletions scripts_folder/Serial_connection_Handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self):
time.sleep(60)

if i >10:
if (searchForSerialCable!="null"):
if (searchForSerialCable=="null"):
print "error serial connection, no serial ports found"
self.working=0
return(-1)
Expand All @@ -57,7 +57,7 @@ def reconnectSerialPort():
time.sleep(60)

if i >10:
if (searchForSerialCable!="null"):
if (searchForSerialCable=="null"):
print "error serial reconnection, no serial ports found"
self.working=0
return(-1)
Expand Down Expand Up @@ -124,10 +124,34 @@ def searchForSerialCable(self,exluded_port):
if (dev.find("ttyUSB0")!=-1)and(dev!=exluded_port):
return(dev)

for dev in list_of_dev:
if (dev.find("ttyUSB1")!=-1)and(dev!=exluded_port):
return(dev)

for dev in list_of_dev:
if (dev.find("ttyUSB2")!=-1)and(dev!=exluded_port):
return(dev)

for dev in list_of_dev:
if (dev.find("ttyUSB3")!=-1)and(dev!=exluded_port):
return(dev)

for dev in list_of_dev:
if (dev.find("ttyACM0")!=-1)and(dev!=exluded_port):
return(dev)

for dev in list_of_dev:
if (dev.find("ttyACM1")!=-1)and(dev!=exluded_port):
return(dev)

for dev in list_of_dev:
if (dev.find("ttyACM2")!=-1)and(dev!=exluded_port):
return(dev)

for dev in list_of_dev:
if (dev.find("ttyACM3")!=-1)and(dev!=exluded_port):
return(dev)

for dev in list_of_dev:
if (dev.find("ttyS0")!=-1)and(dev!=exluded_port):
return(dev)
Expand Down
Binary file modified scripts_folder/Serial_connection_Handler.pyc
Binary file not shown.
11 changes: 7 additions & 4 deletions scripts_folder/arduinoserial.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def read_data(self): # thread function
# self.removeFromInBuffer=''
try:
byte = self.ser.read(1) # self.usbR.read(1)
print byte
# print byte
except:
byte=-1
self.status=0
Expand All @@ -240,7 +240,7 @@ def read_data(self): # thread function

if not byte: #nothing on incoming serial buffer
done=1
print "end of serial packet1"
# print "end of serial packet1"
#print "incoming buffer="+serial_incomingBuffer
time.sleep(0.3)
continue
Expand All @@ -261,7 +261,10 @@ def read_data(self): # thread function
# done=1
# print "end of serial packet2"
# continue

# print byte

if byte=="\x00":
continue

if (ord(byte)==10): # 10 is the value for new line (\n) end of packet on incoming serial buffer
done=1
Expand All @@ -278,7 +281,7 @@ def read_data(self): # thread function
continue


if len(buf)>2:
if len(buf)>3:
waitTowriteUntilIReceive=1
if ( (buf.find("[S_")!=-1)&(buf.find("_#]")!=-1) ): #there is a full onos command packet
done=1
Expand Down
Binary file modified scripts_folder/arduinoserial.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts_folder/config_files/cfg.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
},
"scenarios_enable": 1,
"timezone": "CET-1CEST,M3.5.0,M10.5.0/3"
}
}

0 comments on commit 6cd9e03

Please sign in to comment.