本文整理汇总了C++中Tool::Drive方法的典型用法代码示例。如果您正苦于以下问题:C++ Tool::Drive方法的具体用法?C++ Tool::Drive怎么用?C++ Tool::Drive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::Drive方法的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
//.........这里部分代码省略.........
response->catf(",\"progress\":%.1f}", scanner->GetProgress());
}
#endif
/* Extended Status Response */
if (type == 2)
{
// Cold Extrude/Retract
response->catf(",\"coldExtrudeTemp\":%1.f", heat->ColdExtrude() ? 0 : HOT_ENOUGH_TO_EXTRUDE);
response->catf(",\"coldRetractTemp\":%1.f", heat->ColdExtrude() ? 0 : HOT_ENOUGH_TO_RETRACT);
// Maximum hotend temperature - DWC just wants the highest one
response->catf(",\"tempLimit\":%1.f", heat->GetHighestTemperatureLimit());
// Endstops
uint16_t endstops = 0;
for(size_t drive = 0; drive < DRIVES; drive++)
{
EndStopHit stopped = platform->Stopped(drive);
if (stopped == EndStopHit::highHit || stopped == EndStopHit::lowHit)
{
endstops |= (1 << drive);
}
}
response->catf(",\"endstops\":%d", endstops);
// Firmware name, machine geometry and number of axes
response->catf(",\"firmwareName\":\"%s\",\"geometry\":\"%s\",\"axes\":%u", FIRMWARE_NAME, move->GetGeometryString(), numAxes);
// Total and mounted volumes
size_t mountedCards = 0;
for(size_t i = 0; i < NumSdCards; i++)
{
if (platform->GetMassStorage()->IsDriveMounted(i))
{
mountedCards |= (1 << i);
}
}
response->catf(",\"volumes\":%u,\"mountedVolumes\":%u", NumSdCards, mountedCards);
// Machine name
response->cat(",\"name\":");
response->EncodeString(myName, ARRAY_SIZE(myName), false);
/* 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++)
示例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 = '[';