v1.10.0 #220
@ -347,17 +347,17 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
|
|||||||
gpioComIF->addGpios(gpioCookieSus);
|
gpioComIF->addGpios(gpioCookieSus);
|
||||||
|
|
||||||
SpiCookie* spiCookie =
|
SpiCookie* spiCookie =
|
||||||
new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, std::string(q7s::SPI_DEFAULT_DEV),
|
new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, q7s::SPI_DEFAULT_DEV, SUS::MAX_CMD_SIZE,
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler0 =
|
SusHandler* susHandler0 =
|
||||||
new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_0);
|
new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_0);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, std::string(q7s::SPI_DEFAULT_DEV),
|
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, q7s::SPI_DEFAULT_DEV,
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler1 =
|
SusHandler* susHandler1 =
|
||||||
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_1);
|
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_1);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, std::string(q7s::SPI_DEFAULT_DEV),
|
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, q7s::SPI_DEFAULT_DEV,
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler2 =
|
SusHandler* susHandler2 =
|
||||||
new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_2);
|
new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_2);
|
||||||
@ -377,33 +377,32 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
|
|||||||
SusHandler* susHandler5 =
|
SusHandler* susHandler5 =
|
||||||
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_5);
|
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_5);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, std::string(q7s::SPI_DEFAULT_DEV),
|
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, q7s::SPI_DEFAULT_DEV,
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler6 =
|
SusHandler* susHandler6 =
|
||||||
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_6);
|
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_6);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, std::string(q7s::SPI_DEFAULT_DEV),
|
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, q7s::SPI_DEFAULT_DEV,
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler7 =
|
SusHandler* susHandler7 =
|
||||||
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_7);
|
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_7);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, std::string(q7s::SPI_DEFAULT_DEV),
|
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, q7s::SPI_DEFAULT_DEV,
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler8 =
|
SusHandler* susHandler8 =
|
||||||
new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_8);
|
new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_8);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, std::string(q7s::SPI_DEFAULT_DEV),
|
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, q7s::SPI_DEFAULT_DEV,
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler9 =
|
SusHandler* susHandler9 =
|
||||||
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_9);
|
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookie, gpioComIF, gpioIds::CS_SUS_9);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_10, std::string(q7s::SPI_DEFAULT_DEV),
|
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, q7s::SPI_DEFAULT_DEV,
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler10 = new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookie,
|
SusHandler* susHandler10 = new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookie,
|
||||||
gpioComIF, gpioIds::CS_SUS_10);
|
gpioComIF, gpioIds::CS_SUS_10);
|
||||||
|
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, q7s::SPI_DEFAULT_DEV,
|
||||||
new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, std::string(q7s::SPI_DEFAULT_DEV),
|
|
||||||
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX1227_SPI_FREQ);
|
||||||
SusHandler* susHandler11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookie,
|
SusHandler* susHandler11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookie,
|
||||||
gpioComIF, gpioIds::CS_SUS_11);
|
gpioComIF, gpioIds::CS_SUS_11);
|
||||||
@ -419,7 +418,7 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
|
|||||||
static_cast<void>(susHandler9);
|
static_cast<void>(susHandler9);
|
||||||
static_cast<void>(susHandler10);
|
static_cast<void>(susHandler10);
|
||||||
static_cast<void>(susHandler11);
|
static_cast<void>(susHandler11);
|
||||||
#if OBSW_TEST_SUS == 1
|
#if OBSW_TEST_SUS_HANDLER == 1
|
||||||
susHandler0->setStartUpImmediately();
|
susHandler0->setStartUpImmediately();
|
||||||
susHandler1->setStartUpImmediately();
|
susHandler1->setStartUpImmediately();
|
||||||
susHandler2->setStartUpImmediately();
|
susHandler2->setStartUpImmediately();
|
||||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit 32a9e0c7044665f0265c10108c8d62d45c047769
|
Subproject commit 81f5b0c3bf3e602f5cc459dc39bc1e8885c932a7
|
@ -9,39 +9,11 @@ SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCoo
|
|||||||
LinuxLibgpioIF *gpioComIF, gpioId_t chipSelectId)
|
LinuxLibgpioIF *gpioComIF, gpioId_t chipSelectId)
|
||||||
: DeviceHandlerBase(objectId, comIF, comCookie),
|
: DeviceHandlerBase(objectId, comIF, comCookie),
|
||||||
divider(5),
|
divider(5),
|
||||||
gpioComIF(gpioComIF),
|
|
||||||
chipSelectId(chipSelectId),
|
|
||||||
dataset(this) {
|
dataset(this) {
|
||||||
if (comCookie == nullptr) {
|
|
||||||
sif::error << "SusHandler: Invalid com cookie" << std::endl;
|
|
||||||
}
|
|
||||||
if (gpioComIF == nullptr) {
|
|
||||||
sif::error << "SusHandler: Invalid GpioComIF" << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SusHandler::~SusHandler() {}
|
SusHandler::~SusHandler() {}
|
||||||
|
|
||||||
ReturnValue_t SusHandler::performOperation(uint8_t counter) {
|
|
||||||
if (counter != FIRST_WRITE) {
|
|
||||||
DeviceHandlerBase::performOperation(counter);
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode != MODE_NORMAL) {
|
|
||||||
DeviceHandlerBase::performOperation(DeviceHandlerIF::SEND_WRITE);
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If device is in normale mode the communication sequence is initiated here */
|
|
||||||
if (communicationStep == CommunicationStep::IDLE) {
|
|
||||||
communicationStep = CommunicationStep::WRITE_SETUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceHandlerBase::performOperation(DeviceHandlerIF::SEND_WRITE);
|
|
||||||
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t SusHandler::initialize() {
|
ReturnValue_t SusHandler::initialize() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
@ -49,48 +21,57 @@ ReturnValue_t SusHandler::initialize() {
|
|||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
auto spiComIF = dynamic_cast<SpiComIF *>(communicationInterface);
|
|
||||||
if (spiComIF == nullptr) {
|
|
||||||
sif::debug << "SusHandler::initialize: Invalid communication interface" << std::endl;
|
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
||||||
}
|
|
||||||
spiMutex = spiComIF->getMutex();
|
|
||||||
if (spiMutex == nullptr) {
|
|
||||||
sif::debug << "SusHandler::initialize: Failed to get spi mutex" << std::endl;
|
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
||||||
}
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SusHandler::doStartUp() {
|
void SusHandler::doStartUp() {
|
||||||
|
if (comState == ComStates::IDLE) {
|
||||||
|
comState = ComStates::WRITE_SETUP;
|
||||||
|
}
|
||||||
|
if(comState == ComStates::WRITE_SETUP) {
|
||||||
|
if (commandExecuted) {
|
||||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
||||||
setMode(MODE_NORMAL);
|
setMode(MODE_NORMAL);
|
||||||
#else
|
#else
|
||||||
setMode(_MODE_TO_ON);
|
setMode(_MODE_TO_ON);
|
||||||
#endif
|
#endif
|
||||||
|
commandExecuted = false;
|
||||||
|
comState = ComStates::START_CONVERSIONS;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SusHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
void SusHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
||||||
|
|
||||||
ReturnValue_t SusHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
ReturnValue_t SusHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||||
if (communicationStep == CommunicationStep::IDLE) {
|
switch (comState) {
|
||||||
|
case (ComStates::IDLE): {
|
||||||
return NOTHING_TO_SEND;
|
return NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
|
case (ComStates::WRITE_SETUP): {
|
||||||
if (communicationStep == CommunicationStep::WRITE_SETUP) {
|
|
||||||
*id = SUS::WRITE_SETUP;
|
*id = SUS::WRITE_SETUP;
|
||||||
communicationStep = CommunicationStep::START_CONVERSIONS;
|
comState = ComStates::START_CONVERSIONS;
|
||||||
} else if (communicationStep == CommunicationStep::START_CONVERSIONS) {
|
|
||||||
*id = SUS::START_CONVERSIONS;
|
|
||||||
communicationStep = CommunicationStep::READ_CONVERSIONS;
|
|
||||||
} else if (communicationStep == CommunicationStep::READ_CONVERSIONS) {
|
|
||||||
*id = SUS::READ_CONVERSIONS;
|
|
||||||
communicationStep = CommunicationStep::IDLE;
|
|
||||||
}
|
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
|
}
|
||||||
|
case (ComStates::START_CONVERSIONS): {
|
||||||
|
*id = SUS::START_CONVERSIONS;
|
||||||
|
comState = ComStates::READ_CONVERSIONS;
|
||||||
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
|
}
|
||||||
|
case (ComStates::READ_CONVERSIONS): {
|
||||||
|
*id = SUS::READ_CONVERSIONS;
|
||||||
|
comState = ComStates::START_CONVERSIONS;
|
||||||
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SusHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
ReturnValue_t SusHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||||
|
if (comState == ComStates::WRITE_SETUP) {
|
||||||
|
*id = SUS::WRITE_SETUP;
|
||||||
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,27 +80,6 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (SUS::WRITE_SETUP): {
|
case (SUS::WRITE_SETUP): {
|
||||||
/**
|
|
||||||
* The sun sensor ADC is shutdown when CS is pulled high, so each time requesting a
|
|
||||||
* measurement the setup has to be rewritten. There must also be a little delay between
|
|
||||||
* the transmission of the setup byte and the first conversion. Thus the conversion
|
|
||||||
* will be performed in an extra step.
|
|
||||||
* Because the chip select is driven manually by the SusHandler the SPI bus must be
|
|
||||||
* protected with a mutex here.
|
|
||||||
*/
|
|
||||||
ReturnValue_t result = spiMutex->lockMutex(timeoutType, timeoutMs);
|
|
||||||
if (result == MutexIF::MUTEX_TIMEOUT) {
|
|
||||||
sif::error << "SusHandler::buildCommandFromCommand: Mutex timeout" << std::endl;
|
|
||||||
return ERROR_LOCK_MUTEX;
|
|
||||||
} else if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "SusHandler::buildCommandFromCommand: Failed to lock spi mutex" << std::endl;
|
|
||||||
return ERROR_LOCK_MUTEX;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = gpioComIF->pullLow(chipSelectId);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
cmdBuffer[0] = SUS::SETUP;
|
cmdBuffer[0] = SUS::SETUP;
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
rawPacketLen = 1;
|
rawPacketLen = 1;
|
||||||
@ -145,8 +105,8 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SusHandler::fillCommandAndReplyMap() {
|
void SusHandler::fillCommandAndReplyMap() {
|
||||||
this->insertInCommandMap(SUS::WRITE_SETUP);
|
this->insertInCommandAndReplyMap(SUS::WRITE_SETUP, 1);
|
||||||
this->insertInCommandMap(SUS::START_CONVERSIONS);
|
this->insertInCommandAndReplyMap(SUS::START_CONVERSIONS, 1);
|
||||||
this->insertInCommandAndReplyMap(SUS::READ_CONVERSIONS, 1, &dataset, SUS::SIZE_READ_CONVERSIONS);
|
this->insertInCommandAndReplyMap(SUS::READ_CONVERSIONS, 1, &dataset, SUS::SIZE_READ_CONVERSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +119,15 @@ ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t remainingSiz
|
|||||||
|
|
||||||
ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
case SUS::WRITE_SETUP: {
|
||||||
|
if (mode == _MODE_START_UP) {
|
||||||
|
commandExecuted = true;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
case SUS::START_CONVERSIONS: {
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
case SUS::READ_CONVERSIONS: {
|
case SUS::READ_CONVERSIONS: {
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125;
|
dataset.temperatureCelcius = (*(packet) << 8 | *(packet + 1)) * 0.125;
|
||||||
@ -170,29 +139,16 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
|
|||||||
dataset.ain5 = (*(packet + 12) << 8 | *(packet + 13));
|
dataset.ain5 = (*(packet + 12) << 8 | *(packet + 13));
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1
|
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1
|
||||||
if (divider.checkAndIncrement()) {
|
if (divider.checkAndIncrement()) {
|
||||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId()
|
sif::info << "SUS object ID 0x" << std::hex << this->getObjectId() << ":" << std::endl;
|
||||||
<< ", Temperature: " << dataset.temperatureCelcius << " C" << std::endl;
|
sif::info << "Temperature: " << dataset.temperatureCelcius << " C" << std::endl;
|
||||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN0: " << std::dec
|
sif::info << "AIN0: " << std::dec << dataset.ain0 << std::endl;
|
||||||
<< dataset.ain0 << std::endl;
|
sif::info << "AIN1: " << std::dec << dataset.ain1 << std::endl;
|
||||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN1: " << std::dec
|
sif::info << "AIN2: " << std::dec << dataset.ain2 << std::endl;
|
||||||
<< dataset.ain1 << std::endl;
|
sif::info << "AIN3: " << std::dec << dataset.ain3 << std::endl;
|
||||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN2: " << std::dec
|
sif::info << "AIN4: " << std::dec << dataset.ain4 << std::endl;
|
||||||
<< dataset.ain2 << std::endl;
|
sif::info << "AIN5: " << std::dec << dataset.ain5 << std::endl;
|
||||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN3: " << std::dec
|
|
||||||
<< dataset.ain3 << std::endl;
|
|
||||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN4: " << std::dec
|
|
||||||
<< dataset.ain4 << std::endl;
|
|
||||||
sif::info << "SUS object id 0x" << std::hex << this->getObjectId() << ", AIN5: " << std::dec
|
|
||||||
<< dataset.ain5 << std::endl;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/** SUS can now be shutdown and thus the SPI bus released again */
|
|
||||||
gpioComIF->pullHigh(chipSelectId);
|
|
||||||
ReturnValue_t result = spiMutex->unlockMutex();
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
sif::error << "SusHandler::interpretDeviceReply: Failed to unlock spi mutex" << std::endl;
|
|
||||||
return ERROR_UNLOCK_MUTEX;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -203,8 +159,6 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SusHandler::setNormalDatapoolEntriesInvalid() {}
|
|
||||||
|
|
||||||
uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1000; }
|
uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 1000; }
|
||||||
|
|
||||||
ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
|
@ -28,7 +28,7 @@ class SusHandler : public DeviceHandlerBase {
|
|||||||
LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId);
|
LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId);
|
||||||
virtual ~SusHandler();
|
virtual ~SusHandler();
|
||||||
|
|
||||||
virtual ReturnValue_t performOperation(uint8_t counter) override;
|
// virtual ReturnValue_t performOperation(uint8_t counter) override;
|
||||||
|
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
void setToGoToNormalMode(bool enable);
|
void setToGoToNormalMode(bool enable);
|
||||||
@ -44,7 +44,7 @@ class SusHandler : public DeviceHandlerBase {
|
|||||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||||
size_t* foundLen) override;
|
size_t* foundLen) override;
|
||||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||||
void setNormalDatapoolEntriesInvalid() override;
|
//void setNormalDatapoolEntriesInvalid() override;
|
||||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
@ -55,17 +55,18 @@ class SusHandler : public DeviceHandlerBase {
|
|||||||
static const ReturnValue_t ERROR_UNLOCK_MUTEX = MAKE_RETURN_CODE(0xA0);
|
static const ReturnValue_t ERROR_UNLOCK_MUTEX = MAKE_RETURN_CODE(0xA0);
|
||||||
static const ReturnValue_t ERROR_LOCK_MUTEX = MAKE_RETURN_CODE(0xA1);
|
static const ReturnValue_t ERROR_LOCK_MUTEX = MAKE_RETURN_CODE(0xA1);
|
||||||
|
|
||||||
enum class CommunicationStep { IDLE, WRITE_SETUP, START_CONVERSIONS, READ_CONVERSIONS };
|
enum class ComStates { IDLE, WRITE_SETUP, START_CONVERSIONS, READ_CONVERSIONS };
|
||||||
|
|
||||||
PeriodicOperationDivider divider;
|
PeriodicOperationDivider divider;
|
||||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
// LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
bool goToNormalModeImmediately = false;
|
bool goToNormalModeImmediately = false;
|
||||||
gpioId_t chipSelectId = gpio::NO_GPIO;
|
bool commandExecuted = false;
|
||||||
|
// gpioId_t chipSelectId = gpio::NO_GPIO;
|
||||||
|
|
||||||
SUS::SusDataset dataset;
|
SUS::SusDataset dataset;
|
||||||
|
|
||||||
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
|
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
|
||||||
CommunicationStep communicationStep = CommunicationStep::IDLE;
|
ComStates comState = ComStates::IDLE;
|
||||||
|
|
||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||||
uint32_t timeoutMs = 20;
|
uint32_t timeoutMs = 20;
|
||||||
|
@ -78,7 +78,6 @@ debugging. */
|
|||||||
|
|
||||||
#define OBSW_TEST_LIBGPIOD 0
|
#define OBSW_TEST_LIBGPIOD 0
|
||||||
#define OBSW_TEST_RADIATION_SENSOR_HANDLER 0
|
#define OBSW_TEST_RADIATION_SENSOR_HANDLER 0
|
||||||
#define OBSW_TEST_SUS 0
|
|
||||||
#define OBSW_TEST_SUS_HANDLER 0
|
#define OBSW_TEST_SUS_HANDLER 0
|
||||||
#define OBSW_TEST_PLOC_HANDLER 0
|
#define OBSW_TEST_PLOC_HANDLER 0
|
||||||
#define OBSW_TEST_BPX_BATT 0
|
#define OBSW_TEST_BPX_BATT 0
|
||||||
|
@ -1,7 +1 @@
|
|||||||
/**
|
|
||||||
* \file logicalAddresses.cpp
|
|
||||||
*
|
|
||||||
* \date 06.11.2019
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "addresses.h"
|
#include "addresses.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user