Skip to content

Commit

Permalink
Make host reboot after ESP upload and improve windows compatibility
Browse files Browse the repository at this point in the history
 - We will detect a timeout by only looking at bytes coming from the
 computer to properly detect when the computer is done programming.
 - Tested the official ESP uploader and made sure it works too with
 speed of 921600.
 - Changed default speed to 921600 because 2000000 does not work on
 Windows
  • Loading branch information
sarfata committed Jul 6, 2018
1 parent 0fbf3c8 commit 11eaf7e
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -91,6 +91,7 @@ build_flags = -Wall -Werror -fno-strict-aliasing
platform=https://github.com/platformio/platform-espressif8266.git#feature/stage
framework = arduino
board = esp_wroom_02
upload_speed = 921600
extra_scripts =
tools/platformio_cfg_esp.py
tools/platformio_cfg_gitversion.py
2 changes: 0 additions & 2 deletions src/host/esp-programmer/ESPProgrammer.cpp
Original file line number Diff line number Diff line change
@@ -121,7 +121,6 @@ void ESPProgrammer::loopByteMode() {
if (espSerial.available()) {
int read = espSerial.readBytes(buffer, min(bootloaderMtu, espSerial.available()));
computerSerial.write(buffer, read);
timeSinceLastByte = 0;
}
}
}
@@ -165,7 +164,6 @@ void ESPProgrammer::loopFrameMode() {
size_t len = espConnection.readFrame(buffer, bootloaderMtu);
debugFrame("ESP", buffer, len);
computerConnection.writeFrame(buffer, len);
timeSinceLastByte = 0;
}
}

4 changes: 2 additions & 2 deletions src/host/services/USBService.cpp
Original file line number Diff line number Diff line change
@@ -74,10 +74,10 @@ void USBService::loop() {
_state = ConnectedDebug;
}

/* Switching serial port to 230400 on computer signals that the host
/* Switching serial port to 230400 (or 921600) on computer signals that the host
* wants to go into ESP Programming mode.
*/
if (Serial.baud() == 230400) {
if (Serial.baud() == 230400 || Serial.baud() == 921600) {
_state = ConnectedESPProgramming;
}

2 changes: 1 addition & 1 deletion tools/platformio_cfg_esp.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
env.Replace(
LOCAL_UPLOADERFLAGS=[
"-p", "$UPLOAD_PORT",
"-b", "2000000",
"-b", "$UPLOAD_SPEED",
"write_flash", "--flash_mode", "dio", "--flash_size", "16m",
],
UPLOADER=LOCAL_UPLOADER,

0 comments on commit 11eaf7e

Please sign in to comment.