Skip to content

Commit

Permalink
Merge pull request #449 from micro-manager/galvoProjector
Browse files Browse the repository at this point in the history
Utilities: minor fixes in DAGalvo
  • Loading branch information
nicost authored Mar 6, 2024
2 parents 16d89e3 + 99f848d commit 4441b05
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions DeviceAdapters/Utilities/DAGalvo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ int DAGalvo::PointAndFire(double x, double y, double timeUs)
return ERR_NO_SHUTTER_DEVICE_FOUND;

// Should we do this non-blocking instead?
bool open = false;
ret = s->GetOpen(open);
if (ret != DEVICE_OK)
return ret;
ret = s->SetOpen(true);
if (ret != DEVICE_OK)
return ret;
std::this_thread::sleep_for(std::chrono::microseconds((long long)timeUs));
return s->SetOpen(false);
return s->SetOpen(open);

}

Expand Down Expand Up @@ -240,28 +244,29 @@ double DAGalvo::GetYMinimum()

int DAGalvo::AddPolygonVertex(int index, double x, double y)
{
if (index > 0) {
if (index >= 0) {
size_t nrPolygons = polygons_->size();
if (index < nrPolygons) {
DAPolygon* polygon = polygons_->at(index);
polygon->addVertex(x, y);
return true;
return DEVICE_OK;
}
else if (index == nrPolygons) {
DAPolygon* polygon = new DAPolygon(x, y);
polygons_->push_back(polygon);
return true;
return DEVICE_OK;
}
}
return false; // the index is more than nrPolygons and our vector does not accomodate this
return DEVICE_UNKNOWN_POSITION; // the index is more than nrPolygons and our vector does not accomodate this
}

int DAGalvo::DeletePolygons()
{
for (int i = 0; i < polygons_->size(); i++) {
delete(polygons_->at(i));
}
return polygons_->empty();
polygons_->clear();
return DEVICE_OK;
}

int DAGalvo::RunSequence()
Expand Down

0 comments on commit 4441b05

Please sign in to comment.