v1.15.0 #311
@ -41,7 +41,7 @@ static constexpr uint32_t SA_DEPL_WAIT_TIME_SECS = 45 * 60;
|
|||||||
// HW constraints (current limit) mean that the GPIO channels need to be switched on in alternation
|
// HW constraints (current limit) mean that the GPIO channels need to be switched on in alternation
|
||||||
static constexpr uint32_t SA_DEPL_CHANNEL_ALTERNATION_INTERVAL_SECS = 5;
|
static constexpr uint32_t SA_DEPL_CHANNEL_ALTERNATION_INTERVAL_SECS = 5;
|
||||||
// Maximum allowed burn time allowed by the software.
|
// Maximum allowed burn time allowed by the software.
|
||||||
static constexpr uint32_t SA_DEPL_MAX_BURN_TIME = 120;
|
static constexpr uint32_t SA_DEPL_MAX_BURN_TIME = 180;
|
||||||
|
|
||||||
} // namespace config
|
} // namespace config
|
||||||
|
|
||||||
|
@ -89,56 +89,54 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename, bo
|
|||||||
bool stateSwitch = false;
|
bool stateSwitch = false;
|
||||||
uint32_t secsSinceBoot = 0;
|
uint32_t secsSinceBoot = 0;
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
|
std::istringstream iss(line);
|
||||||
if (lineNum == 0) {
|
if (lineNum == 0) {
|
||||||
std::istringstream iss(line);
|
iss >> word;
|
||||||
if (lineNum == 0) {
|
if (word.find("phase:") == string::npos) {
|
||||||
iss >> word;
|
return false;
|
||||||
if (word.find("phase:") == string::npos) {
|
}
|
||||||
return false;
|
iss >> word;
|
||||||
}
|
if (word.find(PHASE_INIT_STR) != string::npos) {
|
||||||
iss >> word;
|
deplState = AutonomousDeplState::INIT;
|
||||||
if (word.find(PHASE_INIT_STR) != string::npos) {
|
} else if (word.find(PHASE_FIRST_BURN_STR) != string::npos) {
|
||||||
deplState = AutonomousDeplState::INIT;
|
deplState = AutonomousDeplState::FIRST_BURN;
|
||||||
} else if (word.find(PHASE_FIRST_BURN_STR) != string::npos) {
|
} else if (word.find(PHASE_WAIT_STR) != string::npos) {
|
||||||
deplState = AutonomousDeplState::FIRST_BURN;
|
deplState = AutonomousDeplState::WAIT;
|
||||||
} else if (word.find(PHASE_WAIT_STR) != string::npos) {
|
} else if (word.find(PHASE_SECOND_BURN_STR) != string::npos) {
|
||||||
deplState = AutonomousDeplState::WAIT;
|
deplState = AutonomousDeplState::SECOND_BURN;
|
||||||
} else if (word.find(PHASE_SECOND_BURN_STR) != string::npos) {
|
} else if (word.find(PHASE_DONE) != string::npos) {
|
||||||
deplState = AutonomousDeplState::SECOND_BURN;
|
deplState = AutonomousDeplState::DONE;
|
||||||
} else if (word.find(PHASE_DONE) != string::npos) {
|
} else {
|
||||||
deplState = AutonomousDeplState::DONE;
|
return false;
|
||||||
} else {
|
}
|
||||||
return false;
|
} else if (lineNum == 1) {
|
||||||
}
|
iss >> word;
|
||||||
} else if (lineNum == 1) {
|
if (word.find("secs_since_start:") == string::npos) {
|
||||||
iss >> word;
|
return false;
|
||||||
if (word.find("secs_since_start:") == string::npos) {
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
iss >> secsSinceBoot;
|
iss >> secsSinceBoot;
|
||||||
if (not initUptime) {
|
if (not initUptime) {
|
||||||
initUptime = secsSinceBoot;
|
initUptime = secsSinceBoot;
|
||||||
}
|
}
|
||||||
if (iss.bad()) {
|
if (iss.bad()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto switchCheck = [&](AutonomousDeplState expected) {
|
auto switchCheck = [&](AutonomousDeplState expected) {
|
||||||
if (deplState != expected) {
|
if (deplState != expected) {
|
||||||
deplState = expected;
|
deplState = expected;
|
||||||
stateSwitch = true;
|
stateSwitch = true;
|
||||||
}
|
|
||||||
};
|
|
||||||
if ((secsSinceBoot > FIRST_BURN_START_TIME) and (secsSinceBoot < FIRST_BURN_END_TIME)) {
|
|
||||||
switchCheck(AutonomousDeplState::FIRST_BURN);
|
|
||||||
} else if ((secsSinceBoot > WAIT_START_TIME) and (secsSinceBoot < WAIT_END_TIME)) {
|
|
||||||
switchCheck(AutonomousDeplState::WAIT);
|
|
||||||
} else if ((secsSinceBoot > SECOND_BURN_START_TIME) and
|
|
||||||
(secsSinceBoot < SECOND_BURN_END_TIME)) {
|
|
||||||
switchCheck(AutonomousDeplState::SECOND_BURN);
|
|
||||||
} else if (secsSinceBoot > SECOND_BURN_END_TIME) {
|
|
||||||
switchCheck(AutonomousDeplState::DONE);
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if ((secsSinceBoot > FIRST_BURN_START_TIME) and (secsSinceBoot < FIRST_BURN_END_TIME)) {
|
||||||
|
switchCheck(AutonomousDeplState::FIRST_BURN);
|
||||||
|
} else if ((secsSinceBoot > WAIT_START_TIME) and (secsSinceBoot < WAIT_END_TIME)) {
|
||||||
|
switchCheck(AutonomousDeplState::WAIT);
|
||||||
|
} else if ((secsSinceBoot > SECOND_BURN_START_TIME) and
|
||||||
|
(secsSinceBoot < SECOND_BURN_END_TIME)) {
|
||||||
|
switchCheck(AutonomousDeplState::SECOND_BURN);
|
||||||
|
} else if (secsSinceBoot > SECOND_BURN_END_TIME) {
|
||||||
|
switchCheck(AutonomousDeplState::DONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lineNum++;
|
lineNum++;
|
||||||
|
Loading…
Reference in New Issue
Block a user