Skip to content

Commit

Permalink
dac test for U_SET enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Oct 3, 2019
1 parent 2788d05 commit 050c722
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
22 changes: 12 additions & 10 deletions src/eez/modules/dcpX05/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,17 +377,19 @@ struct Channel : ChannelInterface {
void setDacVoltageFloat(int subchannelIndex, float value) {
psu::Channel &channel = psu::Channel::getBySlotIndex(slotIndex);

if (channel.isOutputEnabled()) {
if (value < uSet) {
fallingEdge = true;
if (g_slots[slotIndex].moduleType == MODULE_TYPE_DCP405) {
if (channel.prot_conf.flags.u_state && channel.prot_conf.flags.u_type) {
// deactivate HW OVP
ioexp.changeBit(IOExpander::DCP405_IO_BIT_OUT_OVP_ENABLE, false);
}
}
}
if (channel.isOutputEnabled()) {
if (value < uSet) {
fallingEdge = true;
if (g_slots[slotIndex].moduleType == MODULE_TYPE_DCP405) {
if (channel.prot_conf.flags.u_state && channel.prot_conf.flags.u_type) {
// deactivate HW OVP
ioexp.changeBit(IOExpander::DCP405_IO_BIT_OUT_OVP_ENABLE, false);
}
}
}
}

if (channel.isOutputEnabled() || isDacTesting(subchannelIndex)) {
dac.setVoltage(value);
}

Expand Down
8 changes: 6 additions & 2 deletions src/eez/modules/dcpX05/dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bool DigitalAnalogConverter::test(IOExpander &ioexp, AnalogDigitalConverter &adc
float uMon = channel.u.mon_dac_last;
float uDiff = uMon - uSet;
if (fabsf(uDiff) > uSet * DAC_TEST_TOLERANCE / 100) {
// g_testResult = TEST_FAILED;
g_testResult = TEST_FAILED;

// DebugTrace("Ch%d DAC test, U_set failure: expected=%d, got=%d, abs diff=%d",
// channel.channelIndex + 1,
Expand Down Expand Up @@ -135,7 +135,11 @@ bool DigitalAnalogConverter::test(IOExpander &ioexp, AnalogDigitalConverter &adc
m_testing = false;
#endif

return g_testResult != TEST_FAILED;
#if defined(EEZ_PLATFORM_SIMULATOR)
g_testResult = TEST_OK;
#endif

return g_testResult != TEST_FAILED;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 050c722

Please sign in to comment.