Skip to content

Commit

Permalink
Fix build warnings on ScientificaMotion 8 Project
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewPlayer committed Aug 27, 2024
1 parent 7485d17 commit 4b47d26
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
50 changes: 40 additions & 10 deletions DeviceAdapters/ScientificaMotion8/ScientificaMotion8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ ScientificaRxPacket* ScientificaMotion8Hub::WriteRead(ScientificaTxPacket* tx, i
if (return_status != DEVICE_OK)
break;

for (int i = bufferIndex; i < (bufferIndex + actualBytesRead); i++)
for (unsigned int i = bufferIndex; i < (bufferIndex + actualBytesRead); i++)
{
if (rxBuffer[i] == 0)
{
Expand Down Expand Up @@ -324,6 +324,7 @@ int ScientificaMotion8Hub::Stop(uint8_t device)

int ret = DEVICE_OK;

txPacket->AddUInt8(device);
rxPacket = WriteRead(txPacket, 0);

if (rxPacket == NULL)
Expand Down Expand Up @@ -419,7 +420,7 @@ int ScientificaMotion8Hub::ReadControllerMap(void)
}
else
{
for (int ch = 0; ch < 8; ch++)
for (uint8_t ch = 0; ch < 8; ch++)
{
uint8_t device;
uint8_t axis;
Expand Down Expand Up @@ -565,11 +566,11 @@ bool M8XYStage::Busy()

MM::Hub* hub = GetParentHub();
if (!hub)
return DEVICE_INTERNAL_INCONSISTENCY;
return true;

ScientificaMotion8Hub* parentHub = dynamic_cast<ScientificaMotion8Hub*>(hub);
if (!parentHub)
return DEVICE_INTERNAL_INCONSISTENCY;
return true;

ret = parentHub->IsMoving(device_, &is_moving);

Expand Down Expand Up @@ -723,6 +724,27 @@ int M8XYStage::SetYOrigin()
return DEVICE_INTERNAL_INCONSISTENCY;

ret = parentHub->SetPosition(device_, AXIS_Y, 0);
return ret;
}

int M8XYStage::GetLimitsUm(double& xMin, double& xMax, double& yMin, double& yMax)
{
(void)xMin;
(void)xMax;
(void)yMin;
(void)yMax;

return DEVICE_UNSUPPORTED_COMMAND;
}

int M8XYStage::GetStepLimits(long& xMin, long& xMax, long& yMin, long& yMax)
{
(void)xMin;
(void)xMax;
(void)yMin;
(void)yMax;

return DEVICE_UNSUPPORTED_COMMAND;
}

M8ZStage::M8ZStage(uint8_t device)
Expand All @@ -747,11 +769,11 @@ bool M8ZStage::Busy()

MM::Hub* hub = GetParentHub();
if (!hub)
return DEVICE_INTERNAL_INCONSISTENCY;
return true;

ScientificaMotion8Hub* parentHub = dynamic_cast<ScientificaMotion8Hub*>(hub);
if (!parentHub)
return DEVICE_INTERNAL_INCONSISTENCY;
return true;

ret = parentHub->IsMoving(device_, &is_moving);

Expand All @@ -775,7 +797,7 @@ int M8ZStage::Shutdown()

int M8ZStage::SetPositionUm(double pos)
{
long steps = round(pos / 0.01);
long steps = (long)round(pos / 0.01);
return SetPositionSteps(steps);

}
Expand Down Expand Up @@ -902,6 +924,15 @@ int M8ZStage::SetOrigin()
return DEVICE_INTERNAL_INCONSISTENCY;

ret = parentHub->SetPosition(device_, AXIS_Z, 0);

return ret;
}

int M8ZStage::GetLimits(double& min, double& max)
{
(void)min;
(void)max;
return DEVICE_UNSUPPORTED_COMMAND;
}

M8FilterCubeTurret::M8FilterCubeTurret(uint8_t device)
Expand Down Expand Up @@ -949,8 +980,6 @@ bool M8FilterCubeTurret::Busy()
ScientificaTxPacket* txPacket = new ScientificaTxPacket(0xBB, 0, 0x11);
ScientificaRxPacket* rxPacket = NULL;

int ret = DEVICE_OK;

rxPacket = parentHub->WriteRead(txPacket, 18);

if (rxPacket != NULL)
Expand Down Expand Up @@ -1014,7 +1043,7 @@ int M8FilterCubeTurret::SetFilter(int filterIndex)

ScientificaTxPacket* txPacket = new ScientificaTxPacket(0xBB, 2, 0x0E);
txPacket->AddUInt8(device_);
txPacket->AddUInt8(filterIndex);
txPacket->AddUInt8((uint8_t)filterIndex);

ScientificaRxPacket* rxPacket = NULL;

Expand Down Expand Up @@ -1048,6 +1077,7 @@ int M8FilterCubeTurret::GetFilter(int& filterIndex)

int ret = DEVICE_OK;

txPacket->AddUInt8((uint8_t)filterIndex);
rxPacket = parentHub->WriteRead(txPacket, 2);

if (rxPacket == NULL)
Expand Down
6 changes: 3 additions & 3 deletions DeviceAdapters/ScientificaMotion8/ScientificaMotion8.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class M8XYStage : public CXYStageBase<M8XYStage>
int SetOrigin();
int SetXOrigin();
int SetYOrigin();
int GetLimitsUm(double& xMin, double& xMax, double& yMin, double& yMax) { return DEVICE_UNSUPPORTED_COMMAND; }
int GetStepLimits(long& xMin, long& xMax, long& yMin, long& yMax) { return DEVICE_UNSUPPORTED_COMMAND; }
int GetLimitsUm(double& xMin, double& xMax, double& yMin, double& yMax);
int GetStepLimits(long& xMin, long& xMax, long& yMin, long& yMax);
double GetStepSizeXUm() { return 0.01; }
double GetStepSizeYUm() { return 0.01; }
int IsXYStageSequenceable(bool& isSequenceable) const { isSequenceable = false; return DEVICE_OK; }
Expand Down Expand Up @@ -122,7 +122,7 @@ class M8ZStage : public CStageBase<M8ZStage>
int Home();
int Stop();
int SetOrigin();
int GetLimits(double& min, double& max) { return DEVICE_UNSUPPORTED_COMMAND; }
int GetLimits(double& min, double& max);
int IsStageSequenceable(bool& isSequenceable) const { isSequenceable = false; return DEVICE_OK; }
bool IsContinuousFocusDrive() const { return false; }
private:
Expand Down
4 changes: 2 additions & 2 deletions DeviceAdapters/ScientificaMotion8/ScientificaTxPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ unsigned char* ScientificaTxPacket::GetPacketToSend()

if ((block_length == 0xFF) || (packet_[i] == 0))
{
encoded_[block_start] = block_length;
encoded_[block_start] = (uint8_t)block_length;
block_start = write;
encoded_[write] = 0;
write++;
block_length = 1;
}
}
encoded_[block_start] = block_length;
encoded_[block_start] = (uint8_t)block_length;
encoded_[write] = 0x0; //Add packet deliminator
write++;

Expand Down

0 comments on commit 4b47d26

Please sign in to comment.