Skip to content

Commit

Permalink
Support restart switch from 160MHz to 80MHz, e.g for OTA. Fixes #579
Browse files Browse the repository at this point in the history
  • Loading branch information
dok-net committed Apr 11, 2020
1 parent 7210ad3 commit f719bb2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cores/esp8266/core_esp8266_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,16 @@ void initVariant() {
extern "C" void __preloop_update_frequency() {
#if defined(F_CPU) && (F_CPU == 160000000L)
ets_update_cpu_frequency(160);
CPU2X |= 1;
CPU2X |= 1UL;
#elif defined(F_CPU)
ets_update_cpu_frequency(80);
CPU2X &= ~1UL;
#elif !defined(F_CPU)
if (system_get_cpu_freq() == 160) {
CPU2X |= 1;
CPU2X |= 1UL;
}
else {
CPU2X &= ~1UL;
}
#endif
}
Expand Down

0 comments on commit f719bb2

Please sign in to comment.