Compare commits

...

7 Commits

Author SHA1 Message Date
c1e0bcee6d added additional conversion function 2022-01-15 13:03:53 +01:00
5214f8a449 bugfix for updated HAL 2022-01-11 14:44:45 +01:00
2506af27ed Merge pull request 'meier/breakDoSendRead' (#28) from meier/breakDoSendRead into eive/develop
Reviewed-on: #28
2021-12-22 11:30:27 +01:00
Jakob Meier
b98c85d33f Merge branch 'eive/develop' into meier/breakDoSendRead 2021-12-19 11:41:53 +01:00
Jakob Meier
eb58a8d954 virtual printset function 2021-12-19 11:33:12 +01:00
e5b568bc2b op divider fixes 2021-12-17 13:46:51 +01:00
Jakob Meier
9a858eb54c introduced protected function to break doSendRead 2021-12-14 19:39:38 +01:00
12 changed files with 51 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceC
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
transitionDelayMs(transitionDelayMs), dataset(this) {
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
debugDivider = new PeriodicOperationDivider(3);
debugDivider = new PeriodicOperationDivider(10);
#endif
}

View File

@@ -12,7 +12,7 @@ MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCom
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
dataset(this), transitionDelay(transitionDelay) {
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
debugDivider = new PeriodicOperationDivider(3);
debugDivider = new PeriodicOperationDivider(10);
#endif
// Set to default values right away
registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT;

View File

@@ -12,7 +12,7 @@ MgmRM3100Handler::MgmRM3100Handler(object_id_t objectId,
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
primaryDataset(this), transitionDelay(transitionDelay) {
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
debugDivider = new PeriodicOperationDivider(3);
debugDivider = new PeriodicOperationDivider(10);
#endif
}

View File

@@ -7,7 +7,7 @@
ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
std::string consumer, gpio::Direction direction, int initValue) {
std::string consumer, gpio::Direction direction, gpio::Levels initValue) {
if(cookie == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@@ -20,7 +20,7 @@ namespace gpio {
* @return
*/
ReturnValue_t createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
std::string consumer, gpio::Direction direction, int initValue);
std::string consumer, gpio::Direction direction, gpio::Levels initValue);
}
#endif /* BSP_RPI_GPIO_GPIORPI_H_ */

View File

@@ -321,3 +321,7 @@ float LocalPoolDataSetBase::getCollectionInterval() const {
return 0.0;
}
}
void LocalPoolDataSetBase::printSet() {
return;
}

View File

@@ -176,6 +176,11 @@ public:
*/
float getCollectionInterval() const;
/**
* @brief Can be overwritten by a specific implementation of a dataset to print the set.
*/
virtual void printSet();
protected:
sid_t sid;
//! This mutex is used if the data is created by one object only.
@@ -234,7 +239,6 @@ protected:
PeriodicHousekeepingHelper* periodicHelper = nullptr;
LocalDataPoolManager* poolManager = nullptr;
};

View File

@@ -684,6 +684,11 @@ void DeviceHandlerBase::doGetWrite() {
void DeviceHandlerBase::doSendRead() {
ReturnValue_t result;
result = doSendReadHook();
if (result != RETURN_OK){
return;
}
size_t replyLen = 0;
if(cookieInfo.pendingCommand != deviceCommandMap.end()) {
replyLen = getNextReplyLength(cookieInfo.pendingCommand->first);
@@ -950,6 +955,10 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
}
}
ReturnValue_t DeviceHandlerBase::doSendReadHook() {
return RETURN_OK;
}
ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t **switches,
uint8_t *numberOfSwitches) {
return DeviceHandlerBase::NO_SWITCH;

View File

@@ -1094,6 +1094,12 @@ protected:
*/
void commandSwitch(ReturnValue_t onOff);
/**
* @brief This function can be used to insert device specific code during the do-send-read
* step.
*/
virtual ReturnValue_t doSendReadHook();
private:
/**

View File

@@ -108,8 +108,6 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
timespec timeUnix;
int status = clock_gettime(CLOCK_REALTIME,&timeUnix);

View File

@@ -99,6 +99,14 @@ public:
*/
static ReturnValue_t getDateAndTime(TimeOfDay_t *time);
/**
* Convert to time of day struct given the POSIX timeval struct
* @param from
* @param to
* @return
*/
static ReturnValue_t convertTimevalToTimeOfDay(const timeval *from,
TimeOfDay_t *to);
/**
* Converts a time of day struct to POSIX seconds.
* @param time The time of day as input

View File

@@ -42,6 +42,20 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Clock::convertTimevalToTimeOfDay(const timeval* from, TimeOfDay_t* to) {
struct tm* timeInfo;
timeInfo = gmtime(&from->tv_sec);
to->year = timeInfo->tm_year + 1900;
to->month = timeInfo->tm_mon+1;
to->day = timeInfo->tm_mday;
to->hour = timeInfo->tm_hour;
to->minute = timeInfo->tm_min;
to->second = timeInfo->tm_sec;
to->usecond = from->tv_usec;
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t Clock::checkOrCreateClockMutex() {
if (timeMutex == nullptr) {
MutexFactory *mutexFactory = MutexFactory::instance();