some tweaks for busy handling #500

Merged
muellerr merged 28 commits from tweak_papb_busy_polling into develop 2023-03-24 14:15:01 +01:00
6 changed files with 122 additions and 91 deletions
Showing only changes of commit a75b4fd951 - Show all commits

View File

@ -16,6 +16,16 @@ will consitute of a breaking change warranting a new major release:
# [unreleased] # [unreleased]
## Fixed
- Fixed transition for dual power lane assemblies: When going from dual side submode to single side
submode, perform logical commanding first, similarly to when going to OFF mode.
## Changed
- Updated GYR bias values to newest measurements. This also corrects the ADIS values to always
consit of just one digit.
# [v1.38.0] 2023-03-17 # [v1.38.0] 2023-03-17
eive-tmtc: v2.19.2 eive-tmtc: v2.19.2

View File

@ -451,7 +451,12 @@ void AcsBoardPolling::gyroAdisHandler(GyroAdis& gyro) {
cdHasTimedOut = gyro.countdown.hasTimedOut(); cdHasTimedOut = gyro.countdown.hasTimedOut();
mustPerformStartup = gyro.performStartup; mustPerformStartup = gyro.performStartup;
} }
if (mode == acs::SimpleSensorMode::NORMAL and cdHasTimedOut) { if (mode == acs::SimpleSensorMode::OFF) {
return;
}
if (not cdHasTimedOut) {
return;
}
if (mustPerformStartup) { if (mustPerformStartup) {
uint8_t regList[6]; uint8_t regList[6];
// Read configuration // Read configuration
@ -539,7 +544,6 @@ void AcsBoardPolling::gyroAdisHandler(GyroAdis& gyro) {
gyro.ownReply.data.accelerations[2] = (rawReply[14] << 8) | rawReply[15]; gyro.ownReply.data.accelerations[2] = (rawReply[14] << 8) | rawReply[15];
gyro.ownReply.data.temperatureRaw = (rawReply[16] << 8) | rawReply[17]; gyro.ownReply.data.temperatureRaw = (rawReply[16] << 8) | rawReply[17];
}
} }
void AcsBoardPolling::mgmLis3Handler(MgmLis3& mgm) { void AcsBoardPolling::mgmLis3Handler(MgmLis3& mgm) {

View File

@ -768,10 +768,10 @@ class AcsParameters : public HasParametersIF {
double gyr2orientationMatrix[3][3] = {{0, 0, -1}, {0, -1, 0}, {-1, 0, 0}}; double gyr2orientationMatrix[3][3] = {{0, 0, -1}, {0, -1, 0}, {-1, 0, 0}};
double gyr3orientationMatrix[3][3] = {{0, 0, -1}, {0, 1, 0}, {1, 0, 0}}; double gyr3orientationMatrix[3][3] = {{0, 0, -1}, {0, 1, 0}, {1, 0, 0}};
double gyr0bias[3] = {0.06318149743589743, 0.4283235025641024, -0.16383500000000004}; double gyr0bias[3] = {0.0, 0.4, -0.1};
double gyr1bias[3] = {-0.12855128205128205, 1.6737307692307695, 1.031724358974359}; double gyr1bias[3] = {0.0956745283018868, 2.0854575471698116, 1.2505990566037737};
double gyr2bias[3] = {0.15039212820512823, 0.7094475589743591, -0.22298363589743594}; double gyr2bias[3] = {0.1, 0.7, -0.2};
double gyr3bias[3] = {0.0021730769230769217, -0.6655897435897435, 0.034096153846153845}; double gyr3bias[3] = {-0.10721698113207549, -0.6111650943396226, 0.1716462264150944};
/* var = sigma^2, sigma = RND*sqrt(freq), following values are RND^2 and not var as freq is /* var = sigma^2, sigma = RND*sqrt(freq), following values are RND^2 and not var as freq is
* assumed to be equal for the same class of sensors */ * assumed to be equal for the same class of sensors */

View File

@ -65,10 +65,7 @@ ReturnValue_t GyrAdis1650XHandler::buildTransitionDeviceCommand(DeviceCommandId_
} }
case (InternalState::SHUTDOWN): { case (InternalState::SHUTDOWN): {
*id = adis1650x::REQUEST; *id = adis1650x::REQUEST;
acs::Adis1650XRequest *request = reinterpret_cast<acs::Adis1650XRequest *>(cmdBuf.data()); return preparePeriodicRequest(acs::SimpleSensorMode::OFF);
request->mode = acs::SimpleSensorMode::OFF;
request->type = adisType;
return returnvalue::OK;
} }
default: { default: {
return NOTHING_TO_SEND; return NOTHING_TO_SEND;

View File

@ -34,10 +34,17 @@ void DualLaneAssemblyBase::performChildOperation() {
} }
void DualLaneAssemblyBase::startTransition(Mode_t mode, Submode_t submode) { void DualLaneAssemblyBase::startTransition(Mode_t mode, Submode_t submode) {
// doStartTransition(mode, submode);
using namespace duallane; using namespace duallane;
pwrStateMachine.reset(); pwrStateMachine.reset();
if (mode != MODE_OFF) { if (mode != MODE_OFF) {
// Special exception: A transition from dual side to single mode must be handled like
// going OFF.
if ((this->mode == MODE_ON or this->mode == DeviceHandlerIF::MODE_NORMAL) and
this->submode == DUAL_MODE and submode != DUAL_MODE) {
dualToSingleSideTransition = true;
AssemblyBase::startTransition(mode, submode);
return;
}
// If anything other than MODE_OFF is commanded, perform power state machine first // If anything other than MODE_OFF is commanded, perform power state machine first
// Cache the target modes, required by power state machine // Cache the target modes, required by power state machine
pwrStateMachine.start(mode, submode); pwrStateMachine.start(mode, submode);
@ -75,9 +82,13 @@ ReturnValue_t DualLaneAssemblyBase::pwrStateMachineWrapper() {
// Will be called for transitions to MODE_OFF, where everything is done after power switching // Will be called for transitions to MODE_OFF, where everything is done after power switching
finishModeOp(); finishModeOp();
} else if (opCode == OpCodes::TO_NOT_OFF_DONE) { } else if (opCode == OpCodes::TO_NOT_OFF_DONE) {
if (dualToSingleSideTransition) {
finishModeOp();
} else {
// Will be called for transitions from MODE_OFF to anything else, where the mode still has // Will be called for transitions from MODE_OFF to anything else, where the mode still has
// to be commanded after power switching // to be commanded after power switching
AssemblyBase::startTransition(targetMode, targetSubmode); AssemblyBase::startTransition(targetMode, targetSubmode);
}
} else if (opCode == OpCodes::TIMEOUT_OCCURED) { } else if (opCode == OpCodes::TIMEOUT_OCCURED) {
if (powerRetryCounter == 0) { if (powerRetryCounter == 0) {
powerRetryCounter++; powerRetryCounter++;
@ -118,6 +129,13 @@ void DualLaneAssemblyBase::handleModeReached() {
// Ignore failures for now. // Ignore failures for now.
pwrStateMachineWrapper(); pwrStateMachineWrapper();
} else { } else {
// For dual to single side transition, devices should be logically off, but the switch
// handling still needs to be done.
if (dualToSingleSideTransition) {
pwrStateMachine.start(targetMode, targetSubmode);
pwrStateMachineWrapper();
return;
}
finishModeOp(); finishModeOp();
} }
} }
@ -229,6 +247,7 @@ void DualLaneAssemblyBase::finishModeOp() {
pwrStateMachine.reset(); pwrStateMachine.reset();
powerRetryCounter = 0; powerRetryCounter = 0;
tryingOtherSide = false; tryingOtherSide = false;
dualToSingleSideTransition = false;
dualModeErrorSwitch = true; dualModeErrorSwitch = true;
} }

View File

@ -31,6 +31,7 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
uint8_t powerRetryCounter = 0; uint8_t powerRetryCounter = 0;
bool tryingOtherSide = false; bool tryingOtherSide = false;
bool dualModeErrorSwitch = true; bool dualModeErrorSwitch = true;
bool dualToSingleSideTransition = false;
duallane::Submodes defaultSubmode = duallane::Submodes::A_SIDE; duallane::Submodes defaultSubmode = duallane::Submodes::A_SIDE;
enum RecoveryCustomStates { enum RecoveryCustomStates {