From b48fc3fea06689dfbb0d31a943b629be0dce0903 Mon Sep 17 00:00:00 2001 From: Christian OE3CJB Bauer Date: Sun, 2 Feb 2020 13:45:19 +0100 Subject: [PATCH] course calculation corrected --- INSTALL.md | 18 +++++++++++++++++- src/TTGO_T-Beam_LoRa_APRS.ino | 19 ++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 48137fa..3861e95 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,5 +1,9 @@ -

Installation Guide for PlatformIO

+

Installation Guide using PlatformIO


+1. Clone all files of the respository to your local working directory
+2. Install the missing libraries
+There are two possibilities - either using the Library Manager of PlatformIO or the command line tool:
+

1. Built-In Liabrary Manager

Press the PlatformIO HOME Button to enter the Home Screen and there the Libraries Button to add missing libraries:

Search and install the following libaries:
@@ -15,5 +19,17 @@ Search and install the following libaries:
  • DallasTemperature

  • +

    2. Command Line Tool

    +use the following commands
    +platformio lib install "RadioHead"
    +platformio lib install "TinyGPSPlus"
    +platformio lib install "DHT sensor library for ESPx"
    +platformio lib install "Adafruit SSD1306"
    +platformio lib install "Adafruit GFX Library"
    +platformio lib install "AXP202X_Library"
    +platformio lib install "Adafruit Unified Sensor"
    +platformio lib install "OneWire"
    +platformio lib install "DallasTemperature"
    +
    Check that the platformio.ini is available as it holds the board type for PlatformIO.
    After pressing the check mark the code will be compiled, after pressing the arrow it will be compiled and uploaded to a connected TTGO.
    diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index f7fbdb0..6e48997 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -525,9 +525,22 @@ void loop() { ++point_avg_course; if (point_avg_course>2) { point_avg_course=0; - new_course = (average_course[0]+average_course[1]+average_course[2])/3; - if (abs(new_course-old_course)>=30) { - nextTX = 0; + // new_course = (average_course[0]+average_course[1]+average_course[2])/3; + new_course = atan ((sin(average_course[0])+sin(average_course[1])+sin(average_course[2]))/(cos(average_course[0])+cos(average_course[1])+cos(average_course[2]))); + if ((old_course < 30) && (new_course > 330)) { + if (abs(new_course-old_course-360)>=30) { + nextTX = 0; + } + } else { + if ((old_course > 330) && (new_course < 30)) { + if (abs(new_course-old_course+360)>=30) { + nextTX = 0; + } + } else { + if (abs(new_course-old_course)>=30) { + nextTX = 0; + } + } } old_course = new_course; }