mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-17 07:41:52 +01:00
Hoymiles Lib: Move semaphore handing into parser base class
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022 - 2023 Thomas Basler and others
|
||||
*/
|
||||
#include "DevInfoParser.h"
|
||||
#include "../Hoymiles.h"
|
||||
@@ -46,16 +46,9 @@ const devInfo_t devInfo[] = {
|
||||
{ { 0x10, 0x33, 0x31, ALL }, 2250, "HMT-2250" } // 01
|
||||
};
|
||||
|
||||
#define HOY_SEMAPHORE_TAKE() \
|
||||
do { \
|
||||
} while (xSemaphoreTake(_xSemaphore, portMAX_DELAY) != pdPASS)
|
||||
#define HOY_SEMAPHORE_GIVE() xSemaphoreGive(_xSemaphore)
|
||||
|
||||
DevInfoParser::DevInfoParser()
|
||||
: Parser()
|
||||
{
|
||||
_xSemaphore = xSemaphoreCreateMutex();
|
||||
HOY_SEMAPHORE_GIVE(); // release before first use
|
||||
clearBufferSimple();
|
||||
clearBufferAll();
|
||||
}
|
||||
@@ -92,16 +85,6 @@ void DevInfoParser::appendFragmentSimple(uint8_t offset, uint8_t* payload, uint8
|
||||
_devInfoSimpleLength += len;
|
||||
}
|
||||
|
||||
void DevInfoParser::beginAppendFragment()
|
||||
{
|
||||
HOY_SEMAPHORE_TAKE();
|
||||
}
|
||||
|
||||
void DevInfoParser::endAppendFragment()
|
||||
{
|
||||
HOY_SEMAPHORE_GIVE();
|
||||
}
|
||||
|
||||
uint32_t DevInfoParser::getLastUpdateAll()
|
||||
{
|
||||
return _lastUpdateAll;
|
||||
|
||||
Reference in New Issue
Block a user