Skip to content

Commit f719bb2

Browse files
committed
Support restart switch from 160MHz to 80MHz, e.g for OTA. Fixes #579
1 parent 7210ad3 commit f719bb2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: cores/esp8266/core_esp8266_main.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,16 @@ void initVariant() {
8484
extern "C" void __preloop_update_frequency() {
8585
#if defined(F_CPU) && (F_CPU == 160000000L)
8686
ets_update_cpu_frequency(160);
87-
CPU2X |= 1;
87+
CPU2X |= 1UL;
88+
#elif defined(F_CPU)
89+
ets_update_cpu_frequency(80);
90+
CPU2X &= ~1UL;
8891
#elif !defined(F_CPU)
8992
if (system_get_cpu_freq() == 160) {
90-
CPU2X |= 1;
93+
CPU2X |= 1UL;
94+
}
95+
else {
96+
CPU2X &= ~1UL;
9197
}
9298
#endif
9399
}

0 commit comments

Comments
 (0)