Skip to content

Commit

Permalink
Merge pull request #397 from inertialsense/bugfix/bootloader_check_is…
Browse files Browse the repository at this point in the history
…_compatible

Ensure buffer is empty before read
  • Loading branch information
waltjohnson authored May 18, 2023
2 parents 429f9eb + 83c3c85 commit 432b16e
Showing 1 changed file with 5 additions and 22 deletions.
27 changes: 5 additions & 22 deletions src/ISBootloaderISB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,37 +60,20 @@ is_operation_result cISBootloaderISB::match_test(void* param)

eImageSignature cISBootloaderISB::check_is_compatible()
{
uint8_t buf[14] = { 0 };
int count = 0;

serialPortFlush(m_port);
//if (
serialPortRead(m_port, buf, sizeof(buf)); // empty Rx buffer
sync(m_port);
//!= IS_OP_OK)
//{
//return IS_IMAGE_SIGN_ERROR;
//}
// {
// for(int i = 0; i < 10; i++)
// {
// // Reset the device
// if(serialPortWrite(m_port, (unsigned char*)":020000040500F5", 15) == 15)
// {
// break;
// }

// SLEEP_MS(10);
// }

// return IS_IMAGE_SIGN_ERROR;
// }

SLEEP_MS(100);

uint8_t buf[14] = { 0 };
int count = 0;

for (int retry=0;; retry++)
{
// Send command
serialPortFlush(m_port);
serialPortRead(m_port, buf, sizeof(buf)); // empty Rx buffer
serialPortWrite(m_port, (uint8_t*)":020000041000EA", 15);

// Read Version, SAM-BA Available, serial number (in version 6+) and ok (.\r\n) response
Expand Down

0 comments on commit 432b16e

Please sign in to comment.