Changeset View
Changeset View
Standalone View
Standalone View
src/core/atcore.cpp
Show First 20 Lines • Show All 578 Lines • ▼ Show 20 Line(s) | 568 | { | |||
---|---|---|---|---|---|
579 | if (axis & AtCore::Z) { | 579 | if (axis & AtCore::Z) { | ||
580 | args.append(QStringLiteral("Z0")); | 580 | args.append(QStringLiteral("Z0")); | ||
581 | } | 581 | } | ||
582 | pushCommand(GCode::toCommand(GCode::G28, args)); | 582 | pushCommand(GCode::toCommand(GCode::G28, args)); | ||
583 | } | 583 | } | ||
584 | 584 | | |||
585 | void AtCore::setExtruderTemp(uint temp, uint extruder, bool andWait) | 585 | void AtCore::setExtruderTemp(uint temp, uint extruder, bool andWait) | ||
586 | { | 586 | { | ||
587 | if (temp > 10000) { | ||||
588 | temp = 10000; | ||||
589 | } | ||||
590 | | ||||
591 | if (extruder > 10000) { | ||||
592 | extruder = 10000; | ||||
593 | } | ||||
594 | | ||||
587 | if (andWait) { | 595 | if (andWait) { | ||
588 | pushCommand(GCode::toCommand(GCode::M109, QString::number(temp), QString::number(extruder))); | 596 | pushCommand(GCode::toCommand(GCode::M109, QString::number(temp), QString::number(extruder))); | ||
589 | } else { | 597 | } else { | ||
590 | pushCommand(GCode::toCommand(GCode::M104, QString::number(extruder), QString::number(temp))); | 598 | pushCommand(GCode::toCommand(GCode::M104, QString::number(extruder), QString::number(temp))); | ||
591 | } | 599 | } | ||
592 | } | 600 | } | ||
593 | 601 | | |||
594 | void AtCore::setBedTemp(uint temp, bool andWait) | 602 | void AtCore::setBedTemp(uint temp, bool andWait) | ||
595 | { | 603 | { | ||
604 | if (temp > 10000) { | ||||
605 | temp = 10000; | ||||
606 | } | ||||
607 | | ||||
596 | if (andWait) { | 608 | if (andWait) { | ||
597 | pushCommand(GCode::toCommand(GCode::M190, QString::number(temp))); | 609 | pushCommand(GCode::toCommand(GCode::M190, QString::number(temp))); | ||
598 | } else { | 610 | } else { | ||
599 | pushCommand(GCode::toCommand(GCode::M140, QString::number(temp))); | 611 | pushCommand(GCode::toCommand(GCode::M140, QString::number(temp))); | ||
600 | } | 612 | } | ||
601 | } | 613 | } | ||
602 | 614 | | |||
603 | void AtCore::setFanSpeed(uint speed, uint fanNumber) | 615 | void AtCore::setFanSpeed(uint speed, uint fanNumber) | ||
604 | { | 616 | { | ||
617 | if (speed > 255) { | ||||
618 | speed = 255; | ||||
619 | } | ||||
tcanabrava: speed = std::max(speed, 255);
The same applies for all of the other comparissons that you are… | |||||
620 | | ||||
621 | if (fanNumber > 10000) { | ||||
622 | fanNumber = 10000; | ||||
623 | } | ||||
624 | | ||||
605 | pushCommand(GCode::toCommand(GCode::M106, QString::number(fanNumber), QString::number(speed))); | 625 | pushCommand(GCode::toCommand(GCode::M106, QString::number(fanNumber), QString::number(speed))); | ||
606 | } | 626 | } | ||
607 | 627 | | |||
608 | void AtCore::setPrinterSpeed(uint speed) | 628 | void AtCore::setPrinterSpeed(uint speed) | ||
609 | { | 629 | { | ||
630 | if (speed > 10000) { | ||||
631 | speed = 10000; | ||||
632 | } | ||||
633 | | ||||
610 | pushCommand(GCode::toCommand(GCode::M220, QString::number(speed))); | 634 | pushCommand(GCode::toCommand(GCode::M220, QString::number(speed))); | ||
611 | } | 635 | } | ||
612 | 636 | | |||
613 | void AtCore::setFlowRate(uint speed) | 637 | void AtCore::setFlowRate(uint speed) | ||
614 | { | 638 | { | ||
639 | if (speed > 10000) { | ||||
640 | speed = 10000; | ||||
641 | } | ||||
642 | | ||||
615 | pushCommand(GCode::toCommand(GCode::M221, QString::number(speed))); | 643 | pushCommand(GCode::toCommand(GCode::M221, QString::number(speed))); | ||
616 | } | 644 | } | ||
617 | 645 | | |||
618 | void AtCore::move(AtCore::AXES axis, double arg) | 646 | void AtCore::move(AtCore::AXES axis, double arg) | ||
619 | { | 647 | { | ||
620 | const auto axisAsString = QMetaEnum::fromType<AtCore::AXES>().valueToKey(axis); | 648 | const auto axisAsString = QMetaEnum::fromType<AtCore::AXES>().valueToKey(axis); | ||
621 | move(QLatin1Char(axisAsString[0]), arg); | 649 | move(QLatin1Char(axisAsString[0]), arg); | ||
622 | } | 650 | } | ||
▲ Show 20 Lines • Show All 222 Lines • Show Last 20 Lines |
speed = std::max(speed, 255);
The same applies for all of the other comparissons that you are doing in this review.