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.
Diff: threeAxis.cpp
- Revision:
- 2:5206484275e3
- Parent:
- 1:43d856fad23a
- Child:
- 3:09abcf461dc2
--- a/threeAxis.cpp Wed Dec 15 01:17:55 2021 +0000
+++ b/threeAxis.cpp Wed Dec 15 02:10:48 2021 +0000
@@ -28,6 +28,26 @@
_zDir = defaultZdir;
limitsEnabled = false;
+ bufferIndex = 0;
+}
+
+void threeAxis::addToBuffer(float xVal, float yVal, float zVal){
+
+ buffer[bufferIndex][0] = xVal;
+ buffer[bufferIndex][1] = yVal;
+ buffer[bufferIndex][2] = zVal;
+
+ bufferIndex = bufferIndex + 1;
+}
+
+void threeAxis::runBuffer(){
+ int i = 0;
+ while(i <= bufferIndex){
+ goTo(buffer[i][0], buffer[i][1], buffer[i][2]);
+ i = i+1;
+ }
+
+ bufferIndex = 0;
}
void threeAxis::invertX(){
@@ -150,9 +170,9 @@
void threeAxis::goTo(float xVal, float yVal, float zVal){
- int xSteps = (int)xVal/_stepRatio;
- int ySteps = (int)yVal/_stepRatio;
- int zSteps = (int)zVal/_stepRatio;
+ int xSteps = (int)(xVal/_stepRatio);
+ int ySteps = (int)(yVal/_stepRatio);
+ int zSteps = (int)(zVal/_stepRatio);
//uLCD.printf("\n%.2f, %.2f, %.2f, %d, %d, %d", xVal, yVal, zVal, xSteps, ySteps, zSteps);
@@ -162,16 +182,16 @@
- if (toX > _xMax / _stepRatio){
- toX = _xMax / _stepRatio;
+ if (toX > (int)(_xMax / _stepRatio)){
+ toX = (int)(_xMax / _stepRatio);
}
- if (toY > _yMax / _stepRatio){
- toY = _yMax / _stepRatio;
+ if (toY > (int)(_yMax / _stepRatio)){
+ toY = (int)(_yMax / _stepRatio);
}
- if (toZ > _zMax / _stepRatio){
- toZ = _zMax / _stepRatio;
+ if (toZ > (int)(_zMax / _stepRatio)){
+ toZ = (int)(_zMax / _stepRatio);
}
//uLCD.printf("\nTo: %d, %d, %d", toX, toY, toZ);