Skip to content

Commit

Permalink
Use strong type RealTime
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomoya-Hagen committed Aug 14, 2024
1 parent 0d65581 commit cba387f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Sts1CobcSw/CobcSoftware/EduListenerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ class EduListenerThread : public RODOS::StaticThread<>
{
edu::UpdateProgramStatusHistory(
status.programId,
status.startTime.value_of(),
status.startTime,
edu::ProgramStatus::programExecutionSucceeded);
}
else
{
edu::UpdateProgramStatusHistory(
status.programId,
status.startTime.value_of(),
status.startTime,
edu::ProgramStatus::programExecutionFailed);
}
ResumeEduProgramQueueThread();
Expand Down Expand Up @@ -123,7 +123,7 @@ class EduListenerThread : public RODOS::StaticThread<>

edu::UpdateProgramStatusHistory(
status.programId,
status.startTime.value_of(),
status.startTime,
edu::ProgramStatus::resultFileTransfered);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions Sts1CobcSw/Edu/ProgramStatusHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ RODOS::RingBuffer<ProgramStatusHistoryEntry, programStatusHistorySize> programSt


auto UpdateProgramStatusHistory(ProgramId programId,
std::int32_t startTime,
RealTime startTime,
ProgramStatus newStatus) -> void
{
// TODO: Check that there is only one entry matching program/queue ID, or should it be the case
// by construction ?
for(std::uint32_t i = 0; i < programStatusHistory.occupiedCnt; ++i)
{
if(programStatusHistory.vals[i].startTime == startTime
if(programStatusHistory.vals[i].startTime.value_of() == startTime.value_of()
and programStatusHistory.vals[i].programId == programId)
{
programStatusHistory.vals[i].status = newStatus;
Expand Down
5 changes: 3 additions & 2 deletions Sts1CobcSw/Edu/ProgramStatusHistory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Sts1CobcSw/Periphery/FramLayout.hpp>
#include <Sts1CobcSw/ProgramId/ProgramId.hpp>
#include <Sts1CobcSw/Serial/Serial.hpp>
#include <Sts1CobcSw/Utility/Time.hpp>

#include <strong_type/ordered_with.hpp>

Expand Down Expand Up @@ -36,7 +37,7 @@ enum class ProgramStatus : std::uint8_t
struct ProgramStatusHistoryEntry
{
ProgramId programId = ProgramId(0);
std::int32_t startTime = 0;
RealTime startTime = RealTime(0);
ProgramStatus status = ProgramStatus::programRunning;
};
}
Expand All @@ -60,7 +61,7 @@ extern RODOS::RingBuffer<ProgramStatusHistoryEntry, programStatusHistorySize> pr


auto UpdateProgramStatusHistory(ProgramId programId,
std::int32_t startTime,
RealTime startTime,
ProgramStatus newStatus) -> void;
}
}

0 comments on commit cba387f

Please sign in to comment.