temperature reading successul, but i2c sometimes hanging up

This commit is contained in:
2021-01-11 16:56:44 +01:00
parent 5c307a3eb4
commit f8a82d0bbe
167 changed files with 5938 additions and 20 deletions

View File

@ -1,5 +1,6 @@
#include <mission/devices/Tmp1075Handler.h>
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
#include <fsfwconfig/OBSWConfig.h>
Tmp1075Handler::Tmp1075Handler(object_id_t objectId, object_id_t comIF,
CookieIF * comCookie) :
@ -16,7 +17,7 @@ Tmp1075Handler::~Tmp1075Handler() {
void Tmp1075Handler::doStartUp(){
if(mode == _MODE_START_UP){
setMode(MODE_NORMAL);
setMode(MODE_ON);
}
}
@ -94,7 +95,8 @@ ReturnValue_t Tmp1075Handler::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) {
switch (id) {
case TMP1075::GET_TEMP: {
int16_t tempValueRaw = packet[1] << 8 | packet[0] >> 4;
int16_t tempValueRaw = 0;
tempValueRaw = packet[0] << 4 | packet[1] >> 4;
float tempValue = ((static_cast<float>(tempValueRaw)) * 0.0625);
#if OBSW_ENHANCED_PRINTOUT == 1
sif::info << "Tmp1075: Temperature: " << tempValue<< " °C" << std::endl;
@ -130,5 +132,13 @@ void Tmp1075Handler::prepareGetTempCommand(){
}
uint32_t Tmp1075Handler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
return 0;
return 500;
}
ReturnValue_t Tmp1075Handler::initializeLocalDataPool(
LocalDataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(TMP1075::TEMPERATURE_C_TMP1075_1,
new PoolEntry<float>({0.0}));
return HasReturnvaluesIF::RETURN_OK;
}