clock and dhb update
This commit is contained in:
parent
6b4bed8ca9
commit
bc722b5583
@ -1286,18 +1286,17 @@ ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::buildInternalCommand(void) {
|
void DeviceHandlerBase::buildInternalCommand(void) {
|
||||||
//Neither Raw nor Direct could build a command
|
/* Neither raw nor direct could build a command */
|
||||||
ReturnValue_t result = NOTHING_TO_SEND;
|
ReturnValue_t result = NOTHING_TO_SEND;
|
||||||
DeviceCommandId_t deviceCommandId = NO_COMMAND_ID;
|
DeviceCommandId_t deviceCommandId = NO_COMMAND_ID;
|
||||||
if (mode == MODE_NORMAL) {
|
if (mode == MODE_NORMAL) {
|
||||||
result = buildNormalDeviceCommand(&deviceCommandId);
|
result = buildNormalDeviceCommand(&deviceCommandId);
|
||||||
if (result == BUSY) {
|
if (result == BUSY) {
|
||||||
// so we can track misconfigurations
|
/* So we can track misconfigurations */
|
||||||
printWarningOrError(sif::OutputTypes::OUT_WARNING,
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "buildInternalCommand",
|
||||||
"buildInternalCommand",
|
HasReturnvaluesIF::RETURN_FAILED, "Busy.");
|
||||||
HasReturnvaluesIF::RETURN_FAILED,
|
/* No need to report this */
|
||||||
"Busy.");
|
result = NOTHING_TO_SEND;
|
||||||
result = NOTHING_TO_SEND; //no need to report this
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode == MODE_RAW) {
|
else if (mode == MODE_RAW) {
|
||||||
@ -1319,7 +1318,8 @@ void DeviceHandlerBase::buildInternalCommand(void) {
|
|||||||
deviceCommandId);
|
deviceCommandId);
|
||||||
if (iter == deviceCommandMap.end()) {
|
if (iter == deviceCommandMap.end()) {
|
||||||
result = COMMAND_NOT_SUPPORTED;
|
result = COMMAND_NOT_SUPPORTED;
|
||||||
} else if (iter->second.isExecuting) {
|
}
|
||||||
|
else if (iter->second.isExecuting) {
|
||||||
#if FSFW_DISABLE_PRINTOUT == 0
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
char output[36];
|
char output[36];
|
||||||
sprintf(output, "Command 0x%08x is executing",
|
sprintf(output, "Command 0x%08x is executing",
|
||||||
|
@ -15,35 +15,34 @@ using SystemClock = std::chrono::system_clock;
|
|||||||
|
|
||||||
uint32_t Clock::getTicksPerSecond(void){
|
uint32_t Clock::getTicksPerSecond(void){
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "Clock::getTicksPerSecond: not implemented yet" << std::endl;
|
sif::warning << "Clock::getTicksPerSecond: Not implemented for host OSAL" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("Clock::getTicksPerSecond: Not implemented for host OSAL\n");
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
/* To avoid division by zero */
|
||||||
//return CLOCKS_PER_SEC;
|
return 1;
|
||||||
//uint32_t ticks = sysconf(_SC_CLK_TCK);
|
|
||||||
//return ticks;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
|
ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
|
||||||
// do some magic with chrono
|
/* I don't know why someone would need to set a clock which is probably perfectly fine on a
|
||||||
|
host system with internet access so this is not implemented for now. */
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "Clock::setClock: not implemented yet" << std::endl;
|
sif::warning << "Clock::setClock: Not implemented for host OSAL" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::setClock(const timeval* time) {
|
ReturnValue_t Clock::setClock(const timeval* time) {
|
||||||
// do some magic with chrono
|
/* I don't know why someone would need to set a clock which is probably perfectly fine on a
|
||||||
#if defined(WIN32)
|
host system with internet access so this is not implemented for now. */
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
#elif defined(LINUX)
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
#else
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "Clock::getUptime: Not implemented for found OS" << std::endl;
|
sif::warning << "Clock::setClock: Not implemented for host OSAL" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("Clock::setClock: Not implemented for host OSAL\n");
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::getClock_timeval(timeval* time) {
|
ReturnValue_t Clock::getClock_timeval(timeval* time) {
|
||||||
@ -76,10 +75,11 @@ ReturnValue_t Clock::getClock_timeval(timeval* time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
|
ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
|
||||||
// do some magic with chrono
|
if(time == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
sif::warning << "Clock::gerClock_usecs: not implemented yet" << std::endl;
|
}
|
||||||
#endif
|
using namespace std::chrono;
|
||||||
|
*time = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,9 +121,9 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
|
|||||||
|
|
||||||
|
|
||||||
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
|
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
|
||||||
// do some magic with chrono (C++20!)
|
/* Do some magic with chrono (C++20!) */
|
||||||
// Right now, the library doesn't have the new features yet.
|
/* Right now, the library doesn't have the new features to get the required values yet.
|
||||||
// so we work around that for now.
|
so we work around that for now. */
|
||||||
auto now = SystemClock::now();
|
auto now = SystemClock::now();
|
||||||
auto seconds = std::chrono::time_point_cast<std::chrono::seconds>(now);
|
auto seconds = std::chrono::time_point_cast<std::chrono::seconds>(now);
|
||||||
auto fraction = now - seconds;
|
auto fraction = now - seconds;
|
||||||
@ -138,10 +138,6 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
|
|||||||
time->second = timeInfo->tm_sec;
|
time->second = timeInfo->tm_sec;
|
||||||
auto usecond = std::chrono::duration_cast<std::chrono::microseconds>(fraction);
|
auto usecond = std::chrono::duration_cast<std::chrono::microseconds>(fraction);
|
||||||
time->usecond = usecond.count();
|
time->usecond = usecond.count();
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
//sif::warning << "Clock::getDateAndTime: not implemented yet" << std::endl;
|
|
||||||
#endif
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user