Merge pull request 'Bugfixes ans tweaks for STR' (#559) from bugfixes_tweaks_str into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #559
This commit is contained in:
commit
2b18ab1504
@ -22,11 +22,15 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
|
|
||||||
- Version of thermal controller which performs basic control tasks.
|
- Version of thermal controller which performs basic control tasks.
|
||||||
- PCDU handler can now command switch of the 3V3 stack (switch ID 19)
|
- PCDU handler can now command switch of the 3V3 stack (switch ID 19)
|
||||||
|
- Set STR dev to OFF in assembly when it is faulty.
|
||||||
|
- STR: Reset data link layer and flush RX for regular commands and before performing special
|
||||||
|
commands to ensure consistent start state
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
- PTME was not reset after configuration changes.
|
- PTME was not reset after configuration changes.
|
||||||
- GPS health devices: ACS board assembly not reacts to health changes.
|
- GPS health devices: ACS board assembly not reacts to health changes.
|
||||||
|
- STR COM helper: Reset reply size after returning a reply
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ ReturnValue_t StrComHandler::performOperation(uint8_t operationCode) {
|
|||||||
while (true) {
|
while (true) {
|
||||||
lock->lockMutex();
|
lock->lockMutex();
|
||||||
state = InternalState::SLEEPING;
|
state = InternalState::SLEEPING;
|
||||||
datalinkLayer.reset();
|
|
||||||
lock->unlockMutex();
|
lock->unlockMutex();
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
switch (state) {
|
switch (state) {
|
||||||
@ -58,6 +57,7 @@ ReturnValue_t StrComHandler::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::UPLOAD_IMAGE: {
|
case InternalState::UPLOAD_IMAGE: {
|
||||||
replyTimeout.setTimeout(200);
|
replyTimeout.setTimeout(200);
|
||||||
|
resetReplyHandlingState();
|
||||||
result = performImageUpload();
|
result = performImageUpload();
|
||||||
if (result == returnvalue::OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(IMAGE_UPLOAD_SUCCESSFUL);
|
triggerEvent(IMAGE_UPLOAD_SUCCESSFUL);
|
||||||
@ -68,6 +68,7 @@ ReturnValue_t StrComHandler::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::DOWNLOAD_IMAGE: {
|
case InternalState::DOWNLOAD_IMAGE: {
|
||||||
replyTimeout.setTimeout(200);
|
replyTimeout.setTimeout(200);
|
||||||
|
resetReplyHandlingState();
|
||||||
result = performImageDownload();
|
result = performImageDownload();
|
||||||
if (result == returnvalue::OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(IMAGE_DOWNLOAD_SUCCESSFUL);
|
triggerEvent(IMAGE_DOWNLOAD_SUCCESSFUL);
|
||||||
@ -78,6 +79,7 @@ ReturnValue_t StrComHandler::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::FLASH_READ: {
|
case InternalState::FLASH_READ: {
|
||||||
replyTimeout.setTimeout(200);
|
replyTimeout.setTimeout(200);
|
||||||
|
resetReplyHandlingState();
|
||||||
result = performFlashRead();
|
result = performFlashRead();
|
||||||
if (result == returnvalue::OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(FLASH_READ_SUCCESSFUL);
|
triggerEvent(FLASH_READ_SUCCESSFUL);
|
||||||
@ -88,6 +90,7 @@ ReturnValue_t StrComHandler::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::FIRMWARE_UPDATE: {
|
case InternalState::FIRMWARE_UPDATE: {
|
||||||
replyTimeout.setTimeout(200);
|
replyTimeout.setTimeout(200);
|
||||||
|
resetReplyHandlingState();
|
||||||
result = performFirmwareUpdate();
|
result = performFirmwareUpdate();
|
||||||
if (result == returnvalue::OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(FIRMWARE_UPDATE_SUCCESSFUL);
|
triggerEvent(FIRMWARE_UPDATE_SUCCESSFUL);
|
||||||
@ -645,7 +648,8 @@ ReturnValue_t StrComHandler::sendMessage(CookieIF* cookie, const uint8_t* sendDa
|
|||||||
return BUSY;
|
return BUSY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
serial::flushRxBuf(serialPort);
|
// Ensure consistent state.
|
||||||
|
resetReplyHandlingState();
|
||||||
|
|
||||||
const uint8_t* txFrame;
|
const uint8_t* txFrame;
|
||||||
size_t frameLen;
|
size_t frameLen;
|
||||||
@ -697,6 +701,7 @@ ReturnValue_t StrComHandler::readReceivedMessage(CookieIF* cookie, uint8_t** buf
|
|||||||
*buffer = const_cast<uint8_t*>(replyPtr);
|
*buffer = const_cast<uint8_t*>(replyPtr);
|
||||||
*size = replyLen;
|
*size = replyLen;
|
||||||
}
|
}
|
||||||
|
replyLen = 0;
|
||||||
return replyResult;
|
return replyResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,3 +786,8 @@ ReturnValue_t StrComHandler::readOneReply(uint32_t failParameter) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StrComHandler::resetReplyHandlingState() {
|
||||||
|
serial::flushRxBuf(serialPort);
|
||||||
|
datalinkLayer.reset();
|
||||||
|
}
|
||||||
|
@ -374,6 +374,8 @@ class StrComHandler : public SystemObject, public DeviceCommunicationIF, public
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t readOneReply(uint32_t failParameter);
|
ReturnValue_t readOneReply(uint32_t failParameter);
|
||||||
|
|
||||||
|
void resetReplyHandlingState();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_DEVICES_STRHELPER_H_ */
|
#endif /* BSP_Q7S_DEVICES_STRHELPER_H_ */
|
||||||
|
@ -56,6 +56,49 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF,
|
|||||||
|
|
||||||
StarTrackerHandler::~StarTrackerHandler() {}
|
StarTrackerHandler::~StarTrackerHandler() {}
|
||||||
|
|
||||||
|
void StarTrackerHandler::doStartUp() {
|
||||||
|
switch (startupState) {
|
||||||
|
case StartupState::IDLE:
|
||||||
|
startupState = StartupState::CHECK_PROGRAM;
|
||||||
|
return;
|
||||||
|
case StartupState::BOOT_BOOTLOADER:
|
||||||
|
// This step is required in case the star tracker is already in firmware mode to harmonize
|
||||||
|
// the device handler's submode to the star tracker's mode
|
||||||
|
return;
|
||||||
|
case StartupState::DONE:
|
||||||
|
if (jcfgCountdown.isBusy()) {
|
||||||
|
startupState = StartupState::WAIT_JCFG;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
startupState = StartupState::IDLE;
|
||||||
|
break;
|
||||||
|
case StartupState::WAIT_JCFG: {
|
||||||
|
if (jcfgCountdown.hasTimedOut()) {
|
||||||
|
startupState = StartupState::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
solutionSet.setReportingEnabled(true);
|
||||||
|
startupState = StartupState::DONE;
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
setMode(_MODE_TO_ON);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StarTrackerHandler::doShutDown() {
|
||||||
|
// If the star tracker is shutdown also stop all running processes in the image loader task
|
||||||
|
strHelper->stopProcess();
|
||||||
|
internalState = InternalState::IDLE;
|
||||||
|
startupState = StartupState::IDLE;
|
||||||
|
bootState = FwBootState::NONE;
|
||||||
|
solutionSet.setReportingEnabled(false);
|
||||||
|
reinitNextSetParam = false;
|
||||||
|
setMode(_MODE_POWER_DOWN);
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::initialize() {
|
ReturnValue_t StarTrackerHandler::initialize() {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = DeviceHandlerBase::initialize();
|
result = DeviceHandlerBase::initialize();
|
||||||
@ -236,49 +279,6 @@ void StarTrackerHandler::performOperationHook() {
|
|||||||
|
|
||||||
Submode_t StarTrackerHandler::getInitialSubmode() { return SUBMODE_BOOTLOADER; }
|
Submode_t StarTrackerHandler::getInitialSubmode() { return SUBMODE_BOOTLOADER; }
|
||||||
|
|
||||||
void StarTrackerHandler::doStartUp() {
|
|
||||||
switch (startupState) {
|
|
||||||
case StartupState::IDLE:
|
|
||||||
startupState = StartupState::CHECK_PROGRAM;
|
|
||||||
return;
|
|
||||||
case StartupState::BOOT_BOOTLOADER:
|
|
||||||
// This step is required in case the star tracker is already in firmware mode to harmonize
|
|
||||||
// the device handler's submode to the star tracker's mode
|
|
||||||
return;
|
|
||||||
case StartupState::DONE:
|
|
||||||
if (jcfgCountdown.isBusy()) {
|
|
||||||
startupState = StartupState::WAIT_JCFG;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startupState = StartupState::IDLE;
|
|
||||||
break;
|
|
||||||
case StartupState::WAIT_JCFG: {
|
|
||||||
if (jcfgCountdown.hasTimedOut()) {
|
|
||||||
startupState = StartupState::IDLE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
solutionSet.setReportingEnabled(true);
|
|
||||||
startupState = StartupState::DONE;
|
|
||||||
internalState = InternalState::IDLE;
|
|
||||||
setMode(_MODE_TO_ON);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StarTrackerHandler::doShutDown() {
|
|
||||||
// If the star tracker is shutdown also stop all running processes in the image loader task
|
|
||||||
strHelper->stopProcess();
|
|
||||||
internalState = InternalState::IDLE;
|
|
||||||
startupState = StartupState::IDLE;
|
|
||||||
bootState = FwBootState::NONE;
|
|
||||||
solutionSet.setReportingEnabled(false);
|
|
||||||
reinitNextSetParam = false;
|
|
||||||
setMode(_MODE_POWER_DOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||||
if (strHelperHandlingSpecialRequest) {
|
if (strHelperHandlingSpecialRequest) {
|
||||||
return NOTHING_TO_SEND;
|
return NOTHING_TO_SEND;
|
||||||
@ -831,7 +831,6 @@ void StarTrackerHandler::bootBootloader() {
|
|||||||
ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
size_t bytesLeft = 0;
|
|
||||||
|
|
||||||
if (remainingSize == 0) {
|
if (remainingSize == 0) {
|
||||||
*foundLen = remainingSize;
|
*foundLen = remainingSize;
|
||||||
@ -845,24 +844,24 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
|
|||||||
|
|
||||||
switch (startracker::getReplyFrameType(start)) {
|
switch (startracker::getReplyFrameType(start)) {
|
||||||
case TMTC_ACTIONREPLY: {
|
case TMTC_ACTIONREPLY: {
|
||||||
*foundLen = remainingSize - bytesLeft;
|
*foundLen = remainingSize;
|
||||||
result = scanForActionReply(startracker::getId(start), foundId);
|
return scanForActionReply(startracker::getId(start), foundId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TMTC_SETPARAMREPLY: {
|
case TMTC_SETPARAMREPLY: {
|
||||||
*foundLen = remainingSize - bytesLeft;
|
*foundLen = remainingSize;
|
||||||
result = scanForSetParameterReply(startracker::getId(start), foundId);
|
return scanForSetParameterReply(startracker::getId(start), foundId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TMTC_PARAMREPLY: {
|
case TMTC_PARAMREPLY: {
|
||||||
*foundLen = remainingSize - bytesLeft;
|
*foundLen = remainingSize;
|
||||||
result = scanForGetParameterReply(startracker::getId(start), foundId);
|
return scanForGetParameterReply(startracker::getId(start), foundId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TMTC_TELEMETRYREPLYA:
|
case TMTC_TELEMETRYREPLYA:
|
||||||
case TMTC_TELEMETRYREPLY: {
|
case TMTC_TELEMETRYREPLY: {
|
||||||
*foundLen = remainingSize - bytesLeft;
|
*foundLen = remainingSize;
|
||||||
result = scanForTmReply(startracker::getId(start), foundId);
|
return scanForTmReply(startracker::getId(start), foundId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -870,9 +869,6 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
|
|||||||
result = returnvalue::FAILED;
|
result = returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
remainingSize = bytesLeft;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,13 @@ StrAssembly::StrAssembly(object_id_t objectId) : AssemblyBase(objectId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrAssembly::commandChildren(Mode_t mode, Submode_t submode) {
|
ReturnValue_t StrAssembly::commandChildren(Mode_t mode, Submode_t submode) {
|
||||||
commandTable[0].setMode(mode);
|
// To ensure consistent state.
|
||||||
|
commandTable[0].setMode(MODE_OFF);
|
||||||
commandTable[0].setSubmode(submode);
|
commandTable[0].setSubmode(submode);
|
||||||
|
if (healthHelper.healthTable->getHealth(objects::STAR_TRACKER) != FAULTY) {
|
||||||
|
commandTable[0].setMode(mode);
|
||||||
|
commandTable[0].setSubmode(submode);
|
||||||
|
}
|
||||||
HybridIterator<ModeListEntry> iter(commandTable.begin(), commandTable.end());
|
HybridIterator<ModeListEntry> iter(commandTable.begin(), commandTable.end());
|
||||||
executeTable(iter);
|
executeTable(iter);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit de1188c1bbc890d9b1e3a43cb0c3f06d34e07639
|
Subproject commit 1fb50d84c61fd7ebf393fb0a030a86752f106c53
|
Loading…
Reference in New Issue
Block a user