Update package #25
@ -99,12 +99,12 @@ void ObjectFactory::produce(){
|
||||
gpioIF->addGpios(gpioCookieAcsBoard);
|
||||
|
||||
std::string spiDev = "/dev/spidev0.0";
|
||||
SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3,
|
||||
gpioIds::MGM_0_LIS3_CS, spiDev, 24, spi::SpiMode::MODE_3, 3'900'000);
|
||||
SpiCookie* spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, 24,
|
||||
spi::SpiMode::MODE_3, 3'900'000);
|
||||
auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER,
|
||||
objects::SPI_COM_IF, spiCookie);
|
||||
mgmLis3Handler->setStartUpImmediately();
|
||||
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, 32,
|
||||
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, 16,
|
||||
spi::SpiMode::MODE_3, 976'000);
|
||||
auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER,
|
||||
objects::SPI_COM_IF, spiCookie);
|
||||
|
@ -7,8 +7,8 @@
|
||||
#define RPI_LOOPBACK_TEST_GPIO 0
|
||||
|
||||
/* Only one of those 2 should be enabled! */
|
||||
#define RPI_ADD_SPI_TEST 1
|
||||
#define RPI_TEST_ACS_BOARD 0
|
||||
#define RPI_ADD_SPI_TEST 0
|
||||
#define RPI_TEST_ACS_BOARD 1
|
||||
|
||||
/* Adapt these values accordingly */
|
||||
namespace gpio {
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 17b8d3fed05cae6e208dc3f14b6ba0d44c9ec5ef
|
||||
Subproject commit 778ef4ef230019ca4b155a77518156793cf5d308
|
@ -26,7 +26,8 @@ debugging. */
|
||||
#define PDU2_DEBUG 0
|
||||
#define ACU_DEBUG 1
|
||||
|
||||
#define FSFW_LINUX_SPI_WIRETAPPING 1
|
||||
/* Can be used for low-level debugging of the SPI bus */
|
||||
#define FSFW_LINUX_SPI_WIRETAPPING 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include "MGMHandlerRM3100.h"
|
||||
|
||||
#include <fsfw/globalfunctions/bitutility.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerMessage.h>
|
||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
@ -122,8 +123,7 @@ ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand(
|
||||
commandDataLen);
|
||||
}
|
||||
case(RM3100::READ_CYCLE_COUNT): {
|
||||
commandBuffer[0] = RM3100::CYCLE_COUNT_START_REGISTER |
|
||||
RM3100::READ_MASK;
|
||||
commandBuffer[0] = RM3100::CYCLE_COUNT_START_REGISTER | RM3100::READ_MASK;
|
||||
std::memset(commandBuffer + 1, 0, 6);
|
||||
rawPacket = commandBuffer;
|
||||
rawPacketLen = 7;
|
||||
@ -168,7 +168,11 @@ ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(
|
||||
break;
|
||||
}
|
||||
case(RM3100::READ_CMM): {
|
||||
if(packet[1] == cmmRegValue) {
|
||||
uint8_t cmmValue = packet[1];
|
||||
/* We clear the seventh bit in any case
|
||||
* because this one is zero sometimes for some reason */
|
||||
bitutil::bitClear(&cmmValue, 6);
|
||||
if(cmmValue == cmmRegValue) {
|
||||
commandExecuted = true;
|
||||
}
|
||||
else {
|
||||
@ -197,14 +201,13 @@ ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(
|
||||
uint16_t cycleCountX = packet[1] << 8 | packet[2];
|
||||
uint16_t cycleCountY = packet[3] << 8 | packet[4];
|
||||
uint16_t cycleCountZ = packet[5] << 8 | packet[6];
|
||||
if(cycleCountX != cycleCountRegValueX or
|
||||
cycleCountY != cycleCountRegValueY or
|
||||
if(cycleCountX != cycleCountRegValueX or cycleCountY != cycleCountRegValueY or
|
||||
cycleCountZ != cycleCountRegValueZ) {
|
||||
return DeviceHandlerIF::DEVICE_REPLY_INVALID;
|
||||
}
|
||||
/* Reading TMRC was commanded. Trigger event to inform ground. */
|
||||
if(mode != _MODE_START_UP) {
|
||||
uint32_t eventParam1 = cycleCountX << 16 | cycleCountY;
|
||||
uint32_t eventParam1 = (cycleCountX << 16) | cycleCountY;
|
||||
triggerEvent(cycleCountersSet, eventParam1, cycleCountZ);
|
||||
}
|
||||
break;
|
||||
@ -220,9 +223,8 @@ ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t MGMHandlerRM3100::handleCycleCountConfigCommand(
|
||||
DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t MGMHandlerRM3100::handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t *commandData, size_t commandDataLen) {
|
||||
if(commandData == nullptr) {
|
||||
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
|
||||
}
|
||||
@ -256,14 +258,12 @@ ReturnValue_t MGMHandlerRM3100::handleCycleCommand(bool oneCycleValue,
|
||||
return result;
|
||||
}
|
||||
|
||||
// Data sheet p.30
|
||||
// "while noise limits the useful upper range to ~400 cycle counts."
|
||||
/* Data sheet p.30 "while noise limits the useful upper range to ~400 cycle counts." */
|
||||
if(command.cycleCountX > 450 ) {
|
||||
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
|
||||
}
|
||||
|
||||
if(not oneCycleValue and
|
||||
(command.cycleCountY > 450 or command.cycleCountZ > 450)) {
|
||||
if(not oneCycleValue and (command.cycleCountY > 450 or command.cycleCountZ > 450)) {
|
||||
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
|
||||
}
|
||||
|
||||
@ -310,12 +310,9 @@ void MGMHandlerRM3100::modeChanged(void) {
|
||||
|
||||
ReturnValue_t MGMHandlerRM3100::initializeLocalDataPool(
|
||||
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_X,
|
||||
new PoolEntry<float>({0.0}));
|
||||
localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Y,
|
||||
new PoolEntry<float>({0.0}));
|
||||
localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Z,
|
||||
new PoolEntry<float>({0.0}));
|
||||
localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_X, new PoolEntry<float>({0.0}));
|
||||
localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Y, new PoolEntry<float>({0.0}));
|
||||
localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Z, new PoolEntry<float>({0.0}));
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user