update rad sensor
This commit is contained in:
parent
6c988ecf50
commit
bf9f40aad3
@ -14,11 +14,13 @@ RadiationSensorHandler::~RadiationSensorHandler() {}
|
|||||||
|
|
||||||
void RadiationSensorHandler::doStartUp() {
|
void RadiationSensorHandler::doStartUp() {
|
||||||
if (internalState == InternalState::CONFIGURED) {
|
if (internalState == InternalState::CONFIGURED) {
|
||||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
if (goToNormalMode) {
|
||||||
setMode(MODE_NORMAL);
|
setMode(MODE_NORMAL);
|
||||||
#else
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
setMode(_MODE_TO_ON);
|
setMode(_MODE_TO_ON);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +126,8 @@ ReturnValue_t RadiationSensorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
case RAD_SENSOR::READ_CONVERSIONS: {
|
case RAD_SENSOR::READ_CONVERSIONS: {
|
||||||
uint8_t offset = 0;
|
uint8_t offset = 0;
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
dataset.temperatureCelcius = (*(packet + offset) << 8 | *(packet + offset + 1)) * 0.125;
|
int16_t tempRaw = ((packet[offset] & 0x0f) << 8) | packet[offset + 1];
|
||||||
|
dataset.temperatureCelcius = tempRaw * 0.125;
|
||||||
offset += 2;
|
offset += 2;
|
||||||
dataset.ain0 = (*(packet + offset) << 8 | *(packet + offset + 1));
|
dataset.ain0 = (*(packet + offset) << 8 | *(packet + offset + 1));
|
||||||
offset += 2;
|
offset += 2;
|
||||||
@ -175,3 +178,5 @@ ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPoo
|
|||||||
localDataPoolMap.emplace(RAD_SENSOR::AIN7, new PoolEntry<uint16_t>({0}));
|
localDataPoolMap.emplace(RAD_SENSOR::AIN7, new PoolEntry<uint16_t>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RadiationSensorHandler::setToGoToNormalModeImmediately() { this->goToNormalMode = true; }
|
||||||
|
@ -16,6 +16,7 @@ class RadiationSensorHandler : public DeviceHandlerBase {
|
|||||||
public:
|
public:
|
||||||
RadiationSensorHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie);
|
RadiationSensorHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie);
|
||||||
virtual ~RadiationSensorHandler();
|
virtual ~RadiationSensorHandler();
|
||||||
|
void setToGoToNormalModeImmediately();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void doStartUp() override;
|
void doStartUp() override;
|
||||||
@ -42,6 +43,7 @@ class RadiationSensorHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
static const uint8_t MAX_CMD_LEN = RAD_SENSOR::READ_SIZE;
|
static const uint8_t MAX_CMD_LEN = RAD_SENSOR::READ_SIZE;
|
||||||
|
|
||||||
|
bool goToNormalMode = false;
|
||||||
uint8_t cmdBuffer[MAX_CMD_LEN];
|
uint8_t cmdBuffer[MAX_CMD_LEN];
|
||||||
InternalState internalState = InternalState::SETUP;
|
InternalState internalState = InternalState::SETUP;
|
||||||
CommunicationStep communicationStep = CommunicationStep::START_CONVERSION;
|
CommunicationStep communicationStep = CommunicationStep::START_CONVERSION;
|
||||||
|
Loading…
Reference in New Issue
Block a user