Improving ESP32 LED Handeling, versionbump

This commit is contained in:
Lukas Bachschwell 2018-05-20 18:27:04 +02:00
parent 10c656448b
commit 5618498992
3 changed files with 149 additions and 135 deletions

View File

@ -1,5 +1,5 @@
name=SimpleExpressions
version=1.1.0
version=1.1.1
author=Lukas Bachschwell
maintainer=Lukas Bachschwell <lukas@lbsfilm.at>
sentence=Make you Robots cute and noisy

View File

@ -49,7 +49,7 @@ void SimpleExpressionsClass::printMouth(int number, int r, int g, int b) {
if(shapes[number].data[i]) mouth.setPixelColor(i, mouth.Color(r, g, b));
else mouth.setPixelColor(i, 0);
}
mouth.show();
showMouth();
delay(1);
clearPixels();
}
@ -73,7 +73,7 @@ void SimpleExpressionsClass::printMouth(int number) {
for(uint16_t i = 0; i<7; i++) {
mouth.setPixelColor(i, mouth.Color(colorShapes[number].data[i][0], colorShapes[number].data[i][1], colorShapes[number].data[i][2]));
}
mouth.show();
showMouth();
delay(1);
clearPixels();
}
@ -84,7 +84,7 @@ void SimpleExpressionsClass::writeMouthGeneric(const bool mouthArray[7], int r,
if(mouthArray[i]) mouth.setPixelColor(i, mouth.Color(r, g, b));
else mouth.setPixelColor(i, 0);
}
mouth.show();
showMouth();
delay(1);
clearPixels();
}
@ -93,7 +93,7 @@ void SimpleExpressionsClass::writeMouthGeneric(const int mouthArray[7][3]) {
for(uint16_t i=0; i<7; i++) {
mouth.setPixelColor(i, mouth.Color(mouthArray[i][0], mouthArray[i][1], mouthArray[i][2]));
}
mouth.show();
showMouth();
delay(1);
clearPixels();
}
@ -103,7 +103,7 @@ void SimpleExpressionsClass::clearMouth() {
for(int i = 0; i < 7; i++) {
mouth.setPixelColor(i, 0);
}
mouth.show();
showMouth();
delay(1);
clearPixels();
}
@ -115,6 +115,19 @@ void SimpleExpressionsClass::clearPixels() { // avoid strange issues on ESP32 wi
}
delay(1);
}
void SimpleExpressionsClass::showMouth() {
#if defined(ESP32)
portDISABLE_INTERRUPTS();
mouth.show();
delay(1);
portENABLE_INTERRUPTS();
clearPixels();
#else
mouth.show();
#endif
}
///////////////////////////////////////////////////////////////////
//-- SOUNDS -----------------------------------------------------//
///////////////////////////////////////////////////////////////////

View File

@ -27,6 +27,7 @@ class SimpleExpressionsClass
void writeMouth(const char mouthName[]);
void clearMouth();
void showMouth();
void writeMouthGeneric(const int mouthArray[7][3]);
void writeMouthGeneric(const bool mouthArray[7], int r, int g, int b);