Cause of the issue is a bug at FT12_Packetizer::readBytes function. Return type of FT12_Packetizer::readBytes is boolean instead of std::size_t. This leads to FT12_Packetizer::readFixedFrame failing to get the correct number of bytes read when Reset.Ind0x10 0xC0 0xC0 0x16 was received due to reset.
//FIXME: Length is determined from bool returned by readBytes
std::size_t length = readBytes(ptr + 1, bufferSize - 1, FixedLengthFrame::Length - 1, shortTimeout) + 1;
Bugfix
Fix FT1.2_Packetizer like so:
FT12_Packetizer.h
Change return type from bool to std::size_t
std::size_t readBytes(char* buffer, std::size_t bufferSize, std::size_t bytesToRead, long timeout);
FT12_Packetizer.cpp
Change return type of FT12_Packetizer::readBytes from bool to std::size_t
Return length instead of boolean condition bytesToRead ? true : false at FT12_Packetizer::readBytes
Baos SDK fails on the very first write attempt after baos chip/module has performed a reboot caused by ETS action.
Steps to reproduce:
Baos 83x starter kit connected via USB on PC (Linux host)
Configure Baos 83x via ETS, Datapoint ID=1, DPT=1(boolean)
Using following sample application to perform cyclic write action to datapoint:
Reason of issue
Cause of the issue is a bug at
FT12_Packetizer::readBytes
function. Return type ofFT12_Packetizer::readBytes
is boolean instead of std::size_t. This leads toFT12_Packetizer::readFixedFrame
failing to get the correct number of bytes read when Reset.Ind0x10 0xC0 0xC0 0x16
was received due to reset.Bugfix
Fix FT1.2_Packetizer like so:
FT12_Packetizer.h
FT12_Packetizer.cpp
Return
length
instead of boolean conditionbytesToRead ? true : false
at FT12_Packetizer::readBytesAfter the fix, the Reset.Ind appears in log and is handled correctly by resetting FCB/FCV: