Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1132,8 +1132,8 @@ void CRTCContext::AddMicrovectorMovement(const LibMCDriver_ScanLab_uint64 nMicro
int32_t intX = (int32_t)dX;
int32_t intY = (int32_t)dY;

int32_t intDelayLaserOn = -1;
int32_t intDelayLaserOff = -1;
int32_t intDelayLaserOn = pMicroVector->m_LaserOnDelay == -1.0 ? -1 : round( pMicroVector->m_LaserOnDelay * 100000);
int32_t intDelayLaserOff = pMicroVector->m_LaserOffDelay == -1.0 ? -1 : round(pMicroVector->m_LaserOffDelay * 100000);

m_pScanLabSDK->n_micro_vector_abs(m_CardNo, intX, intY, intDelayLaserOn, intDelayLaserOff);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ void CRTCRecordingInstance::disableRecording()

}

#include <iostream>

void CRTCRecordingInstance::readRecordedDataBlockFromRTC(uint32_t DataStart, uint32_t DataEnd)
{
Expand Down Expand Up @@ -737,7 +738,8 @@ void CRTCRecordingInstance::executeListWithRecording()

}
else {
if (!MesBusy) {
//if (!MesBusy) {
if (!Busy) {
readRecordedDataBlockFromRTC(LastPosition, MesPosition);
LastPosition = MesPosition;
}
Expand All @@ -747,7 +749,8 @@ void CRTCRecordingInstance::executeListWithRecording()

m_pSDK->n_measurement_status(m_CardNo, &MesBusy, &MesPosition);

} while (MesBusy || (MesPosition != LastPosition)); // Wait for the job to be finished executing
} while (Busy || (MesPosition != LastPosition)); // Wait for the job to be finished executing
//} while (MesBusy || (MesPosition != LastPosition)); // Wait for the job to be finished executing

}

Expand Down
6 changes: 5 additions & 1 deletion Drivers/ScanLabSMC/ACT/LibMCDriver_ScanLabSMC.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<error name="CSVPARSERUNKNOWNFIELDPARSERTYPE" code="1054" description="Unknown Field Parser Type." />
<error name="CSVPARSERINTERPOLATEINDEXOUTOFRANGE" code="1055" description="Index out of range in Interpolate." />
<error name="INVALIDMAXPOWERVALUE" code="1056" description="Invalid max power value." />

<error name="SIMULATIONWORKINGFILEISNOTINITIALIZED" code="1057" description="Simulation working file is not initialized." />
</errors>

<struct name="Point2D">
Expand Down Expand Up @@ -332,6 +332,10 @@ Custom implementation
<method name="LoadSimulationData" description="Reads the SMC Simulation data into a data table.">
<param name="SimulationDataTable" type="class" class="LibMCEnv:DataTable" pass="in" description="Data table object to read the simulation into." />
</method>

<method name="LoadRawSimulationData" description="Returns raw simulation data.">
<param name="Data" type="basicarray" class="uint8" pass="out" description="Raw binary simulation data." />
</method>

<method name="GetJobCharacteristic" description="Returns a characteristic value of a job.">
<param name="ValueType" type="enum" class="JobCharacteristic" pass="in" description="Type of job" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,17 @@ typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_StopExecuti
*/
typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_LoadSimulationDataPtr) (LibMCDriver_ScanLabSMC_SMCJob pSMCJob, LibMCEnv_DataTable pSimulationDataTable);

/**
* Returns raw simulation data.
*
* @param[in] pSMCJob - SMCJob instance.
* @param[in] nDataBufferSize - Number of elements in buffer
* @param[out] pDataNeededCount - will be filled with the count of the written elements, or needed buffer size.
* @param[out] pDataBuffer - uint8 buffer of Raw binary simulation data.
* @return error code or 0 (success)
*/
typedef LibMCDriver_ScanLabSMCResult (*PLibMCDriver_ScanLabSMCSMCJob_LoadRawSimulationDataPtr) (LibMCDriver_ScanLabSMC_SMCJob pSMCJob, const LibMCDriver_ScanLabSMC_uint64 nDataBufferSize, LibMCDriver_ScanLabSMC_uint64* pDataNeededCount, LibMCDriver_ScanLabSMC_uint8 * pDataBuffer);

