Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/ngscopeclient/PowerSupplyDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ void PowerSupplyDialog::ChannelSettings(int i, float v, float a, float etime)
ImGui::TreePop();
}

if( (m_channelUIState[i].m_committedSetVoltage != m_psu->GetPowerVoltageNominal(i))
|| (m_channelUIState[i].m_committedSetCurrent != m_psu->GetPowerCurrentNominal(i)))
m_channelUIState[i].RefreshSetPoint();

//Set points for channels
ImGui::SetNextItemOpen(true, ImGuiCond_Appearing);
if(ImGui::TreeNode("Set Points"))
Expand Down
21 changes: 15 additions & 6 deletions src/ngscopeclient/PowerSupplyDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,23 @@ class PowerSupplyChannelUIState
: m_outputEnabled(psu->GetPowerChannelActive(chan))
, m_overcurrentShutdownEnabled(psu->GetPowerOvercurrentShutdownEnabled(chan))
, m_softStartEnabled(psu->IsSoftStartEnabled(chan))
, m_committedSetVoltage(psu->GetPowerVoltageNominal(chan))
, m_committedSetCurrent(psu->GetPowerCurrentNominal(chan))
, m_powerSupply(psu)
, m_chan(chan)
{
Unit volts(Unit::UNIT_VOLTS);
Unit amps(Unit::UNIT_AMPS);
m_setVoltage = volts.PrettyPrint(m_committedSetVoltage);
m_setCurrent = amps.PrettyPrint(m_committedSetCurrent);
RefreshSetPoint();
}

void RefreshSetPoint()
{
m_committedSetVoltage = m_powerSupply->GetPowerVoltageNominal(m_chan);
m_committedSetCurrent = m_powerSupply->GetPowerCurrentNominal(m_chan);
m_setVoltage = Unit(Unit::UNIT_VOLTS).PrettyPrint(m_committedSetVoltage);
m_setCurrent = Unit(Unit::UNIT_AMPS).PrettyPrint(m_committedSetCurrent);
}

protected:
PowerSupply* m_powerSupply;
size_t m_chan;
};

class PowerSupplyDialog : public Dialog
Expand Down