Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bcsanches/DCCLite
Browse files Browse the repository at this point in the history
  • Loading branch information
bcsanches committed Nov 15, 2023
2 parents 637432b + 4846c33 commit 2345576
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion data/EFMR/HadesEntA.decoders.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"frogPin":36,
"invertedFrog":true,
"operationTime":1000,
"range":20
"range":25
},
{
"name":"STA_T04",
Expand Down
20 changes: 12 additions & 8 deletions src/BrokerLib/dcc/NetworkDeviceTasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace dcclite::broker::detail
private:
void ReadSlice(dcclite::Packet &packet, const uint8_t sliceSize, const uint8_t sequence);

void RequestSlice(INetworkDevice_TaskServices &owner, const dcclite::Clock::TimePoint_t time, const uint8_t sliceNum);
void RequestSlice(INetworkDevice_TaskServices &owner, const uint8_t sliceNum);

void OnThink(const dcclite::Clock::TimePoint_t time);

Expand Down Expand Up @@ -200,7 +200,7 @@ namespace dcclite::broker::detail
}
}

void DownloadEEPromTask::RequestSlice(INetworkDevice_TaskServices &owner, const dcclite::Clock::TimePoint_t time, const uint8_t sliceNum)
void DownloadEEPromTask::RequestSlice(INetworkDevice_TaskServices &owner, const uint8_t sliceNum)
{
Log::Trace("[DownloadEEPromTask::Update]: requesting slice {}", (int)sliceNum);

Expand All @@ -211,9 +211,7 @@ namespace dcclite::broker::detail
//slice number
packet.Write8(static_cast<uint8_t>(sliceNum));

owner.TaskServices_SendPacket(packet);

m_clThinker.Schedule(time + DOWNLOAD_RETRY_TIMEOUT);
owner.TaskServices_SendPacket(packet);
}

void DownloadEEPromTask::OnThink(const dcclite::Clock::TimePoint_t time)
Expand All @@ -238,7 +236,9 @@ namespace dcclite::broker::detail
[[fallthrough]];
case States::START_DOWNLOAD:
//slice number, request 0... always valid
this->RequestSlice(m_rclOwner, time, 0);
this->RequestSlice(m_rclOwner, 0);

m_clThinker.Schedule(time + DOWNLOAD_RETRY_TIMEOUT);
break;

case States::DOWNLOADING:
Expand All @@ -255,12 +255,16 @@ namespace dcclite::broker::detail
continue;

++packetCount;
this->RequestSlice(m_rclOwner, time, static_cast<uint8_t>(i));
this->RequestSlice(m_rclOwner, static_cast<uint8_t>(i));
}

//Do we still have work to do?
if (packetCount)
return ;
{
m_clThinker.Schedule(time + DOWNLOAD_RETRY_TIMEOUT);

return;
}
}

Log::Info("[DownloadEEPromTask::Update]: finished download of {} bytes", m_vecResults.size());
Expand Down

0 comments on commit 2345576

Please sign in to comment.