/**
* Returns a characteristic value of a job.
*
Expand Down Expand Up @@ -874,6 +885,7 @@ typedef struct {
PLibMCDriver_ScanLabSMCSMCJob_WaitForExecutionPtr m_SMCJob_WaitForExecution;
PLibMCDriver_ScanLabSMCSMCJob_StopExecutionPtr m_SMCJob_StopExecution;
PLibMCDriver_ScanLabSMCSMCJob_LoadSimulationDataPtr m_SMCJob_LoadSimulationData;
PLibMCDriver_ScanLabSMCSMCJob_LoadRawSimulationDataPtr m_SMCJob_LoadRawSimulationData;
PLibMCDriver_ScanLabSMCSMCJob_GetJobCharacteristicPtr m_SMCJob_GetJobCharacteristic;
PLibMCDriver_ScanLabSMCSMCJob_GetJobDurationPtr m_SMCJob_GetJobDuration;
PLibMCDriver_ScanLabSMCSMCJob_ExecuteLaserInitSequencePtr m_SMCJob_ExecuteLaserInitSequence;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ class ELibMCDriver_ScanLabSMCException : public std::exception {
case LIBMCDRIVER_SCANLABSMC_ERROR_CSVPARSERUNKNOWNFIELDPARSERTYPE: return "CSVPARSERUNKNOWNFIELDPARSERTYPE";
case LIBMCDRIVER_SCANLABSMC_ERROR_CSVPARSERINTERPOLATEINDEXOUTOFRANGE: return "CSVPARSERINTERPOLATEINDEXOUTOFRANGE";
case LIBMCDRIVER_SCANLABSMC_ERROR_INVALIDMAXPOWERVALUE: return "INVALIDMAXPOWERVALUE";
case LIBMCDRIVER_SCANLABSMC_ERROR_SIMULATIONWORKINGFILEISNOTINITIALIZED: return "SIMULATIONWORKINGFILEISNOTINITIALIZED";
}
return "UNKNOWN";
}
Expand Down Expand Up @@ -318,6 +319,7 @@ class ELibMCDriver_ScanLabSMCException : public std::exception {
case LIBMCDRIVER_SCANLABSMC_ERROR_CSVPARSERUNKNOWNFIELDPARSERTYPE: return "Unknown Field Parser Type.";
case LIBMCDRIVER_SCANLABSMC_ERROR_CSVPARSERINTERPOLATEINDEXOUTOFRANGE: return "Index out of range in Interpolate.";
case LIBMCDRIVER_SCANLABSMC_ERROR_INVALIDMAXPOWERVALUE: return "Invalid max power value.";
case LIBMCDRIVER_SCANLABSMC_ERROR_SIMULATIONWORKINGFILEISNOTINITIALIZED: return "Simulation working file is not initialized.";
}
return "unknown error";
}
Expand Down Expand Up @@ -554,6 +556,7 @@ class CSMCJob : public CBase {
inline void WaitForExecution(const LibMCDriver_ScanLabSMC_uint32 nTimeOutInMilliseconds);
inline void StopExecution();
inline void LoadSimulationData(classParam<LibMCEnv::CDataTable> pSimulationDataTable);
inline void LoadRawSimulationData(std::vector<LibMCDriver_ScanLabSMC_uint8> & DataBuffer);
inline LibMCDriver_ScanLabSMC_double GetJobCharacteristic(const eJobCharacteristic eValueType);
inline LibMCDriver_ScanLabSMC_double GetJobDuration();
inline void ExecuteLaserInitSequence();
Expand Down Expand Up @@ -798,6 +801,7 @@ class CDriver_ScanLabSMC : public CDriver {
pWrapperTable->m_SMCJob_WaitForExecution = nullptr;
pWrapperTable->m_SMCJob_StopExecution = nullptr;
pWrapperTable->m_SMCJob_LoadSimulationData = nullptr;
pWrapperTable->m_SMCJob_LoadRawSimulationData = nullptr;
pWrapperTable->m_SMCJob_GetJobCharacteristic = nullptr;
pWrapperTable->m_SMCJob_GetJobDuration = nullptr;
pWrapperTable->m_SMCJob_ExecuteLaserInitSequence = nullptr;
Expand Down Expand Up @@ -1079,6 +1083,15 @@ class CDriver_ScanLabSMC : public CDriver {
if (pWrapperTable->m_SMCJob_LoadSimulationData == nullptr)
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_SMCJob_LoadRawSimulationData = (PLibMCDriver_ScanLabSMCSMCJob_LoadRawSimulationDataPtr) GetProcAddress(hLibrary, "libmcdriver_scanlabsmc_smcjob_loadrawsimulationdata");
#else // _WIN32
pWrapperTable->m_SMCJob_LoadRawSimulationData = (PLibMCDriver_ScanLabSMCSMCJob_LoadRawSimulationDataPtr) dlsym(hLibrary, "libmcdriver_scanlabsmc_smcjob_loadrawsimulationdata");
dlerror();
#endif // _WIN32
if (pWrapperTable->m_SMCJob_LoadRawSimulationData == nullptr)
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;

#ifdef _WIN32
pWrapperTable->m_SMCJob_GetJobCharacteristic = (PLibMCDriver_ScanLabSMCSMCJob_GetJobCharacteristicPtr) GetProcAddress(hLibrary, "libmcdriver_scanlabsmc_smcjob_getjobcharacteristic");
#else // _WIN32
Expand Down Expand Up @@ -1711,6 +1724,10 @@ class CDriver_ScanLabSMC : public CDriver {
if ( (eLookupError != 0) || (pWrapperTable->m_SMCJob_LoadSimulationData == nullptr) )
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;

eLookupError = (*pLookup)("libmcdriver_scanlabsmc_smcjob_loadrawsimulationdata", (void**)&(pWrapperTable->m_SMCJob_LoadRawSimulationData));
if ( (eLookupError != 0) || (pWrapperTable->m_SMCJob_LoadRawSimulationData == nullptr) )
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;

eLookupError = (*pLookup)("libmcdriver_scanlabsmc_smcjob_getjobcharacteristic", (void**)&(pWrapperTable->m_SMCJob_GetJobCharacteristic));
if ( (eLookupError != 0) || (pWrapperTable->m_SMCJob_GetJobCharacteristic == nullptr) )
return LIBMCDRIVER_SCANLABSMC_ERROR_COULDNOTFINDLIBRARYEXPORT;
Expand Down Expand Up @@ -2187,6 +2204,19 @@ class CDriver_ScanLabSMC : public CDriver {
CheckError(m_pWrapper->m_WrapperTable.m_SMCJob_LoadSimulationData(m_pHandle, hSimulationDataTable));
}

/**
* CSMCJob::LoadRawSimulationData - Returns raw simulation data.
* @param[out] DataBuffer - Raw binary simulation data.
*/
void CSMCJob::LoadRawSimulationData(std::vector<LibMCDriver_ScanLabSMC_uint8> & DataBuffer)
{
LibMCDriver_ScanLabSMC_uint64 elementsNeededData = 0;
LibMCDriver_ScanLabSMC_uint64 elementsWrittenData = 0;
CheckError(m_pWrapper->m_WrapperTable.m_SMCJob_LoadRawSimulationData(m_pHandle, 0, &elementsNeededData, nullptr));
DataBuffer.resize((size_t) elementsNeededData);
CheckError(m_pWrapper->m_WrapperTable.m_SMCJob_LoadRawSimulationData(m_pHandle, elementsNeededData, &elementsWrittenData, DataBuffer.data()));
}

