Store TLE presistent #789

Merged
meggert merged 17 commits from persistent-tle-store into dev-7.5.0 2023-12-01 13:04:57 +01:00
Showing only changes of commit e40dd74f39 - Show all commits

View File

@ -1040,18 +1040,14 @@ ReturnValue_t AcsController::updateTle(const uint8_t *line1, const uint8_t *line
}
ReturnValue_t AcsController::writeTleToFs(const uint8_t *tle) {
// split TLE to two lines
// not sure why these need to be 70 long
uint8_t tleLine1[70] = {};
uint8_t tleLine2[70] = {};
std::memcpy(tleLine1, tle, 69);
std::memcpy(tleLine2, tle + 69, 69);
// ToDo: check which SD card is active via sdcMan
std::string path = SD_0 + TLE_FILE;
// Clear existing TLE from file
std::ofstream tleFile(path.c_str(), std::ofstream::out | std::ofstream::trunc);
if (tleFile.is_open()) {
tleFile << tleLine1 << "\n" << tleLine2 << "\n";
tleFile.write(static_cast<char *>(tle), 69);
tleFile << "\n";
tleFile.write(static_cast<char *>(tle + 69), 69);
} else {
// return error
}