replaced last sent command with
getPendingCommand()
This commit is contained in:
parent
b55f857634
commit
483481b440
@ -105,13 +105,11 @@ ReturnValue_t MGMHandlerLIS3MDL::buildNormalDeviceCommand(
|
||||
DeviceCommandId_t *id) {
|
||||
// Data/config register will be read in an alternating manner.
|
||||
if(communicationStep == CommunicationStep::DATA) {
|
||||
lastSentCommand = MGMLIS3MDL::READ_CONFIG_AND_DATA;
|
||||
*id = MGMLIS3MDL::READ_CONFIG_AND_DATA;
|
||||
communicationStep = CommunicationStep::TEMPERATURE;
|
||||
return buildCommandFromCommand(*id, NULL, 0);
|
||||
}
|
||||
else {
|
||||
lastSentCommand = MGMLIS3MDL::READ_TEMPERATURE;
|
||||
*id = MGMLIS3MDL::READ_TEMPERATURE;
|
||||
communicationStep = CommunicationStep::DATA;
|
||||
return buildCommandFromCommand(*id, NULL, 0);
|
||||
@ -122,7 +120,6 @@ ReturnValue_t MGMHandlerLIS3MDL::buildNormalDeviceCommand(
|
||||
ReturnValue_t MGMHandlerLIS3MDL::buildCommandFromCommand(
|
||||
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||
size_t commandDataLen) {
|
||||
lastSentCommand = deviceCommand;
|
||||
switch(deviceCommand) {
|
||||
case(MGMLIS3MDL::READ_CONFIG_AND_DATA): {
|
||||
std::memset(commandBuffer, 0, sizeof(commandBuffer));
|
||||
@ -154,7 +151,6 @@ ReturnValue_t MGMHandlerLIS3MDL::buildCommandFromCommand(
|
||||
return setOperatingMode(commandData, commandDataLen);
|
||||
}
|
||||
default:
|
||||
lastSentCommand = DeviceHandlerIF::NO_COMMAND;
|
||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
@ -198,7 +194,7 @@ ReturnValue_t MGMHandlerLIS3MDL::scanForReply(const uint8_t *start,
|
||||
}
|
||||
else if (len == SINGLE_COMMAND_ANSWER_LEN) {
|
||||
*foundLen = len;
|
||||
*foundId = lastSentCommand;
|
||||
*foundId = getPendingCommand();
|
||||
}
|
||||
else {
|
||||
return DeviceHandlerIF::INVALID_DATA;
|
||||
|
@ -137,13 +137,6 @@ private:
|
||||
|
||||
uint8_t statusRegister = 0;
|
||||
|
||||
|
||||
/**
|
||||
* As this is a SPI Device, we get the Answer of the last sent command in
|
||||
* the next read cycle, so we could check the command for identification.
|
||||
*/
|
||||
DeviceCommandId_t lastSentCommand = DeviceHandlerIF::NO_COMMAND;
|
||||
|
||||
/**
|
||||
* We always update all registers together, so this method updates
|
||||
* the rawpacket and rawpacketLen, so we just manipulate the local
|
||||
|
Loading…
Reference in New Issue
Block a user