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