Skip to content

Commit

Permalink
fixes for updi getting stuck on flash (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan authored Dec 27, 2024
1 parent d5c294b commit d93e743
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
14 changes: 3 additions & 11 deletions VortexEngine/src/Menus/MenuList/EditorConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,16 +428,13 @@ void EditorConnection::handleState()
break;
}
UPDI::eraseMemory();


m_curStep = 0;
m_firmwareOffset = 0;
Leds::setAll(RGB_YELLOW3);
m_receiveBuffer.clear();
Leds::setAll(RGB_YELLOW3);
SerialComs::write(EDITOR_VERB_READY);
// TODO: this god awful delay idk why it's necessary but without
// it the serial seems to get stuck. It appears like an esp internals
// issue with serial but maybe this logic is just buggy -- it runs fine
// when simulated in test framework connected to editor though
Time::delayMilliseconds(300);
m_state = STATE_CHROMALINK_FLASH_FIRMWARE_RECEIVE;
break;
case STATE_CHROMALINK_FLASH_FIRMWARE_RECEIVE:
Expand All @@ -447,11 +444,6 @@ void EditorConnection::handleState()
}
// send ack
SerialComs::write(EDITOR_VERB_FLASH_FIRMWARE_ACK);
// TODO: this god awful delay idk why it's necessary but without
// it the serial seems to get stuck. It appears like an esp internals
// issue with serial but maybe this logic is just buggy -- it runs fine
// when simulated in test framework connected to editor though
Time::delayMilliseconds(5);
// only once the entire firmware is written
if (m_firmwareOffset >= m_firmwareSize) {
// then done
Expand Down
7 changes: 3 additions & 4 deletions VortexEngine/src/UPDI/updi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,12 +720,12 @@ void UPDI::enterProgrammingMode()
stcs(Control_A, 0x6);
mode = cpu_mode<0xEF>();
if (mode != 0x82 && mode != 0x21 && mode != 0xA2 && mode != 0x08) {
sendDoubleBreak();
//sendDoubleBreak();
sendBreak();
uint8_t status = ldcs(Status_B);
ERROR_LOGF("Bad CPU Mode 0x%02x... error: 0x%02x", mode, status);
reset();
//reset();
continue;
//return false;
}
if (mode != 0x08) {
sendProgKey();
Expand All @@ -734,7 +734,6 @@ void UPDI::enterProgrammingMode()
ERROR_LOGF("Bad prog key status: 0x%02x", status);
reset();
continue;
//return false;
}
reset();
}
Expand Down

0 comments on commit d93e743

Please sign in to comment.