/**
* CSMCJob::GetJobCharacteristic - Returns a characteristic value of a job.
* @param[in] eValueType - Type of job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ typedef void * LibMCDriver_ScanLabSMC_pvoid;
#define LIBMCDRIVER_SCANLABSMC_ERROR_CSVPARSERUNKNOWNFIELDPARSERTYPE 1054 /** Unknown Field Parser Type. */
#define LIBMCDRIVER_SCANLABSMC_ERROR_CSVPARSERINTERPOLATEINDEXOUTOFRANGE 1055 /** Index out of range in Interpolate. */
#define LIBMCDRIVER_SCANLABSMC_ERROR_INVALIDMAXPOWERVALUE 1056 /** Invalid max power value. */
#define LIBMCDRIVER_SCANLABSMC_ERROR_SIMULATIONWORKINGFILEISNOTINITIALIZED 1057 /** Simulation working file is not initialized. */

/*************************************************************************************************************************
Error strings for LibMCDriver_ScanLabSMC
Expand Down Expand Up @@ -236,6 +237,7 @@ inline const char * LIBMCDRIVER_SCANLABSMC_GETERRORSTRING (LibMCDriver_ScanLabSM
case LIBMCDRIVER_SCANLABSMC_ERROR_CSVPARSERUNKNOWNFIELDPARSERTYPE: return "Unknown Field Parser Type.";
case LIBMCDRIVER_SCANLABSMC_ERROR_CSVPARSERINTERPOLATEINDEXOUTOFRANGE: return "Index out of range in Interpolate.";
case LIBMCDRIVER_SCANLABSMC_ERROR_INVALIDMAXPOWERVALUE: return "Invalid max power value.";
case LIBMCDRIVER_SCANLABSMC_ERROR_SIMULATIONWORKINGFILEISNOTINITIALIZED: return "Simulation working file is not initialized.";
default: return "unknown error";
}
}
Expand Down
19 changes: 19 additions & 0 deletions Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ CScanLabSMCSDK::CScanLabSMCSDK(const std::string& sDLLNameUTF8, const std::strin
this->ptr_slsc_job_write_digital_x = (PScanLabSMCPtr_slsc_job_write_digital_x)_loadScanLabSMCAddress(hLibrary, "slsc_job_write_digital_x");
this->ptr_slsc_job_write_digital_mask_x = (PScanLabSMCPtr_slsc_job_write_digital_mask_x)_loadScanLabSMCAddress(hLibrary, "slsc_job_write_digital_mask_x");

this->ptr_slsc_cfg_register_callback_job_calculated = (PScanLabSMCPtr_slsc_cfg_register_callback_job_calculated)_loadScanLabSMCAddress(hLibrary, "slsc_cfg_register_callback_job_calculated");
this->ptr_slsc_job_begin_module = (PScanLabSMCPtr_slsc_job_begin_module)_loadScanLabSMCAddress(hLibrary, "slsc_job_begin_module");

m_LibraryHandle = (void*) hLibrary;
}

Expand Down Expand Up @@ -695,6 +698,22 @@ slscReturnValue CScanLabSMCSDK::slsc_job_write_digital_mask_x(size_t Handle, sls
return this->ptr_slsc_job_write_digital_mask_x(Handle, Channel, Mask, Value, TimeDelay);
}

slscReturnValue CScanLabSMCSDK::slsc_cfg_register_callback_job_calculated(size_t Handle, slsc_JobCallback Callback, void* Context)
{
if (m_pLogJournal.get() != nullptr)
m_pLogJournal->logCall("slsc_cfg_register_callback_job_calculated", std::to_string(Handle) + ", " + std::to_string(intptr_t(Callback)) + ", " + std::to_string(intptr_t(Context)));

return this->ptr_slsc_cfg_register_callback_job_calculated(Handle, Callback, Context);
}

slscReturnValue CScanLabSMCSDK::slsc_job_begin_module(size_t Handle, size_t* JobID, const double* StartPosition, const char* ModuleFileName)
{
if (m_pLogJournal.get() != nullptr)
m_pLogJournal->logCall("slsc_job_begin_module", std::to_string(Handle) + ", &" + std::to_string(intptr_t(JobID)) + ", [" + std::to_string(StartPosition[0]) + ", " + std::to_string(StartPosition[1]) + "], " + std::string(ModuleFileName));

return this->ptr_slsc_job_begin_module(Handle, JobID, StartPosition, ModuleFileName);
}

void CScanLabSMCSDK::setJournal(PScanLabSMCSDKJournal pLogJournal)
{
m_pLogJournal = pLogJournal;
Expand Down
11 changes: 11 additions & 0 deletions Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_sdk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ namespace LibMCDriver_ScanLabSMC {
typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_job_write_digital_x) (size_t Handle, slsc_DigitalOutput Channel, uint16_t Value, double TimeDelay);
typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_job_write_digital_mask_x) (size_t Handle, slsc_DigitalOutput Channel, uint16_t Mask, uint16_t Value, double TimeDelay);

typedef void (*slsc_JobCallback)(size_t JobID, void* Context);
typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_cfg_register_callback_job_calculated) (size_t Handle, slsc_JobCallback Callback, void* Context);

typedef slscReturnValue(SCANLABSMC_CALLINGCONVENTION* PScanLabSMCPtr_slsc_job_begin_module) (size_t Handle, size_t* JobID, const double* StartPosition, const char* ModuleFileName);

class CScanLabSMCSDKJournal {
private:
std::map<std::string, uint32_t> m_DefinedVariables;
Expand Down Expand Up @@ -298,6 +303,8 @@ namespace LibMCDriver_ScanLabSMC {
};

typedef std::shared_ptr<CScanLabSMCSDK_DLLDirectoryCache> PScanLabSMCSDK_DLLDirectoryCache;
//typedef void (*slsc_ExecTimeCallback)(size_t JobID, double ExecTime, void* Context);
typedef void (*slsc_JobCallback)(size_t JobID, void* Context);

class CScanLabSMCSDK {
private:
Expand Down Expand Up @@ -350,6 +357,8 @@ namespace LibMCDriver_ScanLabSMC {
PScanLabSMCPtr_slsc_ctrl_write_digital_mask_x ptr_slsc_ctrl_write_digital_mask_x = nullptr;
PScanLabSMCPtr_slsc_job_write_digital_x ptr_slsc_job_write_digital_x = nullptr;
PScanLabSMCPtr_slsc_job_write_digital_mask_x ptr_slsc_job_write_digital_mask_x = nullptr;
PScanLabSMCPtr_slsc_cfg_register_callback_job_calculated ptr_slsc_cfg_register_callback_job_calculated = nullptr;
PScanLabSMCPtr_slsc_job_begin_module ptr_slsc_job_begin_module = nullptr;

public:

Expand Down Expand Up @@ -413,6 +422,8 @@ namespace LibMCDriver_ScanLabSMC {
slscReturnValue slsc_job_write_digital_x(size_t Handle, slsc_DigitalOutput Channel, uint16_t Value, double TimeDelay);
slscReturnValue slsc_job_write_digital_mask_x(size_t Handle, slsc_DigitalOutput Channel, uint16_t Mask, uint16_t Value, double TimeDelay);

slscReturnValue slsc_cfg_register_callback_job_calculated(size_t Handle, slsc_JobCallback Callback, void* Context);
slscReturnValue slsc_job_begin_module(size_t Handle, size_t* JobID, const double* StartPosition, const char* ModuleFileName);
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ void CSMCJob::LoadSimulationData(LibMCEnv::PDataTable pSimulationDataTable)
m_pJobInstance->ReadSimulationFile(pSimulationDataTable);
}

void CSMCJob::LoadRawSimulationData(LibMCDriver_ScanLabSMC_uint64 nDataBufferSize, LibMCDriver_ScanLabSMC_uint64* pDataNeededCount, LibMCDriver_ScanLabSMC_uint8* pDataBuffer)
{
m_pJobInstance->LoadRawSimulationData(nDataBufferSize, pDataNeededCount, pDataBuffer);
}

LibMCDriver_ScanLabSMC_double CSMCJob::GetJobCharacteristic(const LibMCDriver_ScanLabSMC::eJobCharacteristic eValueType)
{
return m_pJobInstance->GetJobCharacteristic (eValueType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class CSMCJob : public virtual ISMCJob, public virtual CBase {

void LoadSimulationData(LibMCEnv::PDataTable pSimulationDataTable) override;

void LoadRawSimulationData(LibMCDriver_ScanLabSMC_uint64 nDataBufferSize, LibMCDriver_ScanLabSMC_uint64* pDataNeededCount, LibMCDriver_ScanLabSMC_uint8* pDataBuffer) override;

LibMCDriver_ScanLabSMC_double GetJobCharacteristic(const LibMCDriver_ScanLabSMC::eJobCharacteristic eValueType) override;

LibMCDriver_ScanLabSMC_double GetJobDuration() override;
Expand Down
Loading
Loading