L3DG20H device handler tested
This commit is contained in:
@ -12,7 +12,7 @@ MGMHandlerRM3100::MGMHandlerRM3100(object_id_t objectId,
|
||||
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
|
||||
primaryDataset(this) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
debugDivider = new PeriodicOperationDivider(10);
|
||||
debugDivider = new PeriodicOperationDivider(5);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -20,28 +20,34 @@ MGMHandlerRM3100::~MGMHandlerRM3100() {}
|
||||
|
||||
void MGMHandlerRM3100::doStartUp() {
|
||||
switch(internalState) {
|
||||
case(InternalState::STATE_NONE): {
|
||||
internalState = InternalState::STATE_CONFIGURE_CMM;
|
||||
case(InternalState::NONE): {
|
||||
internalState = InternalState::CONFIGURE_CMM;
|
||||
break;
|
||||
}
|
||||
case(InternalState::STATE_CONFIGURE_CMM): {
|
||||
internalState = InternalState::STATE_READ_CMM;
|
||||
case(InternalState::CONFIGURE_CMM): {
|
||||
internalState = InternalState::READ_CMM;
|
||||
break;
|
||||
}
|
||||
case(InternalState::STATE_READ_CMM): {
|
||||
case(InternalState::READ_CMM): {
|
||||
if(commandExecuted) {
|
||||
internalState = InternalState::STATE_CONFIGURE_TMRC;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case(InternalState::STATE_CONFIGURE_TMRC): {
|
||||
internalState = InternalState::STATE_READ_TMRC;
|
||||
if(commandExecuted) {
|
||||
internalState = InternalState::STATE_READ_TMRC;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case(InternalState::STATE_READ_TMRC): {
|
||||
if(commandExecuted) {
|
||||
internalState = InternalState::STATE_NORMAL;
|
||||
internalState = InternalState::NORMAL;
|
||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
||||
setMode(MODE_NORMAL);
|
||||
#else
|
||||
setMode(_MODE_TO_ON);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -58,15 +64,15 @@ void MGMHandlerRM3100::doShutDown() {
|
||||
ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand(
|
||||
DeviceCommandId_t *id) {
|
||||
switch(internalState) {
|
||||
case(InternalState::STATE_NONE):
|
||||
case(InternalState::STATE_NORMAL): {
|
||||
case(InternalState::NONE):
|
||||
case(InternalState::NORMAL): {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
case(InternalState::STATE_CONFIGURE_CMM): {
|
||||
case(InternalState::CONFIGURE_CMM): {
|
||||
*id = RM3100::CONFIGURE_CMM;
|
||||
break;
|
||||
}
|
||||
case(InternalState::STATE_READ_CMM): {
|
||||
case(InternalState::READ_CMM): {
|
||||
*id = RM3100::READ_CMM;
|
||||
break;
|
||||
}
|
||||
@ -79,9 +85,9 @@ ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand(
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// might be a configuration error.
|
||||
sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown "
|
||||
<< "internal state!" << std::endl;
|
||||
/* Might be a configuration error. */
|
||||
sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" <<
|
||||
std::endl;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -164,6 +170,9 @@ ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(
|
||||
case(RM3100::CONFIGURE_CYCLE_COUNT):
|
||||
case(RM3100::CONFIGURE_TMRC): {
|
||||
/* We can only check whether write was successful with read operation. */
|
||||
if(mode == _MODE_START_UP) {
|
||||
commandExecuted = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case(RM3100::READ_CMM): {
|
||||
@ -171,12 +180,12 @@ ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(
|
||||
/* We clear the seventh bit in any case
|
||||
* because this one is zero sometimes for some reason */
|
||||
bitutil::bitClear(&cmmValue, 6);
|
||||
if(cmmValue == cmmRegValue) {
|
||||
if(cmmValue == cmmRegValue and internalState == InternalState::READ_CMM) {
|
||||
commandExecuted = true;
|
||||
}
|
||||
else {
|
||||
/* Attempt reconfiguration. */
|
||||
internalState = InternalState::STATE_CONFIGURE_CMM;
|
||||
internalState = InternalState::CONFIGURE_CMM;
|
||||
return DeviceHandlerIF::DEVICE_REPLY_INVALID;
|
||||
}
|
||||
break;
|
||||
@ -304,7 +313,7 @@ void MGMHandlerRM3100::fillCommandAndReplyMap() {
|
||||
}
|
||||
|
||||
void MGMHandlerRM3100::modeChanged(void) {
|
||||
internalState = InternalState::STATE_NONE;
|
||||
internalState = InternalState::NONE;
|
||||
}
|
||||
|
||||
ReturnValue_t MGMHandlerRM3100::initializeLocalDataPool(
|
||||
@ -316,7 +325,7 @@ ReturnValue_t MGMHandlerRM3100::initializeLocalDataPool(
|
||||
}
|
||||
|
||||
uint32_t MGMHandlerRM3100::getTransitionDelayMs(Mode_t from, Mode_t to) {
|
||||
return 10000;
|
||||
return 15000;
|
||||
}
|
||||
|
||||
ReturnValue_t MGMHandlerRM3100::handleDataReadout(const uint8_t *packet) {
|
||||
|
Reference in New Issue
Block a user