variable cfg path
This commit is contained in:
23
bsp_q7s/acs/StrConfigPathGetter.h
Normal file
23
bsp_q7s/acs/StrConfigPathGetter.h
Normal file
@ -0,0 +1,23 @@
|
||||
#include <optional>
|
||||
|
||||
#include "bsp_q7s/fs/SdCardManager.h"
|
||||
#include "mission/acs/str/strHelpers.h"
|
||||
|
||||
class StrConfigPathGetter : public startracker::SdCardConfigPathGetter {
|
||||
public:
|
||||
StrConfigPathGetter(SdCardManager& sdcMan) : sdcMan(sdcMan) {}
|
||||
|
||||
std::optional<std::string> getCfgPath() override {
|
||||
if (!sdcMan.isSdCardUsable(std::nullopt)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
if (sdcMan.getActiveSdCard() == sd::SdCard::SLOT_1) {
|
||||
return std::string("/mnt/sd1/startracker/flight-config.json");
|
||||
} else {
|
||||
return std::string("/mnt/sd0/startracker/flight-config.json");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
SdCardManager& sdcMan;
|
||||
};
|
Reference in New Issue
Block a user