Store TLE presistent #789
@ -1040,18 +1040,14 @@ ReturnValue_t AcsController::updateTle(const uint8_t *line1, const uint8_t *line
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AcsController::writeTleToFs(const uint8_t *tle) {
|
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
|
// ToDo: check which SD card is active via sdcMan
|
||||||
std::string path = SD_0 + TLE_FILE;
|
std::string path = SD_0 + TLE_FILE;
|
||||||
// Clear existing TLE from file
|
// Clear existing TLE from file
|
||||||
std::ofstream tleFile(path.c_str(), std::ofstream::out | std::ofstream::trunc);
|
std::ofstream tleFile(path.c_str(), std::ofstream::out | std::ofstream::trunc);
|
||||||
if (tleFile.is_open()) {
|
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 {
|
} else {
|
||||||
// return error
|
// return error
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user