mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-14 06:23:07 +01:00
Merge branch 'wellenvogel:master' into master
This commit is contained in:
@@ -21,7 +21,7 @@ GwBuffer::~GwBuffer(){
|
||||
}
|
||||
void GwBuffer::reset(String reason)
|
||||
{
|
||||
LOG_DEBUG(GwLog::LOG,"reseting buffer %s, reason %s",this->name.c_str(),reason.c_str());
|
||||
if (! reason.isEmpty())LOG_DEBUG(GwLog::LOG,"reseting buffer %s, reason %s",this->name.c_str(),reason.c_str());
|
||||
writePointer = buffer;
|
||||
readPointer = buffer;
|
||||
lp("reset");
|
||||
|
||||
@@ -18,9 +18,9 @@ class GwMessageFetcher{
|
||||
* buffer to safely inserte data if it fits
|
||||
* and to write out data if possible
|
||||
*/
|
||||
typedef size_t (*GwBufferHandleFunction)(uint8_t *buffer, size_t len, void *param);
|
||||
class GwBuffer{
|
||||
public:
|
||||
using GwBufferHandleFunction=std::function<size_t(uint8_t *buffer, size_t len, void *param)>;
|
||||
static const size_t TX_BUFFER_SIZE=1620; // app. 20 NMEA messages
|
||||
static const size_t RX_BUFFER_SIZE=600; // enough for 1 NMEA message or actisense message or seasmart message
|
||||
typedef enum {
|
||||
@@ -33,7 +33,7 @@ class GwBuffer{
|
||||
uint8_t *buffer;
|
||||
uint8_t *writePointer;
|
||||
uint8_t *readPointer;
|
||||
size_t offset(uint8_t* ptr){
|
||||
size_t offset(uint8_t* ptr) const{
|
||||
return (size_t)(ptr-buffer);
|
||||
}
|
||||
GwLog *logger;
|
||||
|
||||
@@ -7,10 +7,10 @@ class GwSynchronized{
|
||||
public:
|
||||
GwSynchronized(SemaphoreHandle_t *locker){
|
||||
this->locker=locker;
|
||||
xSemaphoreTake(*locker, portMAX_DELAY);
|
||||
if (locker != nullptr) xSemaphoreTake(*locker, portMAX_DELAY);
|
||||
}
|
||||
~GwSynchronized(){
|
||||
xSemaphoreGive(*locker);
|
||||
if (locker != nullptr) xSemaphoreGive(*locker);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user