Skip to content

Commit

Permalink
esp32
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-8 committed Sep 25, 2024
1 parent 1262d98 commit 20caba3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
18 changes: 6 additions & 12 deletions gbg_program/_Save_Recall.ino
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,15 @@ void settingsSerial() {
EEPROMwrite(settingsMemoryKeyAddr, settings_memory_key + 1); // so that on reset the arduino discards EEPROM
#if defined(ARDUINO_ARCH_MBED_RP2040)|| defined(ARDUINO_ARCH_RP2040) || defined(ESP32)
EEPROM.commit();
#endif
#ifdef ESP32
ESP.restart();
#endif
delay(5000); // trigger wdt
} else if (strcmp(k, "REBOOT") == 0) {
#ifdef ESP32
ESP.restart();
#endif
delay(5000); // trigger wdt
} else if (strcmp(k, "G") == 0) {
changedSomething = false;
Expand Down Expand Up @@ -509,8 +515,6 @@ void recallSettings()
Serial.println(F("{\"error\": \"eeprom failure\"}"));
#if defined(ARDUINO_ARCH_MBED_RP2040)|| defined(ARDUINO_ARCH_RP2040)
rp2040.wdt_reset();
#elif defined(ESP32)
//TODO: WDT
#endif
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
Expand All @@ -527,8 +531,6 @@ void recallSettings()
delay(400);
#if defined(ARDUINO_ARCH_MBED_RP2040)|| defined(ARDUINO_ARCH_RP2040)
rp2040.wdt_reset();
#elif defined(ESP32)
//TODO: WDT
#endif
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
Expand All @@ -539,8 +541,6 @@ void recallSettings()

#if defined(ARDUINO_ARCH_MBED_RP2040)|| defined(ARDUINO_ARCH_RP2040)
rp2040.wdt_reset();
#elif defined(ESP32)
//TODO: WDT
#endif
digitalWrite(LED_BUILTIN, LOW);
delay(400);
Expand All @@ -551,8 +551,6 @@ void recallSettings()

#if defined(ARDUINO_ARCH_MBED_RP2040)|| defined(ARDUINO_ARCH_RP2040)
rp2040.wdt_reset();
#elif defined(ESP32)
//TODO: WDT
#endif
delay(400);
digitalWrite(LED_BUILTIN, HIGH);
Expand All @@ -569,8 +567,6 @@ void recallSettings()
delay(200);
#if defined(ARDUINO_ARCH_MBED_RP2040)|| defined(ARDUINO_ARCH_RP2040)
rp2040.wdt_reset();
#elif defined(ESP32)
//TODO: WDT
#endif
delay(1000);
}
Expand Down Expand Up @@ -625,8 +621,6 @@ void EEPROMread(unsigned int& address, T & value)
wdt_reset();
#elif defined(ARDUINO_ARCH_MBED_RP2040)|| defined(ARDUINO_ARCH_RP2040)
rp2040.wdt_reset();
#elif defined(ESP32)
//TODO: WDT
#endif

}
Expand Down
16 changes: 8 additions & 8 deletions gbg_program/gbg_program.ino
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ void setup() {
EEPROM.begin(1024);
#elif defined(ESP32)
EEPROM.begin(1024);
//TODO: WDT
#endif
//initialize variables
joyXVal = 512;
Expand Down Expand Up @@ -346,8 +345,6 @@ void loop()
wdt_reset();
#elif defined(ARDUINO_ARCH_MBED_RP2040)|| defined(ARDUINO_ARCH_RP2040)
rp2040.wdt_reset();
#elif defined(ESP32)
//TODO: WDT
#endif

#if defined(ARDUINO_RASPBERRY_PI_PICO_W) || defined(ESP32)
Expand Down Expand Up @@ -464,11 +461,14 @@ void loop()
leftMotorController.writeMicroseconds(LEFT_MOTOR_CENTER);
rightMotorController.writeMicroseconds(RIGHT_MOTOR_CENTER);
}
}

if (movementAllowed) {
leftMotorController.writeMicroseconds(leftMotorWriteVal);
rightMotorController.writeMicroseconds(rightMotorWriteVal);
} else {
if (movementAllowed) {
leftMotorController.writeMicroseconds(leftMotorWriteVal);
rightMotorController.writeMicroseconds(rightMotorWriteVal);
} else {
leftMotorController.writeMicroseconds(LEFT_MOTOR_CENTER);
rightMotorController.writeMicroseconds(RIGHT_MOTOR_CENTER);
}
}
//////////////////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit 20caba3

Please sign in to comment.