diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index f7ecc7fd..429d57f4 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -350,8 +350,8 @@ void initmission::createPusTasks(TaskFactory& factory, void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, std::vector& taskVec) { -#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || \ - OBSW_ADD_I2C_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1) +#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || OBSW_ADD_I2C_TEST_CODE == 1 || \ + (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1) ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; #endif PeriodicTaskIF* testTask = factory.createPeriodicTask( diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 66408254..b427b9b9 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -1,6 +1,7 @@ -#include #include "ObjectFactory.h" +#include + #include #include "OBSWConfig.h" diff --git a/linux/boardtest/I2cTestClass.cpp b/linux/boardtest/I2cTestClass.cpp index d3017b1b..1bd0aa52 100644 --- a/linux/boardtest/I2cTestClass.cpp +++ b/linux/boardtest/I2cTestClass.cpp @@ -1,26 +1,27 @@ #include "I2cTestClass.h" -#include -#include "fsfw/serviceinterface.h" -#include "fsfw/globalfunctions/arrayprinter.h" -#include #include +#include #include +#include + +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/serviceinterface.h" I2cTestClass::I2cTestClass(object_id_t objectId, std::string i2cdev) - : TestTask(objectId), i2cdev(i2cdev) { + : TestTask(objectId), i2cdev(i2cdev) { mode = TestModes::BPX_BATTERY; } ReturnValue_t I2cTestClass::initialize() { - if(mode == TestModes::BPX_BATTERY) { + if (mode == TestModes::BPX_BATTERY) { battInit(); } return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t I2cTestClass::performPeriodicAction() { - if(mode == TestModes::BPX_BATTERY) { + if (mode == TestModes::BPX_BATTERY) { battPeriodic(); } return HasReturnvaluesIF::RETURN_OK; @@ -33,25 +34,25 @@ void I2cTestClass::battInit() { sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl; return; } - if(ioctl(bpxInfo.fd, I2C_SLAVE, bpxInfo.addr) < 0) { + if (ioctl(bpxInfo.fd, I2C_SLAVE, bpxInfo.addr) < 0) { sif::error << "Failed to acquire bus access and/or talk to slave" << std::endl; } cmdBuf[0] = BpxBattery::PORT_PING; cmdBuf[1] = 0x42; sendLen = 2; ReturnValue_t result = i2cWrite(bpxInfo.fd, cmdBuf.data(), sendLen); - if(result != HasReturnvaluesIF::RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return; } // Receive back port, error byte and ping reply recvLen = 3; result = i2cRead(bpxInfo.fd, replyBuf.data(), recvLen); - if(result != HasReturnvaluesIF::RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return; } sif::info << "Ping reply:" << std::endl; arrayprinter::print(replyBuf.data(), recvLen); - if(replyBuf[2] != 0x42) { + if (replyBuf[2] != 0x42) { sif::warning << "Received ping reply not expected value 0x42" << std::endl; } } @@ -62,19 +63,19 @@ void I2cTestClass::battPeriodic() { sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl; return; } - if(ioctl(bpxInfo.fd, I2C_SLAVE, bpxInfo.addr) < 0) { + if (ioctl(bpxInfo.fd, I2C_SLAVE, bpxInfo.addr) < 0) { sif::error << "Failed to acquire bus access and/or talk to slave" << std::endl; } cmdBuf[0] = BpxBattery::PORT_GET_HK; sendLen = 1; ReturnValue_t result = i2cWrite(bpxInfo.fd, cmdBuf.data(), sendLen); - if(result != HasReturnvaluesIF::RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return; } // Receive back HK set recvLen = 23; result = i2cRead(bpxInfo.fd, replyBuf.data(), recvLen); - if(result != HasReturnvaluesIF::RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return; } sif::info << "HK reply:" << std::endl; @@ -91,7 +92,7 @@ ReturnValue_t I2cTestClass::i2cWrite(int fd, uint8_t* data, size_t len) { } ReturnValue_t I2cTestClass::i2cRead(int fd, uint8_t* data, size_t len) { - if( read (fd, data, len) != static_cast(len)) { + if (read(fd, data, len) != static_cast(len)) { sif::error << "Failed to read from I2C bus" << std::endl; sif::error << "Error " << errno << ": " << strerror(errno) << std::endl; return HasReturnvaluesIF::RETURN_FAILED; diff --git a/linux/boardtest/I2cTestClass.h b/linux/boardtest/I2cTestClass.h index 5db58797..500243c5 100644 --- a/linux/boardtest/I2cTestClass.h +++ b/linux/boardtest/I2cTestClass.h @@ -3,9 +3,10 @@ #include -#include "mission/devices/devicedefinitions/BpxBatteryDefinitions.h" -#include #include +#include + +#include "mission/devices/devicedefinitions/BpxBatteryDefinitions.h" class I2cTestClass : public TestTask { public: @@ -15,10 +16,7 @@ class I2cTestClass : public TestTask { ReturnValue_t performPeriodicAction() override; private: - enum TestModes { - NONE, - BPX_BATTERY - }; + enum TestModes { NONE, BPX_BATTERY }; struct I2cInfo { int addr = 0; int fd = 0; @@ -28,7 +26,7 @@ class I2cTestClass : public TestTask { void battInit(); void battPeriodic(); - I2cInfo bpxInfo = { .addr = 0x07, .fd = 0 }; + I2cInfo bpxInfo = {.addr = 0x07, .fd = 0}; std::string i2cdev; size_t sendLen = 0; size_t recvLen = 0; diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 37e0a6f1..e6033c09 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -24,12 +24,10 @@ ReturnValue_t UartTestClass::initialize() { return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t UartTestClass::performOneShotAction() { - return HasReturnvaluesIF::RETURN_OK; -} +ReturnValue_t UartTestClass::performOneShotAction() { return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t UartTestClass::performPeriodicAction() { - if(mode == TestModes::GPS) { + if (mode == TestModes::GPS) { gpsPeriodic(); } return HasReturnvaluesIF::RETURN_OK; diff --git a/mission/devices/BpxBatteryHandler.cpp b/mission/devices/BpxBatteryHandler.cpp index 115c3b96..2ad20c9d 100644 --- a/mission/devices/BpxBatteryHandler.cpp +++ b/mission/devices/BpxBatteryHandler.cpp @@ -46,7 +46,7 @@ void BpxBatteryHandler::fillCommandAndReplyMap() { insertInCommandAndReplyMap(GET_HK, 1, &hkSet, GET_HK_REPLY_LEN); insertInCommandAndReplyMap(BpxBattery::PING, 1, nullptr, PING_REPLY_LEN); insertInCommandAndReplyMap(BpxBattery::REBOOT, 1, nullptr, 0); - insertInCommandAndReplyMap(BpxBattery::RESET_COUNTERS, 1, nullptr,EMPTY_REPLY_LEN); + insertInCommandAndReplyMap(BpxBattery::RESET_COUNTERS, 1, nullptr, EMPTY_REPLY_LEN); insertInCommandAndReplyMap(BpxBattery::CONFIG_CMD, 1, nullptr, EMPTY_REPLY_LEN); insertInCommandAndReplyMap(BpxBattery::CONFIG_GET, 1, &cfgSet, CONFIG_GET_REPLY_LEN); } @@ -214,7 +214,7 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, cons } case (BpxBattery::PING): { if (packet[2] != sentPingByte) { - return DeviceHandlerIF::INVALID_DATA; + return DeviceHandlerIF::INVALID_DATA; } if (mode == _MODE_START_UP) { commandExecuted = true; @@ -242,7 +242,7 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, cons cfgSet.setValidity(true, true); break; } - case(BpxBattery::REBOOT): { + case (BpxBattery::REBOOT): { break; } default: { diff --git a/mission/devices/devicedefinitions/BpxBatteryDefinitions.h b/mission/devices/devicedefinitions/BpxBatteryDefinitions.h index 333119f2..54d4e1f8 100644 --- a/mission/devices/devicedefinitions/BpxBatteryDefinitions.h +++ b/mission/devices/devicedefinitions/BpxBatteryDefinitions.h @@ -4,10 +4,10 @@ #include #include -#include "fsfw/devicehandlers/DeviceHandlerIF.h" - #include +#include "fsfw/devicehandlers/DeviceHandlerIF.h" + namespace BpxBattery { enum LocalPoolIds { @@ -186,24 +186,18 @@ class BpxBatteryHk : public StaticLocalDataSet { lp_var_t(sid.objectId, BpxBattery::HEATER_CURRENT, this); //! Battery voltage in mV - lp_var_t battVoltage = - lp_var_t(sid.objectId, BpxBattery::BATT_VOLTAGE, this); + lp_var_t battVoltage = lp_var_t(sid.objectId, BpxBattery::BATT_VOLTAGE, this); //! Battery temperature 1 in degC - lp_var_t battTemp1 = - lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_1, this); + lp_var_t battTemp1 = lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_1, this); //! Battery temperature 2 in degC - lp_var_t battTemp2 = - lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_2, this); + lp_var_t battTemp2 = lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_2, this); //! Battery temperature 3 in degC - lp_var_t battTemp3 = - lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_3, this); + lp_var_t battTemp3 = lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_3, this); //! Battery temperature 4 in degC - lp_var_t battTemp4 = - lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_4, this); + lp_var_t battTemp4 = lp_var_t(sid.objectId, BpxBattery::BATT_TEMP_4, this); lp_var_t rebootCounter = lp_var_t(sid.objectId, BpxBattery::REBOOT_COUNTER, this); - lp_var_t bootcause = - lp_var_t(sid.objectId, BpxBattery::BOOTCAUSE, this); + lp_var_t bootcause = lp_var_t(sid.objectId, BpxBattery::BOOTCAUSE, this); private: friend class BpxBatteryHandler;