Merge pull request 'Smaller lock tweaks' (#423) from smaller_lock_tweaks 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: #423
This commit is contained in:
commit
6c7d1e674c
@ -25,7 +25,7 @@ AcsBoardPolling::AcsBoardPolling(object_id_t objectId, SpiComIF& lowLevelComIF,
|
|||||||
|
|
||||||
ReturnValue_t AcsBoardPolling::performOperation(uint8_t operationCode) {
|
ReturnValue_t AcsBoardPolling::performOperation(uint8_t operationCode) {
|
||||||
while (true) {
|
while (true) {
|
||||||
ipcLock->lockMutex();
|
ipcLock->lockMutex(LOCK_TYPE, LOCK_TIMEOUT);
|
||||||
state = InternalState::IDLE;
|
state = InternalState::IDLE;
|
||||||
ipcLock->unlockMutex();
|
ipcLock->unlockMutex();
|
||||||
semaphore->acquire();
|
semaphore->acquire();
|
||||||
@ -39,7 +39,7 @@ ReturnValue_t AcsBoardPolling::performOperation(uint8_t operationCode) {
|
|||||||
mgmRm3100Handler(mgm3Rm3100);
|
mgmRm3100Handler(mgm3Rm3100);
|
||||||
mgmLis3Handler(mgm0Lis3);
|
mgmLis3Handler(mgm0Lis3);
|
||||||
mgmLis3Handler(mgm2Lis3);
|
mgmLis3Handler(mgm2Lis3);
|
||||||
// To prevent task being not reactivated by tardy tasks
|
// To prevent task being reactivated by tardy tasks
|
||||||
TaskFactory::delayTask(20);
|
TaskFactory::delayTask(20);
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
@ -173,7 +173,6 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send
|
|||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
auto* req = reinterpret_cast<const acs::MgmRm3100Request*>(sendData);
|
auto* req = reinterpret_cast<const acs::MgmRm3100Request*>(sendData);
|
||||||
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
|
||||||
if (req->mode != mgm.mode) {
|
if (req->mode != mgm.mode) {
|
||||||
if (req->mode == acs::SimpleSensorMode::NORMAL) {
|
if (req->mode == acs::SimpleSensorMode::NORMAL) {
|
||||||
mgm.performStartup = true;
|
mgm.performStartup = true;
|
||||||
@ -184,6 +183,8 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send
|
|||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
};
|
};
|
||||||
|
{
|
||||||
|
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
||||||
switch (spiCookie->getChipSelectPin()) {
|
switch (spiCookie->getChipSelectPin()) {
|
||||||
case (gpioIds::MGM_0_LIS3_CS): {
|
case (gpioIds::MGM_0_LIS3_CS): {
|
||||||
handleLis3Request(mgm0Lis3);
|
handleLis3Request(mgm0Lis3);
|
||||||
@ -218,11 +219,11 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
|
||||||
if (state == InternalState::IDLE) {
|
if (state == InternalState::IDLE) {
|
||||||
state = InternalState::BUSY;
|
state = InternalState::BUSY;
|
||||||
semaphore->release();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
semaphore->release();
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,8 +295,8 @@ ReturnValue_t AcsBoardPolling::readReceivedMessage(CookieIF* cookie, uint8_t** b
|
|||||||
|
|
||||||
void AcsBoardPolling::gyroL3gHandler(GyroL3g& l3g) {
|
void AcsBoardPolling::gyroL3gHandler(GyroL3g& l3g) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
acs::SimpleSensorMode mode;
|
acs::SimpleSensorMode mode = acs::SimpleSensorMode::OFF;
|
||||||
bool gyroPerformStartup;
|
bool gyroPerformStartup = false;
|
||||||
{
|
{
|
||||||
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
||||||
mode = l3g.mode;
|
mode = l3g.mode;
|
||||||
@ -440,7 +441,7 @@ ReturnValue_t AcsBoardPolling::readAdisCfg(SpiCookie& cookie, size_t transferLen
|
|||||||
|
|
||||||
void AcsBoardPolling::gyroAdisHandler(GyroAdis& gyro) {
|
void AcsBoardPolling::gyroAdisHandler(GyroAdis& gyro) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
acs::SimpleSensorMode mode;
|
acs::SimpleSensorMode mode = acs::SimpleSensorMode::OFF;
|
||||||
bool cdHasTimedOut = false;
|
bool cdHasTimedOut = false;
|
||||||
bool mustPerformStartup = false;
|
bool mustPerformStartup = false;
|
||||||
{
|
{
|
||||||
@ -542,7 +543,7 @@ void AcsBoardPolling::gyroAdisHandler(GyroAdis& gyro) {
|
|||||||
|
|
||||||
void AcsBoardPolling::mgmLis3Handler(MgmLis3& mgm) {
|
void AcsBoardPolling::mgmLis3Handler(MgmLis3& mgm) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
acs::SimpleSensorMode mode;
|
acs::SimpleSensorMode mode = acs::SimpleSensorMode::OFF;
|
||||||
bool mustPerformStartup = false;
|
bool mustPerformStartup = false;
|
||||||
{
|
{
|
||||||
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
||||||
@ -635,7 +636,7 @@ void AcsBoardPolling::mgmLis3Handler(MgmLis3& mgm) {
|
|||||||
|
|
||||||
void AcsBoardPolling::mgmRm3100Handler(MgmRm3100& mgm) {
|
void AcsBoardPolling::mgmRm3100Handler(MgmRm3100& mgm) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
acs::SimpleSensorMode mode;
|
acs::SimpleSensorMode mode = acs::SimpleSensorMode::OFF;
|
||||||
bool mustPerformStartup = false;
|
bool mustPerformStartup = false;
|
||||||
{
|
{
|
||||||
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
MutexGuard mg(ipcLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
|
||||||
|
@ -84,10 +84,11 @@ ReturnValue_t SafeCtrl::safeMekf(timeval now, double *quatBJ, bool quatBJValid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Will be the version in worst case scenario in event of no working MEKF (nor GYRs)
|
// Will be the version in worst case scenario in event of no working MEKF (nor GYRs)
|
||||||
ReturnValue_t SafeCtrl::safeNoMekf(timeval now, double *susDirB, bool susDirBValid, double *sunRateB,
|
ReturnValue_t SafeCtrl::safeNoMekf(timeval now, double *susDirB, bool susDirBValid,
|
||||||
bool sunRateBValid, double *magFieldB, bool magFieldBValid,
|
double *sunRateB, bool sunRateBValid, double *magFieldB,
|
||||||
double *magRateB, bool magRateBValid, double *sunDirRef,
|
bool magFieldBValid, double *magRateB, bool magRateBValid,
|
||||||
double *satRateRef, double *outputAngle, double *outputMagMomB) {
|
double *sunDirRef, double *satRateRef, double *outputAngle,
|
||||||
|
double *outputMagMomB) {
|
||||||
// Check for invalid Inputs
|
// Check for invalid Inputs
|
||||||
if (!susDirBValid || !magFieldBValid || !magRateBValid) {
|
if (!susDirBValid || !magFieldBValid || !magRateBValid) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit 77fbcede10d44fd15dc7d5d1b3965f06c6a8e7fc
|
Subproject commit 74e6d6fe5f10121e8444662a79fa10fada3d978c
|
Loading…
Reference in New Issue
Block a user