eive-obsw/mission/acs/imtqHelpers.cpp
2023-04-02 23:43:41 +02:00

71 lines
1.6 KiB
C++

#include "imtqHelpers.h"
uint16_t imtq::integrationTimeFromSelectValue(uint8_t value) {
switch (value) {
case (0):
return 2;
case (1):
return 3;
case (2):
return 6;
case (3):
return 10;
case (4):
return 20;
case (5):
return 40;
case (6):
return 80;
default:
return 10;
}
}
size_t imtq::getReplySize(CC::CC cc, size_t* optSecondSize) {
switch (cc) {
// Software reset is a bit special and can also cause a I2C NAK because
// the device might be reset at that moment. Otherwise, 2 bytes should be returned
case (CC::CC::SOFTWARE_RESET): {
if (optSecondSize != nullptr) {
*optSecondSize = 0;
}
return 2;
}
case (CC::CC::START_ACTUATION_DIPOLE):
case (CC::CC::SELF_TEST_CMD):
case (CC::CC::START_MTM_MEASUREMENT): {
return 2;
}
case (CC::CC::GET_SYSTEM_STATE): {
return 9;
}
case (CC::CC::GET_RAW_MTM_MEASUREMENT):
case (CC::CC::GET_CAL_MTM_MEASUREMENT): {
return 15;
}
case (CC::CC::GET_COIL_CURRENT):
case (CC::CC::GET_COMMANDED_DIPOLE):
case (CC::CC::GET_COIL_TEMPERATURES): {
return 8;
}
case (CC::CC::GET_SELF_TEST_RESULT): {
// Can also be 360 for the all axes self-test!
if (optSecondSize != nullptr) {
*optSecondSize = 360;
}
return 120;
}
case (CC::CC::GET_RAW_HK_DATA):
case (CC::CC::GET_ENG_HK_DATA): {
return 24;
}
case (CC::CC::GET_PARAM): {
return imtq::replySize::MAX_SET_GET_PARAM_LEN;
}
default: {
return 0;
}
}
return 0;
}