本文整理汇总了C++中Tool::DriveCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Tool::DriveCount方法的具体用法?C++ Tool::DriveCount怎么用?C++ Tool::DriveCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::DriveCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetProhibitedExtruderMovements
// Given that we want to extrude/retract the specified extruder drives, check if they are allowed.
// For each disallowed one, log an error to report later and return a bit in the bitmap.
// This may be called by an ISR!
unsigned int RepRap::GetProhibitedExtruderMovements(unsigned int extrusions, unsigned int retractions)
{
if (GetHeat()->ColdExtrude())
{
return 0;
}
Tool *tool = currentTool;
if (tool == nullptr)
{
// This should not happen, but if on tool is selected then don't allow any extruder movement
return extrusions | retractions;
}
unsigned int result = 0;
for (size_t driveNum = 0; driveNum < tool->DriveCount(); driveNum++)
{
const unsigned int extruderDrive = (unsigned int)(tool->Drive(driveNum));
const unsigned int mask = 1 << extruderDrive;
if (extrusions & mask)
{
if (!tool->ToolCanDrive(true))
{
result |= mask;
}
}
else if (retractions & mask)
{
if (!tool->ToolCanDrive(false))
{
result |= mask;
}
}
}
return result;
}
示例2: if
//.........这里部分代码省略.........
/* Probe */
{
const ZProbeParameters probeParams = platform->GetCurrentZProbeParameters();
// Trigger threshold
response->catf(",\"probe\":{\"threshold\":%d", probeParams.adcValue);
// Trigger height
response->catf(",\"height\":%.2f", probeParams.height);
// Type
response->catf(",\"type\":%d}", platform->GetZProbeType());
}
/* Tool Mapping */
{
response->cat(",\"tools\":[");
for(Tool *tool = toolList; tool != nullptr; tool = tool->Next())
{
// Heaters
response->catf("{\"number\":%d,\"heaters\":[", tool->Number());
for(size_t heater=0; heater<tool->HeaterCount(); heater++)
{
response->catf("%d", tool->Heater(heater));
if (heater + 1 < tool->HeaterCount())
{
response->cat(",");
}
}
// Extruder drives
response->cat("],\"drives\":[");
for(size_t drive=0; drive<tool->DriveCount(); drive++)
{
response->catf("%d", tool->Drive(drive));
if (drive + 1 < tool->DriveCount())
{
response->cat(",");
}
}
// Axis mapping. Currently we only map the X axis, but we return an array of arrays to allow for mapping other axes in future.
response->cat("],\"axisMap\":[[");
bool first = true;
for (size_t xi = 0; xi < MAX_AXES; ++xi)
{
if ((tool->GetXAxisMap() & (1u << xi)) != 0)
{
if (first)
{
first = false;
}
else
{
response->cat(",");
}
response->catf("%u", xi);
}
}
// Do we have any more tools?
if (tool->Next() != nullptr)
{
response->cat("]]},");
}
示例3: if
//.........这里部分代码省略.........
/* Probe */
{
const ZProbeParameters probeParams = platform->GetZProbeParameters();
// Trigger threshold
response->catf(",\"probe\":{\"threshold\":%d", probeParams.adcValue);
// Trigger height
response->catf(",\"height\":%.2f", probeParams.height);
// Type
response->catf(",\"type\":%d}", platform->GetZProbeType());
}
/* Tool Mapping */
{
response->cat(",\"tools\":[");
for(Tool *tool = toolList; tool != nullptr; tool = tool->Next())
{
// Heaters
response->catf("{\"number\":%d,\"heaters\":[", tool->Number());
for(size_t heater=0; heater<tool->HeaterCount(); heater++)
{
response->catf("%d", tool->Heater(heater));
if (heater + 1 < tool->HeaterCount())
{
response->cat(",");
}
}
// Extruder drives
response->cat("],\"drives\":[");
for(size_t drive=0; drive<tool->DriveCount(); drive++)
{
response->catf("%d", tool->Drive(drive));
if (drive + 1 < tool->DriveCount())
{
response->cat(",");
}
}
// Do we have any more tools?
if (tool->Next() != nullptr)
{
response->cat("]},");
}
else
{
response->cat("]}");
}
}
response->cat("]");
}
}
else if (type == 3)
{
// Current Layer
response->catf(",\"currentLayer\":%d", printMonitor->GetCurrentLayer());
// Current Layer Time
response->catf(",\"currentLayerTime\":%.1f", printMonitor->GetCurrentLayerTime());
// Raw Extruder Positions
response->cat(",\"extrRaw\":");
ch = '[';