Skip to content

Commit

Permalink
Implemented HV voltage getters.
Browse files Browse the repository at this point in the history
  • Loading branch information
pjarosik committed Mar 9, 2022
1 parent c34b021 commit 6ff7dfb
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
21 changes: 21 additions & 0 deletions arrus/core/api/devices/us4r/Us4R.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,27 @@ class Us4R : public DeviceWithComponents {
*/
virtual void setVoltage(Voltage voltage) = 0;

/**
* Returns configured HV voltage.
*
* @return hv voltage value configured on device [V]
*/
virtual unsigned char getVoltage() = 0;

/**
* Returns measured HV voltage (plus).
*
* @return hv voltage measured by device [V]
*/
virtual float getMeasuredPVoltage() = 0;

/**
* Returns measured HV voltage (minus).
*
* @return hv voltage measured by devivce [V]
*/
virtual float getMeasuredMVoltage() = 0;

/**
* Disables HV voltage.
*/
Expand Down
15 changes: 15 additions & 0 deletions arrus/core/devices/us4r/Us4RImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ void Us4RImpl::setVoltage(Voltage voltage) {
hv.value()->setVoltage(voltage);
}

unsigned char Us4RImpl::getVoltage() {
ARRUS_REQUIRES_TRUE(hv.has_value(), "No HV have been set.");
return hv.value()->getVoltage();
}

float Us4RImpl::getMeasuredPVoltage() {
ARRUS_REQUIRES_TRUE(hv.has_value(), "No HV have been set.");
return hv.value()->getMeasuredPVoltage();
}

float Us4RImpl::getMeasuredMVoltage() {
ARRUS_REQUIRES_TRUE(hv.has_value(), "No HV have been set.");
return hv.value()->getMeasuredMVoltage();
}

void Us4RImpl::disableHV() {
logger->log(LogSeverity::INFO, "Disabling HV");
ARRUS_REQUIRES_TRUE(hv.has_value(), "No HV have been set.");
Expand Down
3 changes: 3 additions & 0 deletions arrus/core/devices/us4r/Us4RImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ class Us4RImpl : public Us4R {
float getSamplingFrequency() const override;
void checkState() const override;
std::vector<unsigned short> getChannelsMask() override;
unsigned char getVoltage() override;
float getMeasuredPVoltage() override;
float getMeasuredMVoltage() override;

private:
UltrasoundDevice *getDefaultComponent();
Expand Down
12 changes: 12 additions & 0 deletions arrus/core/devices/us4r/hv/HighVoltageSupplier.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ class HighVoltageSupplier : public Device {
}
}

unsigned char getVoltage() {
return hv->GetHVVoltage();
}

float getMeasuredPVoltage() {
return hv->GetMeasuredHVPVoltage();
}

float getMeasuredMVoltage() {
return hv->GetMeasuredHVMVoltage();
}

void disable() {
try {
hv->DisableHV();
Expand Down

0 comments on commit 6ff7dfb

Please sign in to comment.