Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:09abcf461dc2, committed 2021-12-16
- Comitter:
- magiwarriorx
- Date:
- Thu Dec 16 10:51:37 2021 +0000
- Parent:
- 2:5206484275e3
- Commit message:
- Initial public commit;
Changed in this revision
| threeAxis.cpp | Show annotated file Show diff for this revision Revisions of this file |
| threeAxis.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/threeAxis.cpp Wed Dec 15 02:10:48 2021 +0000
+++ b/threeAxis.cpp Thu Dec 16 10:51:37 2021 +0000
@@ -42,7 +42,7 @@
void threeAxis::runBuffer(){
int i = 0;
- while(i <= bufferIndex){
+ while(i < bufferIndex){
goTo(buffer[i][0], buffer[i][1], buffer[i][2]);
i = i+1;
}
@@ -160,6 +160,10 @@
limitsEnabled = val;
}
+bool threeAxis::getLimitsEn(){
+ return limitsEnabled;
+}
+
/*void threeAxis::goTo(float xVal, float yVal, float zVal){
int xSteps = (int)xVal*_stepRatio;
int ySteps = (int)yVal*_stepRatio;
@@ -181,19 +185,31 @@
toZ = zSteps;
+ if(limitsEnabled){
+ if (toX > (int)(_xMax / _stepRatio)){
+ toX = (int)(_xMax / _stepRatio);
+ }
- if (toX > (int)(_xMax / _stepRatio)){
- toX = (int)(_xMax / _stepRatio);
- }
+ if (toY > (int)(_yMax / _stepRatio)){
+ toY = (int)(_yMax / _stepRatio);
+ }
- if (toY > (int)(_yMax / _stepRatio)){
- toY = (int)(_yMax / _stepRatio);
- }
-
- if (toZ > (int)(_zMax / _stepRatio)){
- toZ = (int)(_zMax / _stepRatio);
- }
-
+ if (toZ > (int)(_zMax / _stepRatio)){
+ toZ = (int)(_zMax / _stepRatio);
+ }
+
+ if (toX<0){
+ toX = 0;
+ }
+
+ if (toY<0){
+ toY = 0;
+ }
+
+ if (toZ<0){
+ toZ = 0;
+ }
+ }
//uLCD.printf("\nTo: %d, %d, %d", toX, toY, toZ);
//uLCD.printf("\nCur: %d, %d, %d", currX, currY, currZ);
int xStepVal = 1;
--- a/threeAxis.h Wed Dec 15 02:10:48 2021 +0000
+++ b/threeAxis.h Thu Dec 16 10:51:37 2021 +0000
@@ -31,6 +31,7 @@
void invertZ();
void setLimits(bool val);
+ bool getLimitsEn();
protected:
int toX;