Skip to content

Commit

Permalink
added delay after serial write to improve stability
Browse files Browse the repository at this point in the history
  • Loading branch information
marco committed Sep 26, 2016
1 parent f1e77f2 commit 4f472f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion arduino_code/onos_rf69_serial_transponder.ino
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ void decodeOnosCmd(const char *received_message){

else if( received_message_type_of_onos_cmd[0]=='s' && received_message_type_of_onos_cmd[1]=='a' ){
first_sync=0; //this node has made the first sync with the onoscenter
strcpy(received_message_answer,"ok");
return;
}

/*
Expand Down Expand Up @@ -554,7 +556,7 @@ void loop()
sync:

if (first_sync==1){
delay(500);
delay(1000);
composeSyncMessage();
makeSyncMessage();

Expand Down
2 changes: 1 addition & 1 deletion scp
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ scp -rC root@192.168.1.4:/bin/onos/* /tmp/ram/

scp -r $(ls | grep -v -e docs -e arduino_code -e online_db -e tests ) root@192.168.1.2:/tmp/onos/

scp -r $(ls | grep -v -e docs -e arduino_code -e online_db -e tests ) root@192.168.1.4:/bin/onos/
scp -r $(ls | grep -v -e docs -e arduino_code -e online_db -e tests ) root@192.168.1.2:/bin/onos/

5 changes: 3 additions & 2 deletions scripts_folder/arduinoserial.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def read_data(self): # thread function
try:
self.ser.write(data_to_write)
print "i write data_to_write::::::::::::::::::::::::::::::::::::::::::"+data_to_write
time.sleep(0.02)
write_enable=0
except Exception, e :
print "can't write to uart"+str(e.args)
Expand Down Expand Up @@ -265,7 +266,7 @@ def read_data(self): # thread function
if (ord(byte)==10): # 10 is the value for new line (\n) end of packet on incoming serial buffer
done=1
print "end of serial packet for /n"
continue
break
else:
#print "in byte="+byte+" end of in byte"
buf=buf+byte
Expand All @@ -282,7 +283,7 @@ def read_data(self): # thread function
if ( (buf.find("[S_")!=-1)&(buf.find("_#]")!=-1) ): #there is a full onos command packet
done=1
print "end of serial packet:_#] "
continue
break



Expand Down

0 comments on commit 4f472f9

Please sign in to comment.