From 95c19fa6008ec17cd4b14fc65db41348342a5673 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Tue, 6 Jul 2021 17:30:27 -0700 Subject: [PATCH] use python3, note how to run w/ FreeBSD, and code quality... python2 is incompatible w/ python3 code, and assuming that python is 3 is bad, so use python3 which ensures that the correct version will be run... --- README.md | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1cc4313..c49153b 100644 --- a/README.md +++ b/README.md @@ -196,9 +196,20 @@ file for the VCP that runs on the gateway. In my case, the device name is `/dev/cu.usbmodem1451` as I am on my MacBook Pro, so the command to launch the gateway is simply: ``` -python loraserv.py /dev/cu.usbmodem1451 +python3 loraserv.py /dev/cu.usbmodem1451 ``` +Note: On FreeBSD, the default open mode echos characters back to the +gateway causing it not to work. It is advised to setup the modem tty +via the command: +``` +stty -f /dev/cuaU0.init gfmt1:cflag=cb00:iflag=2e02:lflag=43:oflag=2:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:erase2=8:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=9600:ospeed=9600 +``` +before running the `loraserv.py` command. Replace `/dev/cuaU0.init` +with the respective device. The above was generated by running +`cu -l /dev/cuaU0` in one terminal, while obtaining the info via +`stty -g -f /dev/cuaU0` in another terminal. + Once that is running, then the `lora.py` program's multicast packets will be forwarded out via the LoRa radio. @@ -206,12 +217,12 @@ To test it, a simple `ping` command can be used, or turning on or off the on board LED via channel 4 using the `setunset` command. The ping command: ``` -python lora.py -s ping +python3 lora.py -s ping ``` To turn off the LED (which defaults to on): ``` -python lora.py -s setunset 4 0 +python3 lora.py -s setunset 4 0 ``` Either of these commands should exit w/o message or error. @@ -219,7 +230,7 @@ Either of these commands should exit w/o message or error. Multiple commands may be specified by separating them w/ `--` (two hyphens). For example: ``` -python lora.py -s -- setunset 4 0 -- setunset 1 1 +python3 lora.py -s -- setunset 4 0 -- setunset 1 1 ``` The first `--` is required to denote the end of option parsing, @@ -269,4 +280,14 @@ command. The available commands are: * `waitfor`: Wait for the specified time before advancing to the next enqueued command. +Notes +----- + +Significant portions of this code is copied from various reference +implementations. Basic review shows that it is of questionable quality. +It would be good to fully review all the code under stm32 and loramac +for any bugs and other issues. The buffer handling has already been +improved, but there is still plety of work that can be done to improve +it further. +