Skip to content

Commit

Permalink
workign on start pulse for esp32
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-8 committed Sep 25, 2024
1 parent f6f9eda commit 41b71f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gbg_program/_Save_Recall.ino
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ void settingsSerial() {
leftMotorController.writeMicroseconds(LEFT_MOTOR_CENTER);
leftMotorController.detach();
LEFT_MOTOR_CONTROLLER_PIN = atoi(v);
delay(10);
leftMotorController.attach(LEFT_MOTOR_CONTROLLER_PIN);
leftMotorController.writeMicroseconds(LEFT_MOTOR_CENTER);
rightMotorController.attach(RIGHT_MOTOR_CONTROLLER_PIN);
Expand All @@ -174,6 +175,7 @@ void settingsSerial() {
rightMotorController.writeMicroseconds(RIGHT_MOTOR_CENTER);
rightMotorController.detach();
RIGHT_MOTOR_CONTROLLER_PIN = atoi(v);
delay(10);
rightMotorController.attach(RIGHT_MOTOR_CONTROLLER_PIN);
rightMotorController.writeMicroseconds(RIGHT_MOTOR_CENTER);
leftMotorController.attach(LEFT_MOTOR_CONTROLLER_PIN);
Expand All @@ -192,7 +194,7 @@ void settingsSerial() {
RIGHT_MOTOR_PULSE = atoi(v);
sprintf(resultBuf, "%d", RIGHT_MOTOR_PULSE);
} else if (strcmp(k, "START_MOTOR_PULSE_TIME") == 0) {
START_MOTOR_PULSE_TIME = max(atoi(v), 0);
START_MOTOR_PULSE_TIME = constrain(atoi(v), 0, 1000);
sprintf(resultBuf, "%d", START_MOTOR_PULSE_TIME);
} else if (strcmp(k, "ENABLE_STARTUP_PULSE") == 0) {
ENABLE_STARTUP_PULSE = atoi(v);
Expand Down
1 change: 1 addition & 0 deletions gbg_program/gbg_program.ino
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ void loop()
if (startupPulse && joyOK && delayedStartDone) {
startupPulse = false;
if (movementAllowed) { // don't pulse if the website says don't move
delay(10);
leftMotorController.writeMicroseconds(LEFT_MOTOR_CENTER + LEFT_MOTOR_PULSE * (LEFT_MOTOR_SLOW > 0 ? 1 : -1));
rightMotorController.writeMicroseconds(RIGHT_MOTOR_CENTER + RIGHT_MOTOR_PULSE * (RIGHT_MOTOR_SLOW > 0 ? 1 : -1));
}
Expand Down

0 comments on commit 41b71f5

Please sign in to comment.