Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Oct 25, 2021
1 parent 7583073 commit 22a3de5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/eez/modules/psu/calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,15 @@ void Value::setDacValue(float value) {
}
} else {
if (channel) {
channel_dispatcher::setCurrent(*channel, value);
if (type == CALIBRATION_VALUE_I_HI_RANGE) {
channel_dispatcher::setCurrent(*channel, value);
channel_dispatcher::setVoltage(*channel, channel->params.I_CAL_U_SET);
} else {
// prevent false power fault detection (#275)
channel_dispatcher::setCurrent(*channel, 0.015);
channel_dispatcher::setVoltage(*channel, channel->params.I_LOW_RANGE_CAL_U_SET);
osDelay(3);
channel_dispatcher::setCurrent(*channel, value);
}
} else {
channel_dispatcher::setCurrent(editor.m_slotIndex, editor.m_subchannelIndex, value, nullptr);
Expand Down Expand Up @@ -375,6 +379,7 @@ void CalibrationEditor::doStart() {
channel_dispatcher::outputEnable(*channel, false);
channel_dispatcher::setVoltage(*channel, channel->u.min);
channel_dispatcher::setCurrent(*channel, channel->i.min);
m_savedCurrentRangeSelectionMode = channel->getCurrentRangeSelectionMode();
} else {
g_slots[m_slotIndex]->outputEnable(m_subchannelIndex, false, nullptr);
channel_dispatcher::setVoltage(m_slotIndex, m_subchannelIndex, channel_dispatcher::getVoltageMinValue(m_slotIndex, m_subchannelIndex), nullptr);
Expand Down Expand Up @@ -457,6 +462,7 @@ void CalibrationEditor::stop() {
channel_dispatcher::outputEnable(*channel, false);
channel_dispatcher::setVoltage(*channel, channel->u.min);
channel_dispatcher::setCurrent(*channel, channel->i.min);
channel->setCurrentRangeSelectionMode(m_savedCurrentRangeSelectionMode);
} else {
if (g_slots[m_slotIndex]->isVoltageCalibrationExists(m_subchannelIndex)) {
g_slots[m_slotIndex]->enableVoltageCalibration(m_subchannelIndex, true);
Expand Down
1 change: 1 addition & 0 deletions src/eez/modules/psu/calibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class CalibrationEditor : public CalibrationBase {

Value m_voltageValue = Value(*this, CALIBRATION_VALUE_U);

CurrentRangeSelectionMode m_savedCurrentRangeSelectionMode;
int8_t m_currentRangeSelected = 0;
Value m_currentsValue[2] = {
Value(*this, CALIBRATION_VALUE_I_HI_RANGE),
Expand Down
2 changes: 2 additions & 0 deletions src/eez/modules/psu/gui/channel_calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ void ChSettingsCalibrationEditPage::setCalibrationValueType(CalibrationValueType
channel_dispatcher::setVoltage(*channel, g_channel->params.I_CAL_U_SET);
} else {
channel_dispatcher::setVoltage(*channel, g_channel->params.I_LOW_RANGE_CAL_U_SET);
// prevent false power fault detection (#275)
osDelay(3);
}
}
}
Expand Down

0 comments on commit 22a3de5

Please sign in to comment.