Skip to content

Commit

Permalink
Fix Outcome bug when returning a ResultInfo structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromehue committed Nov 11, 2023
1 parent d4bd1f7 commit c809ec2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Sts1CobcSw/Edu/Edu.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <Sts1CobcSw/Edu/Edu.hpp>
#include <Sts1CobcSw/Edu/Names.hpp>
#include <Sts1CobcSw/Edu/Structs.hpp>
#include <Sts1CobcSw/Hal/Communication.hpp>
#include <Sts1CobcSw/Hal/GpioPin.hpp>
#include <Sts1CobcSw/Hal/IoNames.hpp>
Expand Down Expand Up @@ -393,7 +394,7 @@ auto ReturnResult() -> Result<ResultInfo>
if(resultInfo.value().reachedEof)
{
RODOS::PRINTF(" ResultResultRetry() reached EOF\n");
return {/*reachedEof*/ true, totalResultSize};
return ResultInfo{.reachedEof = true, .resultSize = totalResultSize};
}

// END DEBUG
Expand All @@ -403,7 +404,7 @@ auto ReturnResult() -> Result<ResultInfo>
totalResultSize += resultInfo.value().resultSize;
packets++;
}
return {false, totalResultSize};
return ResultInfo{.reachedEof = false, .resultSize = totalResultSize};
}


Expand Down Expand Up @@ -479,7 +480,7 @@ auto ReturnResultCommunication() -> Result<edu::ResultInfo>
}
if(command == cmdEof)
{
return {/*reachedEof*/ true, 0_usize};
return ResultInfo{.reachedEof = true, .resultSize = 0_usize};
}
if(command != cmdData)
{
Expand Down Expand Up @@ -532,7 +533,7 @@ auto ReturnResultCommunication() -> Result<edu::ResultInfo>
RODOS::PRINTF("\nSuccess\n");
// END DEBUG

return {false, actualDataLength};
return ResultInfo{.reachedEof = false, .resultSize = actualDataLength};
}


Expand Down Expand Up @@ -698,6 +699,7 @@ auto UartReceive(void * destination) -> Result<void>
{
return ErrorCode::timeout;
}
return outcome_v2::success();
}


Expand Down

0 comments on commit c809ec2

Please sign in to comment.