mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-08 05:31:25 +00:00
Fix build issue with mutex
This commit is contained in:
parent
6c0911038a
commit
eb1f80f520
@ -65,21 +65,18 @@ bool BMP3XXSensor::getMetrics(meshtastic_Telemetry *measurement)
|
||||
// Get a singleton wrapper for an Adafruit_bmp3xx
|
||||
BMP3XXSingleton *BMP3XXSingleton::GetInstance()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if (pinstance_ == nullptr)
|
||||
if (pinstance == nullptr)
|
||||
{
|
||||
pinstance_ = new BMP3XXSingleton();
|
||||
pinstance = new BMP3XXSingleton();
|
||||
}
|
||||
return pinstance_;
|
||||
return pinstance;
|
||||
}
|
||||
|
||||
BMP3XXSingleton::BMP3XXSingleton(){}
|
||||
|
||||
BMP3XXSingleton::~BMP3XXSingleton(){}
|
||||
|
||||
BMP3XXSingleton* BMP3XXSingleton::pinstance_{nullptr};
|
||||
|
||||
std::mutex BMP3XXSingleton::mutex_;
|
||||
BMP3XXSingleton* BMP3XXSingleton::pinstance{nullptr};
|
||||
|
||||
bool BMP3XXSingleton::performReading()
|
||||
{
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#define SEAL_LEVEL_HPA 1013.2f
|
||||
|
||||
#include <mutex>
|
||||
#include <typeinfo>
|
||||
#include <Adafruit_BMP3XX.h>
|
||||
#include "TelemetrySensor.h"
|
||||
@ -16,15 +15,14 @@
|
||||
class BMP3XXSingleton : public Adafruit_BMP3XX
|
||||
{
|
||||
private:
|
||||
static BMP3XXSingleton * pinstance_;
|
||||
static std::mutex mutex_;
|
||||
static BMP3XXSingleton * pinstance;
|
||||
|
||||
protected:
|
||||
BMP3XXSingleton();
|
||||
~BMP3XXSingleton();
|
||||
|
||||
public:
|
||||
// Create a singleton instance (with lock for thread safety)
|
||||
// Create a singleton instance (not thread safe)
|
||||
static BMP3XXSingleton *GetInstance();
|
||||
|
||||
// Singletons should not be cloneable.
|
||||
|
Loading…
Reference in New Issue
Block a user