Make BMP180 optionnal

Save 1.5ko of ROM
This commit is contained in:
Mathieu Maret 2016-03-26 15:27:23 +01:00
parent a990ce0055
commit 55beced1f8
3 changed files with 25 additions and 16 deletions

View File

@ -0,0 +1,20 @@
#pragma once
#ifdef ENABLE_BMP180
#include <SFE_BMP180.h>
// Get Current altitude with http://fr.mygeoposition.com/
#define ALTITUDE 130
SFE_BMP180 bmp180;
int bmp180Connected = 0;
int BMP180GetTemperature(double &t);
int BMP180GetTempAndPressure(double &t, double &p);
int BMP180Setup();
bool BMP180IsConnected();
#else //ENABLE_BMP80
int BMP180GetTemperature(double &t){return 0;};
int BMP180GetTempAndPressure(double &t, double &p){return 0;};
int BMP180Setup(){return 0;};
bool BMP180IsConnected(){return 0;};
#endif

View File

@ -1,9 +1,5 @@
// Get Current altitude with http://fr.mygeoposition.com/
#define ALTITUDE 130
SFE_BMP180 bmp180;
int bmp180Connected = 0;
#ifdef ENABLE_BMP180
#include "BMP180.h"
int BMP180Setup() {
bmp180Connected = bmp180.begin(SDA, SCL);
return bmp180Connected;
@ -43,3 +39,4 @@ int BMP180GetTempAndPressure(double &t, double &p) {
}
return -1;
}
#endif

View File

@ -20,10 +20,9 @@
#include <ArduinoOTA.h>
#include <errno.h>
#include <SFE_BMP180.h>
#include <Wire.h>
#define ENABLE_BMP180
#include "debug_sketch.h"
#include "BMP180.h"
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
@ -67,13 +66,6 @@ int EepromSaveConfig(uint8_t bootMode, String ssid, String password, String host
int EepromSaveBootMode(uint8_t bootMode);
void EepromReadConfig(uint8_t &bootMode, char **ssid, char **password, char **host, char **mqttServer, char **mqttUser, char **mqttPasswd, int &mqttPort);
/* BMP180 decl */
int BMP180GetTemperature(double &t);
int BMP180GetTempAndPressure(double &t, double &p);
int BMP180Setup();
bool BMP180IsConnected();
/* MQTT decl */
int MqttConnect();
int MqttIsConnected();