1
0
forked from fsfw/fsfw

Serial Buffer dapter changes reverted

CCSDS time bugfixes in separate section (for C98)
Serial buffer adapter 2 bugfixes
This commit is contained in:
2020-01-31 00:54:34 +01:00
parent 09144b18c4
commit 5190e4c16e
3 changed files with 16 additions and 12 deletions

View File

@ -155,8 +155,9 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t*
if (length < 19) {
return RETURN_FAILED;
}
// Newlib can't parse uint8 (there is a configure option but I still need to figure out how to make it work..)
#ifdef NEWLIB_NO_C99_IO
// Newlib nano can't parse uint8, see SCNu8 documentation and https://sourceware.org/newlib/README
// Suggestion: use uint16 all the time. This should work on all systems.
#ifdef NEWLIB_NANO_NO_C99_IO
uint16_t year;
uint16_t month;
uint16_t day;
@ -181,8 +182,8 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t*
&hour, &minute, &second);
if (count == 5) {
uint8_t tempDay;
ReturnValue_t result = CCSDSTime::convertDaysOfYear(day, year,(uint8_t *) &month,
&tempDay);
ReturnValue_t result = CCSDSTime::convertDaysOfYear(day, year,
reinterpret_cast<uint8_t *>(&month), reinterpret_cast<uint8_t *>(&tempDay));
if (result != RETURN_OK) {
return RETURN_FAILED;
}
@ -195,6 +196,7 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t*
to->usecond = (second - floor(second)) * 1000000;
return RETURN_OK;
}
// Warning: Compiler/Linker fails ambiguously if library does not implement C99 I/O
#else
uint16_t year;
uint8_t month;