Add rotation to M4_Eyes
This commit is contained in:
parent
fac20effdb
commit
ba6d53509a
4 changed files with 13 additions and 4 deletions
|
|
@ -201,7 +201,6 @@ void setup() {
|
|||
|
||||
// Initialize DMAs
|
||||
for(e=0; e<NUM_EYES; e++) {
|
||||
eye[e].display->setRotation(3);
|
||||
eye[e].display->fillScreen(0);
|
||||
eye[e].dma.allocate();
|
||||
eye[e].dma.setTrigger(eye[e].spi->getDMAC_ID_TX());
|
||||
|
|
@ -247,6 +246,7 @@ void setup() {
|
|||
eye[e].sclera.mirror = 0;
|
||||
eye[e].sclera.spin = 0.0;
|
||||
eye[e].sclera.iSpin = 0;
|
||||
eye[e].rotation = 3;
|
||||
|
||||
// Uncanny eyes carryover stuff for now, all messy:
|
||||
eye[e].blink.state = NOBLINK;
|
||||
|
|
@ -400,7 +400,9 @@ void setup() {
|
|||
randomSeed(SysTick->VAL + analogRead(A2));
|
||||
eyeOldX = eyeNewX = eyeOldY = eyeNewY = mapRadius; // Start in center
|
||||
for(e=0; e<NUM_EYES; e++) { // For each eye...
|
||||
eye[e].eyeX = eyeOldX;
|
||||
// Set up screen rotation (MUST be done after config load!)
|
||||
eye[e].display->setRotation(eye[e].rotation);
|
||||
eye[e].eyeX = eyeOldX; // Set up initial position
|
||||
eye[e].eyeY = eyeOldY;
|
||||
}
|
||||
lastLightReadTime = micros() + 2000000; // Delay initial light reading
|
||||
|
|
|
|||
|
|
@ -184,7 +184,8 @@ static void getFilename(JsonVariant v, char **ptr) {
|
|||
}
|
||||
|
||||
void loadConfig(char *filename) {
|
||||
File file;
|
||||
File file;
|
||||
uint8_t rotation = 3;
|
||||
|
||||
if(file = filesys.open(filename, FILE_READ)) {
|
||||
StaticJsonDocument<2048> doc;
|
||||
|
|
@ -266,6 +267,9 @@ void loadConfig(char *filename) {
|
|||
JsonVariant iristv = doc["irisTexture"],
|
||||
scleratv = doc["scleraTexture"];
|
||||
|
||||
rotation = doc["rotate"] | rotation; // Screen rotation (GFX lib)
|
||||
rotation &= 3;
|
||||
|
||||
v = doc["tracking"];
|
||||
if(v.is<bool>()) tracking = v.as<bool>();
|
||||
v = doc["squint"];
|
||||
|
|
@ -361,6 +365,8 @@ void loadConfig(char *filename) {
|
|||
if(eye[e].sclera.filename) free(eye[e].sclera.filename);
|
||||
eye[e].sclera.filename = strdup(v);
|
||||
}
|
||||
eye[e].rotation = doc[eye[e].name]["rotate"] | rotation;
|
||||
eye[e].rotation &= 3;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ typedef struct {
|
|||
uint16_t backColor; // 16-bit 565 RGB, big-endian
|
||||
texture iris; // iris texture map
|
||||
texture sclera; // sclera texture map
|
||||
uint8_t rotation; // Screen rotation (GFX lib)
|
||||
|
||||
// Stuff carried over from Uncanny Eyes code. It now needs to be
|
||||
// independent per-eye because we interleave between drawing the
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ static void fatal(const char *message, uint16_t blinkDelay) {
|
|||
|
||||
void setup() {
|
||||
pinMode(SPEAKER_ENABLE_PIN, OUTPUT);
|
||||
digitalWrite(SPEAKER_ENABLE_PIN, HIGH); // Speaker OFF
|
||||
digitalWrite(SPEAKER_ENABLE_PIN, LOW); // Speaker OFF
|
||||
|
||||
Serial.begin(115200);
|
||||
//while(!Serial);
|
||||
|
|
|
|||
Loading…
Reference in a new issue