Merge pull request #13080 from btsimonh/BLEc3fixes

use type SemaphoreHandle_t where TasAutoMutex is used to silence new …
This commit is contained in:
Jason2866 2021-09-07 15:55:16 +02:00 committed by GitHub
commit a8f0fcab56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 16 deletions

View File

@ -1,4 +0,0 @@
Import("env")
# General options that are passed to the C++ compiler
env.Append(CXXFLAGS=["-fpermissive"])

View File

@ -90,8 +90,6 @@ build_flags = ${env:tasmota32_base.build_flags}
-DUSE_BLE_ESP32 -DUSE_BLE_ESP32
-DUSE_MI_ESP32 -DUSE_MI_ESP32
;-DESP32_STAGE=true ;-DESP32_STAGE=true
extra_scripts = ${env:tasmota32_base.extra_scripts}
pre:pio-tools/cxx_flags.py
lib_extra_dirs = lib/libesp32 lib_extra_dirs = lib/libesp32
lib/libesp32_div lib/libesp32_div
lib/libesp32_lvgl lib/libesp32_lvgl

View File

@ -136,20 +136,20 @@ class TasAutoMutex {
int maxWait; int maxWait;
const char *name; const char *name;
public: public:
TasAutoMutex(void ** mutex, const char *name = "", int maxWait = 40, bool take=true); TasAutoMutex(SemaphoreHandle_t* mutex, const char *name = "", int maxWait = 40, bool take=true);
~TasAutoMutex(); ~TasAutoMutex();
void give(); void give();
void take(); void take();
static void init(void ** ptr); static void init(SemaphoreHandle_t* ptr);
}; };
////////////////////////////////////////// //////////////////////////////////////////
TasAutoMutex::TasAutoMutex(void **mutex, const char *name, int maxWait, bool take) { TasAutoMutex::TasAutoMutex(SemaphoreHandle_t*mutex, const char *name, int maxWait, bool take) {
if (mutex) { if (mutex) {
if (!(*mutex)){ if (!(*mutex)){
TasAutoMutex::init(mutex); TasAutoMutex::init(mutex);
} }
this->mutex = (SemaphoreHandle_t)*mutex; this->mutex = *mutex;
this->maxWait = maxWait; this->maxWait = maxWait;
this->name = name; this->name = name;
if (take) { if (take) {
@ -172,9 +172,9 @@ TasAutoMutex::~TasAutoMutex() {
} }
} }
void TasAutoMutex::init(void ** ptr) { void TasAutoMutex::init(SemaphoreHandle_t* ptr) {
SemaphoreHandle_t mutex = xSemaphoreCreateRecursiveMutex(); SemaphoreHandle_t mutex = xSemaphoreCreateRecursiveMutex();
(*ptr) = (void *) mutex; (*ptr) = mutex;
// needed, else for ESP8266 as we will initialis more than once in logging // needed, else for ESP8266 as we will initialis more than once in logging
// (*ptr) = (void *) 1; // (*ptr) = (void *) 1;
} }
@ -2327,7 +2327,7 @@ bool NeedLogRefresh(uint32_t req_loglevel, uint32_t index) {
#ifdef ESP32 #ifdef ESP32
// this takes the mutex, and will be release when the class is destroyed - // this takes the mutex, and will be release when the class is destroyed -
// i.e. when the functon leaves You CAN call mutex.give() to leave early. // i.e. when the functon leaves You CAN call mutex.give() to leave early.
TasAutoMutex mutex(&TasmotaGlobal.log_buffer_mutex); TasAutoMutex mutex((SemaphoreHandle_t *)&TasmotaGlobal.log_buffer_mutex);
#endif // ESP32 #endif // ESP32
// Skip initial buffer fill // Skip initial buffer fill
@ -2349,7 +2349,7 @@ bool GetLog(uint32_t req_loglevel, uint32_t* index_p, char** entry_pp, size_t* l
#ifdef ESP32 #ifdef ESP32
// this takes the mutex, and will be release when the class is destroyed - // this takes the mutex, and will be release when the class is destroyed -
// i.e. when the functon leaves You CAN call mutex.give() to leave early. // i.e. when the functon leaves You CAN call mutex.give() to leave early.
TasAutoMutex mutex(&TasmotaGlobal.log_buffer_mutex); TasAutoMutex mutex((SemaphoreHandle_t *)&TasmotaGlobal.log_buffer_mutex);
#endif // ESP32 #endif // ESP32
if (!index) { // Dump all if (!index) { // Dump all
@ -2396,7 +2396,7 @@ void AddLogData(uint32_t loglevel, const char* log_data, const char* log_data_pa
#ifdef ESP32 #ifdef ESP32
// this takes the mutex, and will be release when the class is destroyed - // this takes the mutex, and will be release when the class is destroyed -
// i.e. when the functon leaves You CAN call mutex.give() to leave early. // i.e. when the functon leaves You CAN call mutex.give() to leave early.
TasAutoMutex mutex(&TasmotaGlobal.log_buffer_mutex); TasAutoMutex mutex((SemaphoreHandle_t *)&TasmotaGlobal.log_buffer_mutex);
#endif // ESP32 #endif // ESP32
char mxtime[14]; // "13:45:21.999 " char mxtime[14]; // "13:45:21.999 "

View File

@ -343,7 +343,7 @@ std::vector<mi_sensor_t> MIBLEsensors;
std::vector<mi_bindKey_t> MIBLEbindKeys; std::vector<mi_bindKey_t> MIBLEbindKeys;
std::vector<MAC_t> MIBLEBlockList; std::vector<MAC_t> MIBLEBlockList;
void *slotmutex = nullptr; SemaphoreHandle_t slotmutex = (SemaphoreHandle_t) nullptr;
/*********************************************************************************************\ /*********************************************************************************************\
* constants * constants