Cubic Hand project for EECS 249A course.
Dependencies: MMA8451Q TSI cc3000_hostdriver_mbedsocket NVIC_set_all_priorities mbed Multi_WS2811
Diff: ledCube.cpp
- Revision:
- 43:cf824a44a040
- Parent:
- 41:367cab0162de
- Child:
- 49:361833355173
diff -r 4e1aaab14886 -r cf824a44a040 ledCube.cpp --- a/ledCube.cpp Thu Dec 11 12:16:09 2014 +0000 +++ b/ledCube.cpp Thu Dec 11 13:33:29 2014 +0000 @@ -228,23 +228,23 @@ } void LedCube::changeSize(int newSize) { - if((pos[X] + newSize) < nCOLs && (pos[Y] + newSize) < nCOLs && (pos[Z] + newSize) < nCOLs) { + if( newSize > 0 && (pos[X] + newSize) < nCOLs && (pos[Y] + newSize) < nCOLs && (pos[Z] + newSize) < nCOLs) { size = newSize; } } -void LedCube::UpdateCube(int size, int deltaX, int deltaY, int deltaZ, float hue) { - if(size == 0 && deltaX == 0 && deltaY == 0 && deltaZ == 0 && hue == 0){ - } - else{ - changeSize(size); +void LedCube::UpdateCube(int ledSize, int deltaX, int deltaY, int deltaZ, float hue) { + // if(ledSize == 0 && deltaX == 0 && deltaY == 0 && deltaZ == 0 && hue == 0){ + // } + //else{ + changeSize(ledSize); move(deltaX, deltaY, deltaZ); changeColor(hue); cubeUpdate(); - } + // } } -void LedCube::UpdateCube(CubeUpdateParameters cubeParams){ +void LedCube::UpdateCube2(CubeUpdateParameters cubeParams){ UpdateCube(cubeParams.size, cubeParams.deltaX, cubeParams.deltaY, cubeParams.deltaZ, cubeParams.hue); }