Skip to content

Commit

Permalink
Update temp_sensor.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Apr 16, 2020
1 parent 932636f commit e91de27
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/eez/modules/psu/temp_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,23 @@ float TempSensor::doRead() {
}
#endif

if (isPowerUp()) {
if (type >= CH1 && type <= CH6) {
int channelIndex = type - CH1;
int slotIndex = Channel::get(channelIndex).slotIndex;
auto &slot = g_slots[slotIndex];

if ((slot.moduleInfo->moduleType == MODULE_TYPE_DCP405 && slot.moduleRevision >= MODULE_REVISION_DCP405_R1B1) || slot.moduleInfo->moduleType == MODULE_TYPE_DCP405B) {
return drivers::tc77::readTemperature(slotIndex);
}

if (slot.moduleInfo->moduleType == MODULE_TYPE_DCP405 || slot.moduleInfo->moduleType == MODULE_TYPE_DCP505) {
return drivers::tmp1075::readTemperature(slotIndex);
}

if (slot.moduleInfo->moduleType == MODULE_TYPE_DCM220) {
return dcm220::readTemperature(channelIndex);
}
}
}
if (type >= CH1 && type <= CH6) {
int channelIndex = type - CH1;
int slotIndex = Channel::get(channelIndex).slotIndex;
auto &slot = g_slots[slotIndex];

if ((slot.moduleInfo->moduleType == MODULE_TYPE_DCP405 && slot.moduleRevision >= MODULE_REVISION_DCP405_R1B1) || slot.moduleInfo->moduleType == MODULE_TYPE_DCP405B) {
return drivers::tc77::readTemperature(slotIndex);
}

if (slot.moduleInfo->moduleType == MODULE_TYPE_DCP405 || slot.moduleInfo->moduleType == MODULE_TYPE_DCP505) {
return drivers::tmp1075::readTemperature(slotIndex);
}

if (slot.moduleInfo->moduleType == MODULE_TYPE_DCM220) {
return dcm220::readTemperature(channelIndex);
}
}
#endif

return NAN;
Expand Down

0 comments on commit e91de27

Please sign in to comment.