kopia lustrzana https://github.com/bristol-seds/pico-tracker
[ms5607] Differentiate between ms5607 and ms5611 in hw_config.
rodzic
20e9867d5f
commit
cc34bdceb9
|
@ -7,6 +7,7 @@
|
|||
- `APRS_ENABLE` is set if APRS is to be used on the flight
|
||||
- `APRS_USE_GEOFENCE` is set
|
||||
- `TELEMETRY_USE_GEOFENCE` is set
|
||||
- Check the correct barometer is defined, for instance `BAROMETER_TYPE_MS5607` is set.
|
||||
- `DEBUG_USE_INTWATCHDOG` can be disabled during flight. This saves some power
|
||||
- Check interrupts are regular enough to kick the hardware
|
||||
watchdog under all conditions.
|
||||
|
|
|
@ -135,6 +135,7 @@
|
|||
*/
|
||||
#define BAROMETER_TYPE_BMP180 0
|
||||
#define BAROMETER_TYPE_MS5607 1
|
||||
#define BAROMETER_TYPE_MS5611 0
|
||||
|
||||
/**
|
||||
* Battery ADC
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* MS5607
|
||||
* Copyright (C) 2015 Richard Meadows <richardeoin>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MS5607_H
|
||||
#define MS5607_H
|
||||
|
||||
#include "samd20.h"
|
||||
|
||||
/**
|
||||
* Barometer data structure
|
||||
*/
|
||||
struct barometer {
|
||||
double temperature;
|
||||
double pressure;
|
||||
int valid; // 1 = valid, 0 = invalid
|
||||
};
|
||||
|
||||
struct barometer* get_barometer(void);
|
||||
void ms5607_init(void);
|
||||
|
||||
#endif /* MS5607_H */
|
|
@ -28,7 +28,7 @@
|
|||
#include "samd20.h"
|
||||
#include "hw_config.h"
|
||||
|
||||
#if BAROMETER_TYPE_MS5607
|
||||
#if (BAROMETER_TYPE_MS5607 || BAROMETER_TYPE_MS5611)
|
||||
|
||||
#include "barometer.h"
|
||||
#include "i2c_bb.h"
|
||||
|
@ -284,7 +284,11 @@ struct barometer* get_barometer(void)
|
|||
double P = (((D1 * SENS) / (1<<21)) - OFF) / (1<<15);
|
||||
|
||||
barometer.temperature = (double)TEMP / 100; /* degC */
|
||||
#if BAROMETER_TYPE_MS5611
|
||||
barometer.pressure = P/2; /* Pa. DIVIDE BY 2 FOR MS5611 ONLY */
|
||||
#else
|
||||
barometer.pressure = P;
|
||||
#endif
|
||||
barometer.valid = 1;
|
||||
|
||||
} else { /* Barometer not initialised correctly */
|
||||
|
|
Ładowanie…
Reference in New Issue