lis3 bugfixes

This commit is contained in:
Robin Müller 2020-10-21 20:13:27 +02:00 committed by Robin.Mueller
parent 38779e619a
commit ddb76ff61b
2 changed files with 11 additions and 13 deletions

View File

@ -6,7 +6,7 @@
#ifndef CONFIG_OBSWCONFIG_H_
#define CONFIG_OBSWCONFIG_H_
#define ADD_TEST_CODE 1
#define OBSW_ADD_TEST_CODE 1
// Define not used yet, PUS stack and TMTC tasks are always started
#define ADD_PUS_STACK 1

View File

@ -112,17 +112,15 @@ ReturnValue_t MGMHandlerLIS3MDL::buildNormalDeviceCommand(
ReturnValue_t MGMHandlerLIS3MDL::buildCommandFromCommand(
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) {
lastSentCommand = deviceCommand;
switch(deviceCommand) {
case(MGMLIS3MDL::READALL_MGM): {
if (commandDataLen == 0) {
std::memset(commandBuffer, 0, sizeof(commandBuffer));
commandBuffer[0] = readCommand(0, true);
lastSentCommand = deviceCommand;
switch(deviceCommand) {
case(MGMLIS3MDL::READALL_MGM): {
std::memset(commandBuffer, 0, sizeof(commandBuffer));
commandBuffer[0] = readCommand(0, true);
rawPacket = commandBuffer;
rawPacketLen = sizeof(commandBuffer);
return RETURN_OK;
}
rawPacket = commandBuffer;
rawPacketLen = sizeof(commandBuffer);
return RETURN_OK;
case(MGMLIS3MDL::IDENTIFY_DEVICE): {
return identifyDevice();
}
@ -346,8 +344,8 @@ ReturnValue_t MGMHandlerLIS3MDL::prepareRegisterWrite() {
commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1, true);
for (size_t i = 1; i <= MGMLIS3MDL::NR_OF_CTRL_REGISTERS; i++) {
commandBuffer[i] = registers[i];
for (size_t i = 0; i < MGMLIS3MDL::NR_OF_CTRL_REGISTERS; i++) {
commandBuffer[i + 1] = registers[i];
}
rawPacket = commandBuffer;
rawPacketLen = MGMLIS3MDL::NR_OF_CTRL_REGISTERS;