From 483481b44040195d2e18af04e311e75c8d98a7d0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 00:36:39 +0100 Subject: [PATCH] replaced last sent command with getPendingCommand() --- mission/devices/MGMHandlerLIS3MDL.cpp | 6 +----- mission/devices/MGMHandlerLIS3MDL.h | 7 ------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 35b71c79..7bb4fec1 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -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; diff --git a/mission/devices/MGMHandlerLIS3MDL.h b/mission/devices/MGMHandlerLIS3MDL.h index c48b1fc2..875d453d 100644 --- a/mission/devices/MGMHandlerLIS3MDL.h +++ b/mission/devices/MGMHandlerLIS3MDL.h @@ -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