Skip to content

Commit e38d7e8

Browse files
committed
Add OTAError::ChecksumMismatch which occures then the expected checksum does not match with the actual checksum
1 parent 07adcfd commit e38d7e8

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

extras/test/src/test_OTALogic.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,9 @@ TEST_CASE("Invalid OTA data is received ", "[OTALogic - CRC wrong]")
9595
{
9696
REQUIRE(ota_logic.state() == OTAState::Error);
9797
}
98+
99+
THEN("The OTA error should be set to OTAError::ChecksumMismatch")
100+
{
101+
REQUIRE(ota_logic.error() == OTAError::ChecksumMismatch);
102+
}
98103
}

src/utility/ota/OTALogic.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ OTAState OTALogic::handle_Verify()
195195
return OTAState::Reset;
196196
} else {
197197
_ota_storage.remove();
198+
_ota_error = OTAError::ChecksumMismatch;
198199
return OTAState::Error;
199200
}
200201
}

src/utility/ota/OTALogic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ enum class OTAState
4343

4444
enum class OTAError
4545
{
46-
None,
46+
None, ChecksumMismatch
4747
};
4848

4949
/******************************************************************************

0 commit comments

Comments
 (0)