Make BMP180 optionnal
Save 1.5ko of ROM
This commit is contained in:
parent
a990ce0055
commit
55beced1f8
20
WifiControlSensor/BMP180.h
Normal file
20
WifiControlSensor/BMP180.h
Normal 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
|
@ -1,9 +1,5 @@
|
|||||||
// Get Current altitude with http://fr.mygeoposition.com/
|
#ifdef ENABLE_BMP180
|
||||||
#define ALTITUDE 130
|
#include "BMP180.h"
|
||||||
|
|
||||||
SFE_BMP180 bmp180;
|
|
||||||
int bmp180Connected = 0;
|
|
||||||
|
|
||||||
int BMP180Setup() {
|
int BMP180Setup() {
|
||||||
bmp180Connected = bmp180.begin(SDA, SCL);
|
bmp180Connected = bmp180.begin(SDA, SCL);
|
||||||
return bmp180Connected;
|
return bmp180Connected;
|
||||||
@ -43,3 +39,4 @@ int BMP180GetTempAndPressure(double &t, double &p) {
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -20,10 +20,9 @@
|
|||||||
#include <ArduinoOTA.h>
|
#include <ArduinoOTA.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <SFE_BMP180.h>
|
#define ENABLE_BMP180
|
||||||
#include <Wire.h>
|
|
||||||
|
|
||||||
#include "debug_sketch.h"
|
#include "debug_sketch.h"
|
||||||
|
#include "BMP180.h"
|
||||||
|
|
||||||
#include "Adafruit_MQTT.h"
|
#include "Adafruit_MQTT.h"
|
||||||
#include "Adafruit_MQTT_Client.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);
|
int EepromSaveBootMode(uint8_t bootMode);
|
||||||
void EepromReadConfig(uint8_t &bootMode, char **ssid, char **password, char **host, char **mqttServer, char **mqttUser, char **mqttPasswd, int &mqttPort);
|
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 */
|
/* MQTT decl */
|
||||||
int MqttConnect();
|
int MqttConnect();
|
||||||
int MqttIsConnected();
|
int MqttIsConnected();
|
||||||
|
Loading…
Reference in New Issue
Block a user