Skip to content

Commit

Permalink
Merge pull request #9 from nightflyer88/beta
Browse files Browse the repository at this point in the history
V2.3.1
  • Loading branch information
nightflyer88 authored Aug 24, 2018
2 parents 68ffe6f + 9fd7319 commit 9b8bef3
Show file tree
Hide file tree
Showing 10 changed files with 6,622 additions and 6,629 deletions.
1,874 changes: 1,874 additions & 0 deletions Arduino/Firmware/v231_VarioGPS_Sensor_3V3_8mhz.hex

Large diffs are not rendered by default.

1,378 changes: 1,378 additions & 0 deletions Arduino/Firmware/v231_VarioGPS_Sensor_3V3_8mhz_EX-Bus.hex

Large diffs are not rendered by default.

1,911 changes: 1,911 additions & 0 deletions Arduino/Firmware/v231_VarioGPS_Sensor_5V_16mhz.hex

Large diffs are not rendered by default.

1,442 changes: 1,442 additions & 0 deletions Arduino/Firmware/v231_VarioGPS_Sensor_5V_16mhz_EX-Bus.hex

Large diffs are not rendered by default.

1,873 changes: 0 additions & 1,873 deletions Arduino/Firmware/v23_VarioGPS_Sensor_3V3_8mhz.hex

This file was deleted.

1,376 changes: 0 additions & 1,376 deletions Arduino/Firmware/v23_VarioGPS_Sensor_3V3_8mhz_EX-Bus.hex

This file was deleted.

1,910 changes: 0 additions & 1,910 deletions Arduino/Firmware/v23_VarioGPS_Sensor_5V_16mhz.hex

This file was deleted.

1,441 changes: 0 additions & 1,441 deletions Arduino/Firmware/v23_VarioGPS_Sensor_5V_16mhz_EX-Bus.hex

This file was deleted.

17 changes: 0 additions & 17 deletions Arduino/VarioGPS_Sensor/BMx_Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@
#ifndef __BMP280_H__
#define __BMP280_H__

/*
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <Adafruit_Sensor.h>
#ifdef __AVR_ATtiny85__
#include "TinyWireM.h"
#define Wire TinyWireM
#else
#include <Wire.h>
#endif
*/

/*=========================================================================
I2C ADDRESS/BITS
-----------------------------------------------------------------------*/
Expand Down
29 changes: 17 additions & 12 deletions Arduino/VarioGPS_Sensor/VarioGPS_Sensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
Vario, GPS, Strom/Spannung, Empfängerspannungen, Temperaturmessung
*/
#define VARIOGPS_VERSION "Version V2.3"
#define VARIOGPS_VERSION "Version V2.3.1"
/*
******************************************************************
Versionen:
V2.3.1 22.08.19 Fehler bei Temepraturwert behoben (Dezimalstelle wurde nicht angezeigt)
V2.3 09.07.18 MPXV7002/MPXV5004 für Air-Speed wird unterstützt
TEK (Total Energie Kompensation) mit Air-Speed oder GPS-Speed (basierend auf Code von Rainer Stransky)
EX-Bus mit 125kbaud, Lib (v0.95) von Bernd Wokoeck
Expand Down Expand Up @@ -207,7 +208,7 @@ long startAltitude = 0;
long uRelAltitude = 0;
long uAbsAltitude = 0;
long uPressure = PRESSURE_SEALEVEL;
int uTemperature = 20;
float uTemperature = 20;
float lastVariofilter = 0;
long lastAltitude = 0;

Expand Down Expand Up @@ -470,18 +471,21 @@ void loop()

#ifdef SUPPORT_MPXV7002_MPXV5004
if(airSpeedSensor){

// get air speed from MPXV7002/MPXV5004
// based on code from johnlenfr, http://johnlenfr.1s.fr
int airSpeedPressure = analogRead(AIRSPEED_PIN);
if (airSpeedPressure < refAirspeedPressure) airSpeedPressure = refAirspeedPressure;

float pitotpressure = 5000.0 * ((airSpeedPressure - refAirspeedPressure) / 1024.0f) + uPressure; // differential pressure in Pa, 1 V/kPa, max 3920 Pa

// differential pressure in Pa, 1 V/kPa, max 3920 Pa
float pitotpressure = 5000.0 * ((airSpeedPressure - refAirspeedPressure) / 1024.0f) + uPressure;
float density = (uPressure * DRY_AIR_MOLAR_MASS) / ((uTemperature + 273.16) * UNIVERSAL_GAS_CONSTANT);
uAirSpeed = sqrt ((2 * (pitotpressure - uPressure)) / density);

// IIR Low Pass Filter
uAirSpeed = uAirSpeed + AIRSPEED_SMOOTHING * (lastAirSpeed - uAirSpeed);


// TEC
#ifdef SUPPORT_TEC
if(TECmode == TEC_airSpeed){
uSpeedMS = uAirSpeed;
Expand Down Expand Up @@ -532,10 +536,8 @@ void loop()
#endif
}

//if (!setStartAltitude) {
if (startAltitude == 0) {
// Set start-altitude in sensor-start
//setStartAltitude = true;
startAltitude = curAltitude;
lastAltitude = curAltitude;
}else{
Expand Down Expand Up @@ -703,15 +705,17 @@ void loop()
}
}

// if GPS-Fix
if (gps.location.isValid() && gps.location.age() < 2000) {

if (gps.location.isValid() && gps.location.age() < 2000) { // if Fix

// Position
jetiEx.SetSensorValueGPS( ID_GPSLAT, false, gps.location.lat() );
jetiEx.SetSensorValueGPS( ID_GPSLON, true, gps.location.lng() );

// Altitude
uAbsAltitude = gps.altitude.meters();

// GPS TEC
#ifdef SUPPORT_TEC
if(TECmode == TEC_GPS){
if (gps.speed.isUpdated()) {
Expand All @@ -726,17 +730,18 @@ void loop()
}
#endif

// Speed
#ifdef UNIT_US
jetiEx.SetSensorValue( ID_GPSSPEED, gps.speed.mph() );
#else
jetiEx.SetSensorValue( ID_GPSSPEED, gps.speed.kmph() );
#endif



// Azimuth
jetiEx.SetSensorValue( ID_AZIMUTH, gps.course.deg() );

if (homeSetCount < 3000) { // set home position
// set home position
if (homeSetCount < 3000) {
++homeSetCount;
home_lat = gps.location.lat();
home_lon = gps.location.lng();
Expand Down

0 comments on commit 9b8bef3

Please sign in to comment.