Skip to content

Commit

Permalink
legacy validation bugfix / new relay feature
Browse files Browse the repository at this point in the history
  • Loading branch information
roema committed Feb 6, 2022
1 parent dab61f8 commit 7bbea4e
Show file tree
Hide file tree
Showing 15 changed files with 459 additions and 244 deletions.
72 changes: 58 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ There are also a few drawbacks to the traditional OGN receivers. Several protoco
## Harwdare
* LILYGO TTGO T-Beam (Lora, GPS, Bluetooth, Wifi, OLED)
* [TTGO T-Beam Aliexpress](https://s.click.aliexpress.com/e/_dTnxWSv)
* TTGO LoRa32 (**TESTING** - Lora, Bluetooth, Wifi, OLED)
* TTGO LoRa32 (Lora, Bluetooth, Wifi, OLED)

## Features:
* Power consumption around 20 mA in sleep mode - 120mA on normal mode
* 40 - 60 mA without GPS
* OLED status messages
* ntp time sync - no gps needed
* Deep Sleep
* Deep Sleep (only TTGO)
* Auto wakeup on RX packages
* Wakeup Timer
* No additional computer necessary - only Wifi ;
* Ideal for solar and battery supply
* low cost hardware
* Frequency hopping in legacy mode and ogn (868.2 / 868.4) - Thanks Nick
* needs GPS fix
* Relay function - send data over air to basestation (2 TTGO/TBEAM needed)
* Private mode - encrypt FANET data with you own key
* modified SoftRF needed

## Planed Features
* Protocol hopping - aprs messages are sent every 5 seconds - **in progress**
Expand Down Expand Up @@ -59,7 +62,9 @@ NBP can also be encrypted. V0.1.0-25

### Packet validation in LEGACY mode V0.1.0-24

It is possible that a legacy packet is marked as valid by the crc check, although it is damaged. This can result in position jumps. A new validation routine was built in, which checks whether a position package can be valid based on the speed of the aircraft.
It is possible that a legacy packet is marked as valid by the crc check, although it is damaged. This can result in position jumps. A new validation routine was built in, which checks whether a position package can be valid based on the speed and position of the aircraft.

ESP will calculate the flight distance from last two position packets and check if its possible with time and speed. Minimum two packets must be received and validated, otherwise position data not transmitted to ogn.

### Private network - V0.1.0-25

Expand All @@ -71,27 +76,63 @@ RF position packets AES128 encrypted

**Precise instructions and a modified SoftRF version will follow.**

### Relay function - V0.1.0-28

If no internet connection is available, send received data to ogn base, base will transmit packets to ogn.
* relay protocol based on fanet
* 2 devices needed - 1 Relay - 1 Basestation (Base with internet access)
* line of sight from Relay to Base

```json
"ognrelay":{
"enable":1,
"basestation":0
},
```
* enable
* Set to 1 for relay station
* basestation
* set to 1 for basestation (connected to ogn)

**If enable set to 1, basesation will be automatically deactivated. If you want to run base, set enable to 0 and basesation to 1.**

Relay will receive position data and send this every 2.5 seconds to basestation (on different frequency). Basestation will listen only on relay frequency and transmit packets via APRS to ogn. So you can create network with one basesation and many relays spread over different hills. In ogn you will only see the basesation.

The protocol for relay connection are the same as configured on relay. If you receive legacy, relay will send legacy packets to base, only on different frequency.

**In relay mode gps (if set static position) and Wifi will be disabled after 5 minutes.**


## Known bugs / Missing features
* SNR calculation not correct
* No RAM and CPU data in APRS status messages
* no GPS signal quality data in APRS messages
* no turn rate in APRS messages (always zero)
* disable sleep mode if everyone is connected to webserver
* **DEEPSLEEP_RESET gets stuck after a few resets - arduino-esp32 #796**
* works only with TTGO without problems
* and a lot more...


## If you find a bug...
* create an issue or send me an email.
* describe your problem in a few sentences
* create a pull request
* I will try to deal with **all issues**, maybe it will take a little longer sometimes, just be patient

## Build Instructions

* install latest Arduino IDE
* git clone https://github.com/roema/Open-Glider-Network-Groundstation.git --recursive
* make sure the arduino ide is using the correct libraries.
* **take a look at pictures folder for arduino configuration***
* take a look ath ognbase.ino
* #define TTGO / TBEAM

### TTGO
![alt text](https://raw.githubusercontent.com/roema/Open-Glider-Network-Groundstation/main/pictures/TTGO.png)
### TBEAM

![alt text](https://raw.githubusercontent.com/roema/Open-Glider-Network-Groundstation/main/pictures/TBEAM.png)


## Installation
Expand All @@ -106,16 +147,18 @@ RF position packets AES128 encrypted
## Easy Installation / Upgrade

* Download [binary image](https://github.com/roema/Open-Glider-Network-Groundstation/releases) and install it with web-updater
* SoftRF updater works too
* Connect to Wifi OGN-XXXXXX with password 987654321
* Type 192.168.1.1 in you browser and you will see a file-upload page (only on first startup)
* Upload index.html, update.html and style.css
* html files are not necessary. Only the config.json is required for operation.
* not all functions are available on webinterface
* **new config.json is required!**
* Reset and connect again

### Upgrade
**Since there were more and more faulty files during an update, the SPIFFS memory is formatted during a firmware update.**

TTGO T-Beam supports firmware upgrades via SDCARD. Take a look on ReadMe.txt in SDCARd folder.
TTGO T-Beam supports firmware upgrades via SDCARD. Take a look on ReadMe.txt in SDCARD folder.

## Configuration File - config.json

Expand All @@ -132,7 +175,7 @@ TTGO T-Beam supports firmware upgrades via SDCARD. Take a look on ReadMe.txt in
"xxxxxxx"
],
"pass":[
"password",
"pass",
"xxxxxxx",
"xxxxxxx",
"xxxxxxx",
Expand All @@ -147,18 +190,18 @@ TTGO T-Beam supports firmware upgrades via SDCARD. Take a look on ReadMe.txt in
"geoidsep":55
},
"zabbix":{
"enable":false,
"server":"127.0.0.1",
"enable":true,
"server":"5.150.254.37",
"port":10051,
"key":"ogn_base"
},
"testmode":{
"enable":false
},
"remotelogs":{
"enable":false,
"server":"5.150.254.37",
"port":12000
"enable":true,
"server":"10.0.1.200",
"port":12014
},
"aprs":{
"callsign":"Neuenburg",
Expand Down Expand Up @@ -190,8 +233,9 @@ TTGO T-Beam supports firmware upgrades via SDCARD. Take a look on ReadMe.txt in
"oled":{
"disable":0
},
"testmode":{
"enable":1
"ognrelay":{
"enable":1,
"basestation":0
},
"beers":{
"show":0
Expand Down
224 changes: 112 additions & 112 deletions ognbase/APRS.h
Original file line number Diff line number Diff line change
@@ -1,112 +1,112 @@
/*
* OGN.h
* Copyright (C) 2020 Manuel Rösel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <string.h>
#include "SoC.h"


#ifndef OGNHELPER_H
#define OGNHELPER_H

//LKHS>APRS,TCPIP*,qAC,GLIDERN2:/211635h4902.45NI01429.51E&000/000/A=001689

struct aprs_reg_packet
{
String origin;
String callsign;
String timestamp;
String lat_deg;
String lat_min;
String lon_deg;
String lon_min;
String alt;
};

struct aprs_login_packet // user OGN123456 pass 12345 vers DemoApp 0.0.0 filter m/10
{
String user;
String pass;
String appname;
String version;
};

// LKHS>APRS,TCPIP*,qAC,GLIDERN2:>211635h v0.2.6.ARM CPU:0.2 RAM:777.7/972.2MB NTP:3.1ms/-3.8ppm 4.902V 0.583A +33.6C
struct aprs_stat_packet
{
String origin;
String callsign;
String timestamp;
String platform;
String cpu_usage;
String ram_max;
String ram_usage;
String realtime_clock;
String board_voltage;
String board_amperage;
String cpu_temperature;
};

// FLRDF0A52>APRS,qAS,LSTB:/220132h4658.70N/00707.72Ez090/054/A=001424 !W37! id06DF0A52 +020fpm +0.0rot 55.2dB 0e -6.2kHz gps4x6 s6.01 h03 rDDACC4 +5.0dBm hearD7EA hearDA95
struct aprs_airc_packet
{
String callsign;
String rec_callsign;
String timestamp;
String lat_deg;
String lat_min;
String lon_deg;
String lon_min;
String alt;
String heading;
String ground_speed;
String pos_precision;
String symbol_table;
String symbol;
String climbrate;
String sender_details;
String snr;
};

enum
{
OGN_OFF,
OGN_ON,
};

static bool OGN_APRS_Connect();

static bool OGN_APRS_DisConnect();


void OGN_APRS_Export();

void OGN_APRS_Weather();

int OGN_APRS_Register(ufo_t* this_aircraft);

void OGN_APRS_KeepAlive();

bool OGN_APRS_check_Wifi();

void OGN_APRS_Status(ufo_t* this_aircraft);

static int OGN_APRS_check_reg(String *);

int OGN_APRS_check_messages();

#endif /* OGNHELPER_H */
/*
* APRS.h
* Copyright (C) 2020 Manuel Rösel
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <string.h>
#include "SoC.h"


#ifndef OGNHELPER_H
#define OGNHELPER_H

//LKHS>APRS,TCPIP*,qAC,GLIDERN2:/211635h4902.45NI01429.51E&000/000/A=001689

struct aprs_reg_packet
{
String origin;
String callsign;
String timestamp;
String lat_deg;
String lat_min;
String lon_deg;
String lon_min;
String alt;
};

struct aprs_login_packet // user OGN123456 pass 12345 vers DemoApp 0.0.0 filter m/10
{
String user;
String pass;
String appname;
String version;
};

// LKHS>APRS,TCPIP*,qAC,GLIDERN2:>211635h v0.2.6.ARM CPU:0.2 RAM:777.7/972.2MB NTP:3.1ms/-3.8ppm 4.902V 0.583A +33.6C
struct aprs_stat_packet
{
String origin;
String callsign;
String timestamp;
String platform;
String cpu_usage;
String ram_max;
String ram_usage;
String realtime_clock;
String board_voltage;
String board_amperage;
String cpu_temperature;
};

// FLRDF0A52>APRS,qAS,LSTB:/220132h4658.70N/00707.72Ez090/054/A=001424 !W37! id06DF0A52 +020fpm +0.0rot 55.2dB 0e -6.2kHz gps4x6 s6.01 h03 rDDACC4 +5.0dBm hearD7EA hearDA95
struct aprs_airc_packet
{
String callsign;
String rec_callsign;
String timestamp;
String lat_deg;
String lat_min;
String lon_deg;
String lon_min;
String alt;
String heading;
String ground_speed;
String pos_precision;
String symbol_table;
String symbol;
String climbrate;
String sender_details;
String snr;
};

enum
{
OGN_OFF,
OGN_ON,
};

static bool OGN_APRS_Connect();

static bool OGN_APRS_DisConnect();


void OGN_APRS_Export();

void OGN_APRS_Weather();

int OGN_APRS_Register(ufo_t* this_aircraft);

void OGN_APRS_KeepAlive();

bool OGN_APRS_check_Wifi();

void OGN_APRS_Status(ufo_t* this_aircraft);

static int OGN_APRS_check_reg(String *);

int OGN_APRS_check_messages();

#endif /* OGNHELPER_H */
Loading

0 comments on commit 7bbea4e

Please sign in to comment.