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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ project(LibMC)
add_subdirectory(Drivers)
add_subdirectory(Plugins)

set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 14)

# The location of autogenerated interfaces
set(CMAKE_CURRENT_AUTOGENERATED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Framework/InterfacesCore)
Expand Down
59 changes: 30 additions & 29 deletions Drivers/Marlin/Implementation/AMC_SerialController_Marlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <algorithm>
#include <thread>
#include <math.h>

namespace AMC {

Expand Down Expand Up @@ -145,7 +146,7 @@ namespace AMC {

if (!m_pConnection->isOpen()) {
m_pConnection.reset();
throw std::exception("Could not connect to serial port");
throw std::runtime_error("Could not connect to serial port");
}

// instead of waiting a fixed time wait until "start" or "" (after timeout) received from device??
Expand Down Expand Up @@ -208,7 +209,7 @@ namespace AMC {
void CSerialController_Marlin::checkIsHomed()
{
if (m_pConnection.get() == nullptr)
throw std::exception("Serial Port not initialized");
throw std::runtime_error("Serial Port not initialized");

// get endstops states
auto sStream = sendCommand("M119");
Expand Down Expand Up @@ -344,7 +345,7 @@ namespace AMC {
auto nPosition = sLine.find("T:");

if (nPosition == std::string::npos)
throw std::exception("could not query extruder temperature state.");
throw std::runtime_error("could not query extruder temperature state.");


// get extruder temperature
Expand All @@ -354,12 +355,12 @@ namespace AMC {
auto nTargetExtruderTempPosition = sExtruderTempPosString.find('B');

if (nCurrentExtruderTempPosition == std::string::npos)
throw std::exception("could not find extruder current temperature position.");
throw std::runtime_error("could not find extruder current temperature position.");
if (nTargetExtruderTempPosition == std::string::npos)
throw std::exception("could not find extruder target temperature position.");
throw std::runtime_error("could not find extruder target temperature position.");

if (!(nCurrentExtruderTempPosition < nTargetExtruderTempPosition))
throw std::exception("invalid extruder temperature position order.");
throw std::runtime_error("invalid extruder temperature position order.");

auto sCurrentExtTemp = sExtruderTempPosString.substr(0, nCurrentExtruderTempPosition);
auto sTargetExtTemp = sExtruderTempPosString.substr(nCurrentExtruderTempPosition + 1, nTargetExtruderTempPosition - (nCurrentExtruderTempPosition + 1));
Expand All @@ -375,12 +376,12 @@ namespace AMC {
auto nTargetBedTempPosition = sBedTempPosString.find('@');

if (nCurrentBedTempPosition == std::string::npos)
throw std::exception("could not find bed current temperature position.");
throw std::runtime_error("could not find bed current temperature position.");
if (nTargetBedTempPosition == std::string::npos)
throw std::exception("could not find bed target temperature position.");
throw std::runtime_error("could not find bed target temperature position.");

if (!(nCurrentBedTempPosition < nTargetBedTempPosition))
throw std::exception("invalid bed temperature position order.");
throw std::runtime_error("invalid bed temperature position order.");

auto sCurrentBedTemp = sBedTempPosString.substr(0, nCurrentBedTempPosition);
auto sTargetBedTemp = sBedTempPosString.substr(nCurrentBedTempPosition + 1, nTargetBedTempPosition - (nCurrentBedTempPosition + 1));
Expand All @@ -399,7 +400,7 @@ namespace AMC {
auto nPosition = sLine.find("M92");

if (nPosition == std::string::npos)
throw std::exception("could not query axis_steps_per_unit state.");
throw std::runtime_error("could not query axis_steps_per_unit state.");

auto sTempString = sLine.substr(nPosition + 4);
nPosition = sTempString.find("\n");
Expand All @@ -411,17 +412,17 @@ namespace AMC {
auto nAxisStepsPerUnitEPosition = sAxisStepsPerUnitString.find("E");

if (nAxisStepsPerUnitXPosition == std::string::npos)
throw std::exception("could not find axis_steps_per_unit X position.");
throw std::runtime_error("could not find axis_steps_per_unit X position.");
if (nAxisStepsPerUnitYPosition == std::string::npos)
throw std::exception("could not find axis_steps_per_unit Y position.");
throw std::runtime_error("could not find axis_steps_per_unit Y position.");
if (nAxisStepsPerUnitZPosition == std::string::npos)
throw std::exception("could not find axis_steps_per_unit Z position.");
throw std::runtime_error("could not find axis_steps_per_unit Z position.");
if (nAxisStepsPerUnitEPosition == std::string::npos)
throw std::exception("could not find axis_steps_per_unit E position.");
throw std::runtime_error("could not find axis_steps_per_unit E position.");

if (!((nAxisStepsPerUnitXPosition < nAxisStepsPerUnitYPosition) && (nAxisStepsPerUnitYPosition < nAxisStepsPerUnitZPosition) &&
(nAxisStepsPerUnitZPosition < nAxisStepsPerUnitEPosition)))
throw std::exception("invalid axis_steps_per_unit position order.");
throw std::runtime_error("invalid axis_steps_per_unit position order.");

auto sAxis_steps_per_unitXString = sAxisStepsPerUnitString.substr(nAxisStepsPerUnitXPosition + 1, nAxisStepsPerUnitYPosition - (nAxisStepsPerUnitXPosition + 1));
auto sAxis_steps_per_unitYString = sAxisStepsPerUnitString.substr(nAxisStepsPerUnitYPosition + 1, nAxisStepsPerUnitZPosition - (nAxisStepsPerUnitYPosition + 1));
Expand All @@ -437,7 +438,7 @@ namespace AMC {
nPosition = sLine.find("M301");

if (nPosition == std::string::npos)
throw std::exception("could not query PID values.");
throw std::runtime_error("could not query PID values.");

sTempString = sLine.substr(nPosition + 5);
nPosition = sTempString.find("\n");
Expand All @@ -448,14 +449,14 @@ namespace AMC {
auto nPidValueDPosition = sPidValuesString.find("D");

if (nPidValuePPosition == std::string::npos)
throw std::exception("could not find PID value P position.");
throw std::runtime_error("could not find PID value P position.");
if (nPidValueIPosition == std::string::npos)
throw std::exception("could not find PID value I position.");
throw std::runtime_error("could not find PID value I position.");
if (nPidValueDPosition == std::string::npos)
throw std::exception("could not find PID value D position.");
throw std::runtime_error("could not find PID value D position.");

if (!((nPidValuePPosition < nPidValueIPosition) && (nPidValueIPosition < nPidValueDPosition)))
throw std::exception("invalid PID values position order.");
throw std::runtime_error("invalid PID values position order.");

auto sPidValuePString = sPidValuesString.substr(nPidValuePPosition + 1, nPidValueIPosition - (nPidValuePPosition + 1));
auto sPidValueIString = sPidValuesString.substr(nPidValueIPosition + 1, nPidValueDPosition - (nPidValueIPosition + 1));
Expand Down Expand Up @@ -491,24 +492,24 @@ namespace AMC {
auto nPosEol = sLine.find("\n");

if (nPosFirmwareName == std::string::npos)
throw std::exception("could not query FIRMWARE_NAME in firmware info.");
throw std::runtime_error("could not query FIRMWARE_NAME in firmware info.");
if (nPosSourceCodeUrl == std::string::npos)
throw std::exception("could not query SOURCE_CODE_URL in firmware info.");
throw std::runtime_error("could not query SOURCE_CODE_URL in firmware info.");
if (nPosProtocolVersion == std::string::npos)
throw std::exception("could not query PROTOCOL_VERSION in firmware info.");
throw std::runtime_error("could not query PROTOCOL_VERSION in firmware info.");
if (nPosMachineType == std::string::npos)
throw std::exception("could not query MACHINE_TYPE in firmware info.");
throw std::runtime_error("could not query MACHINE_TYPE in firmware info.");
if (nPosExtruderCount == std::string::npos)
throw std::exception("could not query EXTRUDER_COUNT in firmware info.");
throw std::runtime_error("could not query EXTRUDER_COUNT in firmware info.");
if (nPosUuid == std::string::npos)
throw std::exception("could not query UUID in firmware info.");
throw std::runtime_error("could not query UUID in firmware info.");
if (nPosEol == std::string::npos)
throw std::exception("could not query EOL in firmware info.");
throw std::runtime_error("could not query EOL in firmware info.");

if (!((nPosFirmwareName < nPosSourceCodeUrl) && (nPosSourceCodeUrl < nPosProtocolVersion) &&
(nPosProtocolVersion < nPosMachineType) && (nPosMachineType < nPosExtruderCount) &&
(nPosExtruderCount < nPosUuid) && (nPosUuid < nPosEol)))
throw std::exception("invalid order of firmware info.");
throw std::runtime_error("invalid order of firmware info.");

m_sFirmwareName = sLine.substr(sFirmwareName.length(), nPosSourceCodeUrl - sFirmwareName.length() - 1);
m_sSourceCodeUrl = sLine.substr(nPosSourceCodeUrl + sSourceCodeUrl.length(), nPosProtocolVersion - (nPosSourceCodeUrl + sSourceCodeUrl.length() + 1));
Expand Down Expand Up @@ -715,4 +716,4 @@ namespace AMC {
}


}
}
2 changes: 1 addition & 1 deletion Implementation/Common/common_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ namespace AMCCommon {
throw std::runtime_error("could not delete file: " + sFileName);
}
#else
if (std::remove(sFileName)) {
if (std::remove(sFileName.c_str())) {
throw std::runtime_error("could not delete file: " + sFileName);
}
#endif
Expand Down
8 changes: 4 additions & 4 deletions Implementation/LibMCData/libmcdata_storagestream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ void CStorageStream::GetContent(LibMCData_uint64 nContentBufferSize, LibMCData_u

void CStorageStream::GetCallbacks(LibMCData_pvoid & pTheReadCallback, LibMCData_pvoid & pTheSeekCallback, LibMCData_pvoid & pStreamHandle)
{
pTheReadCallback = &storageStream_ReadCallback;
pTheSeekCallback = &storageStream_SeekCallback;
pStreamHandle = &m_sStreamCallbackData;
pTheReadCallback = (void*)&storageStream_ReadCallback;
pTheSeekCallback = (void*)&storageStream_SeekCallback;
pStreamHandle = (void*)&m_sStreamCallbackData;
}

AMCCommon::CImportStream* CStorageStream::getImportStream()
{
return m_pImportStream.get();
}
}
2 changes: 2 additions & 0 deletions Server/LibMC/libmc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Server/LibMC/libmc_dynamic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ Interface version: 1.0.0
#include <dlfcn.h>
#include <stdlib.h>
#endif // _WIN32
#ifdef __linux__
#include <stddef.h>
#endif

LibMCResult InitLibMCWrapperTable(sLibMCDynamicWrapperTable * pWrapperTable)
{
Expand Down
1 change: 1 addition & 0 deletions Server/LibMCData/libmcdata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.