forked from GeorgeHahn-Lab651/sensei_mesh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Utilities for programming, get rid of ghost proximity values, more co…
…nfig support for channels other than 38, but that is still not working
- Loading branch information
Showing
16 changed files
with
122 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from argparse import ArgumentParser | ||
from aci import AciCommand | ||
from aci_serial import AciUart | ||
import time | ||
import sensei_cmd | ||
|
||
def configure_sensor(serial_device, sensor_id, serial_enabled, channel, sleep_enabled): | ||
aci = AciUart.AciUart(port=serial_device, baudrate=115200) | ||
# Wait for serial connection to be ready | ||
time.sleep(2) | ||
cmd = sensei_cmd.SetConfig(sensor_id, serial_enabled, channel, sleep_enabled) | ||
data = cmd.serialize() | ||
aci.write_aci_cmd(AciCommand.AciAppCommand(data=data,length=len(data)+1)) | ||
|
||
# Wait for flash to be written | ||
time.sleep(2) | ||
aci.write_aci_cmd(AciCommand.AciRadioReset()) | ||
|
||
aci.stop() | ||
|
||
if __name__ == '__main__': | ||
parser = ArgumentParser() | ||
parser.add_argument("-d", "--device", dest="device", required=True, help="Serial device, e.g. /dev/cu.usbserial-DO00C2G2") | ||
parser.add_argument('id', type=int, help='the id to assign this sensor') | ||
parser.add_argument('--no-sleeping', dest='sleep_enabled', action='store_false') | ||
parser.set_defaults(sleep_enabled=True) | ||
parser.add_argument('--no-serial', dest='serial_enabled', action='store_false') | ||
parser.set_defaults(serial_enabled=True) | ||
parser.add_argument('--channel', type=int, help='bluetooth channel of sensei network: should be 1-39 (one of 37,38,39 usually best)') | ||
parser.set_defaults(channel=38) | ||
options = parser.parse_args() | ||
configure_sensor(options.device, options.id, options.serial_enabled, options.channel, options.sleep_enabled) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import logging | ||
import IPython | ||
from argparse import ArgumentParser | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from argparse import ArgumentParser | ||
from aci import AciCommand | ||
from aci_serial import AciUart | ||
import time | ||
import sensei_cmd | ||
|
||
def listen(serial_device): | ||
aci = AciUart.AciUart(port=serial_device, baudrate=115200) | ||
# Wait for serial connection to be ready | ||
time.sleep(2) | ||
while True: | ||
try: | ||
print(aci.events_queue.popleft()) | ||
except IndexError: | ||
break | ||
|
||
if __name__ == '__main__': | ||
parser = ArgumentParser() | ||
parser.add_argument("-d", "--device", dest="device", required=True, help="Serial device, e.g. /dev/cu.usbserial-DO00C2G2") | ||
options = parser.parse_args() | ||
listen(options.device) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from argparse import ArgumentParser | ||
from aci import AciCommand | ||
from aci_serial import AciUart | ||
import time | ||
import sensei_cmd | ||
|
||
def set_time(serial_device): | ||
aci = AciUart.AciUart(port=serial_device, baudrate=115200) | ||
# Wait for serial connection to be ready | ||
time.sleep(2) | ||
cmd = sensei_cmd.SetTime() | ||
data = cmd.serialize() | ||
aci.write_aci_cmd(AciCommand.AciAppCommand(data=data,length=len(data)+1)) | ||
aci.stop() | ||
|
||
if __name__ == '__main__': | ||
parser = ArgumentParser() | ||
parser.add_argument("-d", "--device", dest="device", required=True, help="Serial device, e.g. /dev/cu.usbserial-DO00C2G2") | ||
options = parser.parse_args() | ||
set_time(options.device) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
CHANNEL=38 | ||
|
||
make || exit -1 | ||
|
||
(make install SERIAL_PORT=/dev/cu.usbserial-DN00D34P && ./pyaci/configure_sensor.py --channel $CHANNEL -d /dev/cu.usbserial-DN00D34P 1) & | ||
|
||
(make install SERIAL_PORT=/dev/cu.usbserial-DN00CSZ7 && ./pyaci/configure_sensor.py --channel $CHANNEL -d /dev/cu.usbserial-DN00CSZ7 2) & | ||
|
||
(make install SERIAL_PORT=/dev/cu.usbserial-DO00C2G2 && ./pyaci/configure_sensor.py --channel $CHANNEL --no-sleeping -d /dev/cu.usbserial-DO00C2G2 3) & | ||
|
||
wait | ||
|
||
./pyaci/set_time.py -d /dev/cu.usbserial-DO00C2G2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters