lis3 bugfixes

This commit is contained in:
Robin Müller 2020-10-21 20:13:27 +02:00
parent 8be0edf151
commit 4bf20b6944
2 changed files with 11 additions and 13 deletions

View File

@ -6,7 +6,7 @@
#ifndef CONFIG_OBSWCONFIG_H_ #ifndef CONFIG_OBSWCONFIG_H_
#define 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 not used yet, PUS stack and TMTC tasks are always started
#define ADD_PUS_STACK 1 #define ADD_PUS_STACK 1

View File

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