add some fixes and enhancements by leoujz

fix build
This commit is contained in:
Thomas Kunze 2020-06-25 20:36:02 +02:00
parent 87a12fa26a
commit 4677044f46
7 changed files with 562 additions and 549 deletions

View File

@ -487,7 +487,7 @@ void ApplicationLayer::systemNetworkParameterReadResponse(Priority priority, Hop
//TODO: ApplicationLayer::domainAddressSerialNumberWriteRequest()
//TODO: ApplicationLayer::domainAddressSerialNumberReadRequest()
void ApplicationLayer::domainAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, uint8_t* rfDoA,
void ApplicationLayer::domainAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const uint8_t* rfDoA,
const uint8_t* knxSerialNumber)
{
CemiFrame frame(13);
@ -506,8 +506,8 @@ void ApplicationLayer::domainAddressSerialNumberReadResponse(Priority priority,
//TODO: ApplicationLayer::IndividualAddressSerialNumberWriteRequest()
//TODO: ApplicationLayer::IndividualAddressSerialNumberReadRequest()
void ApplicationLayer::IndividualAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, uint8_t* rfDoA,
uint8_t* knxSerialNumber)
void ApplicationLayer::IndividualAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const uint8_t* rfDoA,
const uint8_t* knxSerialNumber)
{
CemiFrame frame(13);
APDU& apdu = frame.apdu();

View File

@ -135,10 +135,10 @@ class ApplicationLayer
void systemNetworkParameterReadResponse(Priority priority, HopCountType hopType, uint16_t objectType,
uint16_t propertyId, uint8_t* testInfo, uint16_t testInfoLength,
uint8_t* testResult, uint16_t testResultLength);
void domainAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, uint8_t* rfDoA,
void domainAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const uint8_t* rfDoA,
const uint8_t* knxSerialNumber);
void IndividualAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, const uint8_t* rfDoA,
const uint8_t* knxSerialNumber);
void IndividualAddressSerialNumberReadResponse(Priority priority, HopCountType hopType, uint8_t* rfDoA,
uint8_t* knxSerialNumber);
#pragma endregion
private:

View File

@ -323,9 +323,9 @@ uint8_t* CemiFrame::rfSerialOrDoA() const
return _rfSerialOrDoA;
}
void CemiFrame::rfSerialOrDoA(uint8_t* rfSerialOrDoA)
void CemiFrame::rfSerialOrDoA(const uint8_t* rfSerialOrDoA)
{
_rfSerialOrDoA = rfSerialOrDoA;
_rfSerialOrDoA = (uint8_t*)rfSerialOrDoA;
}
uint8_t CemiFrame::rfInfo() const

View File

@ -60,7 +60,7 @@ class CemiFrame
#ifdef USE_RF
// only for RF medium
uint8_t* rfSerialOrDoA() const;
void rfSerialOrDoA(uint8_t* rfSerialOrDoA);
void rfSerialOrDoA(const uint8_t* rfSerialOrDoA);
uint8_t rfInfo() const;
void rfInfo(uint8_t rfInfo);
uint8_t rfLfn() const;

View File

@ -1043,7 +1043,7 @@ int valueToBusValueSigned8(const KNXValue& value, uint8_t* payload, size_t paylo
if ((int64_t)value < INT64_C(-128) || (int64_t)value > INT64_C(127))
return false;
signed8ToPayload(payload, 0, payload_length, (uint64_t)value, 0xFF);
signed8ToPayload(payload, payload_length, 0, (uint64_t)value, 0xFF);
return true;
}

View File

@ -92,6 +92,16 @@ void TpUartDataLinkLayer::loop()
uint8_t* buffer = _receiveBuffer + 2;
uint8_t rxByte;
if (!_enabled)
{
if (millis() - _lastResetChipTime > 1000)
{
//reset chip every 1 seconds
_lastResetChipTime = millis();
_enabled = resetChip();
}
}
if (!_enabled)
return;
@ -429,12 +439,14 @@ void TpUartDataLinkLayer::enabled(bool value)
{
_platform.setupUart();
if (resetChip()){
if (resetChip())
{
_enabled = true;
print("ownaddr ");
println(_deviceObject.induvidualAddress(), HEX);
}
else{
else
{
_enabled = false;
println("ERROR, TPUART not responding");
}

View File

@ -38,6 +38,7 @@ class TpUartDataLinkLayer : public DataLinkLayer
uint8_t _xorSum = 0;
uint32_t _lastByteRxTime;
uint32_t _waitConfirmStartTime;
uint32_t _lastResetChipTime = 0;
struct _tx_queue_frame_t
{