Commit b3090ef6 authored by Philippe Piatkiewitz's avatar Philippe Piatkiewitz
Browse files

New branch StatUSB

parent 55dc1d0d
......@@ -4,6 +4,7 @@ To update the repository on PiPy:
1. Tag the version in GIT:
```
git tag -a 1.3.4 -m "version 1.3.4"
git push origin --tags
```
2. Set the correct version tag in setup.py
3. build
......@@ -12,7 +13,7 @@ python3 ./setup.py sdist bdist_wheel
```
4. upload
```
python3 -m twine upload dist/motorcortex-python-tools-1.3.3.tar.gz --verbose
python3 -m twine upload dist/motorcortex-python-tools-1.3.4.tar.gz --verbose
```
......@@ -33,7 +34,7 @@ ON OTHER SYSTEMS (using PIP)
"cd motorcortex-python-tools/"
execute "python3 ./setup.py install"
For instructions:
mcx-datalogger --help
mcx-dataplot --help
......
......@@ -15,6 +15,7 @@ import json
# DEFAULTHOST = "192.168.2.100"
DEFAULTURL = "wss://192.168.2.100:5568:5567"
DEFAULT_STATUSB_PORT = "/dev/ttyACM0"
DEFAULTCERT="motorcortex.crt"
DEFAULTFREQDIV = 10
DEFAULTTRIGGERINTERVAL = 0.5
......@@ -67,6 +68,8 @@ def main():
parser.add_argument('--triggerop', help='Trigger operator; the operator that is used for comparison.', required=False, default="==", choices=['==','<','>','<=','>=','!='],)
parser.add_argument('-C', '--compress', help='Compress the traces on the fly using the LZMA algorithm. It creates files with the xz extension.', required=False, action='store_true')
parser.add_argument('--noparamdump', help='Do not dump parameters to file for each trace.', required=False, action='store_true')
parser.add_argument('--statusb', help='Send status information to statUSB RGB USB Led dongle (see ww.fit-iot.com)', required=False, action='store_true')
parser.add_argument('--statusbport', help='The port that the statUSB RGB USB Led dongle is connected to (see ww.fit-iot.com)', required=False, default=DEFAULT_STATUSB_PORT)
args = parser.parse_args()
INPUTFILE = args.parameterfile
......@@ -76,6 +79,15 @@ def main():
FOLDER=args.folder
OUTPUTFILE = createFileName(folder=FOLDER, filename=args.file, comment=comment)
if args.statusb:
import serial
statusLED = serial.Serial(args.statusbport, timeout=0.1)
statusLEDR = 0
statusLEDG = 0
statusLEDB = 0
command = "#%02x%02x%02x\n" % (statusLEDR, statusLEDG, statusLEDB)
statusLED.write(command.encode())
# HOST = args.host
TRIGGER = args.trigger
TRIGGERVAL = float(args.triggervalue)
......@@ -116,6 +128,7 @@ def main():
if (OP(logger.req.getParameter(TRIGGER).get().value[0],TRIGGERVAL)):
if not logger.working:
FILENAME = createFileName(folder=FOLDER, comment=comment)
logger.connected = logger.connect(args.url, args.certificate)
logger.openFileAndWriteHeader(FILENAME, compress = args.compress)
logger.start()
logger.writeParameters(FILENAME + ".params")
......@@ -137,11 +150,33 @@ def main():
print("Press CTRL-BREAK (CTRL-C) to finish logging ...")
while True:
try:
time.sleep(2)
if args.statusb:
print(logger.working)
if logger.working:
statusLEDR = 0
statusLEDB = 0
statusLEDG += 255
if statusLEDB > 255:
statusLEDB = 0
command = "#%02x%02x%02x\n" % (statusLEDR, statusLEDG, statusLEDB)
statusLED.write(command.encode())
else:
statusLEDR = 255
statusLEDG = 0
statusLEDB = 0
command = "#%02x%02x%02x\n" % (statusLEDR, statusLEDG, statusLEDB)
statusLED.write(command.encode())
time.sleep(1)
except KeyboardInterrupt:
break
except (BlockingIOError, InterruptedError):
pass
except:
break
if args.statusb:
command = "#000000\n"
statusLED.write(command.encode())
statusLED.close()
logger.stop()
logger.close()
......
[{"path":"root/Control/dummyBool","value":0},{"path":"root/Control/dummyDouble","value":0}]
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment