From 37a0b9060f109052cf6e6d5564c681c6f6ade5f6 Mon Sep 17 00:00:00 2001 From: marcel Date: Thu, 10 Feb 2022 16:14:34 +0100 Subject: [PATCH] Added crc header to LoRa frame. --- CHANGELOG.md | 9 +++++++++ LoraAprsKissTnc.py | 24 +++++++++++++++++------- README.md | 2 -- RPi-LoRa-KISS-TNC.ini | 16 ++++++++++++++-- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d019a0..34a1b9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,3 +27,12 @@ All notable changes to this project will be documented in this file. ### Added - Support for 20dBm output power. Temporarily hard coded in source, but in next version it should be configurable via the configuration file. + +## [0.0.3] - 2022-02-10 + +### Changed +- 20dBm output power can now be selected from configuration file instead of being hard coded in program. +- Enabled CRC in header of LoRa frames. Now frames are crc-checked at the receiving side. + +### Removed +- Config.py as configuration is now completely removed. Configuration is now done completely via RPi-LoRa-KISS-TNC.ini diff --git a/LoraAprsKissTnc.py b/LoraAprsKissTnc.py index 23c85ae..80c5e07 100644 --- a/LoraAprsKissTnc.py +++ b/LoraAprsKissTnc.py @@ -94,13 +94,23 @@ class LoraAprsKissTnc(LoRa): self.set_coding_rate(codingrate) - # Current limiter 180mA for +20dBm (100mA for 17dBm max) - self.set_ocp_trim(180) - - self.set_pa_config(paSelect, MaxoutputPower, outputPower) - - # Set PA to +20dBm - self.set_pa_dac(1) + if outputPower == 20: + # Current limiter 180mA for +20dBm + self.set_ocp_trim(180) + + # Set PA to +20dBm + self.set_pa_config(1, 15, 15) + self.set_pa_dac(1) + #print("+20dBm") + else: + # Current limiter 100mA for 17dBm max + self.set_ocp_trim(100) + + self.set_pa_config(paSelect, MaxoutputPower, outputPower) + #print("max. +17dBm") + + # CRC on + self.set_rx_crc(1) self.set_max_payload_length(255) self.set_dio_mapping([0] * 6) diff --git a/README.md b/README.md index 87276af..6beaebd 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,4 @@ The software controls the LoRa transceiver connected to the Raspberry´s SPI bus I also designed my own (open source) hardware for it: a board holding a Raspberry Pi Zero 2 W, an SX1278 LoRa transceiver and a power supply with on/off button to safely switch on and off the system. The design files can be found on my website: [RPi LoRa_shield](https://meezenest.nl/mees/RPi_LoRa_shield.html) ### To Do -* The program (or the LoRa module) still crashes occasionally. After restarting the program (kissattach/socat/RPi-LoRa-KISS-TNC.py) it all works again. Need to investigate. -* Completely remove config.py in favour of RPi-LoRa-KISS-TNC.ini * Add raw TCP KISS socket for true AX.25 over KISS diff --git a/RPi-LoRa-KISS-TNC.ini b/RPi-LoRa-KISS-TNC.ini index e8e05dd..35c50da 100644 --- a/RPi-LoRa-KISS-TNC.ini +++ b/RPi-LoRa-KISS-TNC.ini @@ -22,12 +22,24 @@ bandwidth=BW125 # CR4_8 codingrate=CR4_5 appendSignalReport=False -paSelect = 1 +# paSelect only tested at 1 +paSelect=1 +# MaxoutputPower only tested at 15 MaxoutputPower = 15 -outputPower = 15 +# 0 ... 15 => +2 ... +17dBm +# 20 = +20dBm +outputPower = 20 [KISS] # Settings for KISS TCP_HOST=0.0.0.0 TCP_PORT_AX25=10001 TCP_PORT_RAW =10002 + +[AXUDP] +# settings for AXUDP +AXUDP_REMOTE_IP=192.168.0.185 +AXUDP_REMOTE_PORT=20000 +AXUDP_LOCAL_IP=0.0.0.0 +AXUDP_LOCAL_PORT=20000 +USE_AXUDP=False