Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ee696ed

Browse filesBrowse files
committed
Recalibrated.
1 parent 3c9fe76 commit ee696ed
Copy full SHA for ee696ed

File tree

Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed

‎cores/esp8266/core_esp8266_waveform.cpp

Copy file name to clipboardExpand all lines: cores/esp8266/core_esp8266_waveform.cpp
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ constexpr uint32_t ISRTIMEOUTCCYS = microsecondsToClockCycles(18);
5252
// decrement the next IRQ's timer value by a bit so we can actually catch the
5353
// real CPU cycle count we want for the waveforms.
5454
constexpr int32_t DELTAIRQCCYS = clockCyclesPerMicrosecond() == 160 ?
55-
microsecondsToClockCycles(2) >> 1 : microsecondsToClockCycles(2);
55+
microsecondsToClockCycles(1) >> 1 : microsecondsToClockCycles(1);
5656
// The latency between in-ISR rearming of the timer and the earliest firing
5757
constexpr int32_t IRQLATENCYCCYS = clockCyclesPerMicrosecond() == 160 ?
58-
(microsecondsToClockCycles(3) / 2) >> 1 : (microsecondsToClockCycles(3) / 2);
58+
microsecondsToClockCycles(1) >> 1 : microsecondsToClockCycles(1);
5959

6060
// for INFINITE, the NMI proceeds on the waveform without expiry deadline.
6161
// for EXPIRES, the NMI expires the waveform automatically on the expiry ccy.
@@ -108,7 +108,7 @@ static void initTimer() {
108108
ETS_FRC_TIMER1_NMI_INTR_ATTACH(timer1Interrupt);
109109
timer1_enable(TIM_DIV1, TIM_EDGE, TIM_SINGLE);
110110
waveform.timer1Running = true;
111-
timer1_write(CPU2X & 1 ? microsecondsToClockCycles(1) >> 1 : microsecondsToClockCycles(1)); // Cause an interrupt post-haste
111+
timer1_write(IRQLATENCYCCYS); // Cause an interrupt post-haste
112112
}
113113

114114
static void ICACHE_RAM_ATTR deinitTimer() {
@@ -189,7 +189,7 @@ int startWaveformClockCycles(uint8_t pin, uint32_t highCcys, uint32_t lowCcys,
189189
}
190190
else if (T1V > ((clockCyclesPerMicrosecond() == 160) ? (IRQLATENCYCCYS + DELTAIRQCCYS) >> 1 : IRQLATENCYCCYS + DELTAIRQCCYS)) {
191191
// Must not interfere if Timer is due shortly
192-
timer1_write((clockCyclesPerMicrosecond() == 160) ? microsecondsToClockCycles(1) >> 1 : microsecondsToClockCycles(1));
192+
timer1_write(IRQLATENCYCCYS);
193193
}
194194
}
195195
else {
@@ -225,7 +225,7 @@ int ICACHE_RAM_ATTR stopWaveform(uint8_t pin) {
225225
std::atomic_thread_fence(std::memory_order_release);
226226
// Must not interfere if Timer is due shortly
227227
if (T1V > ((clockCyclesPerMicrosecond() == 160) ? (IRQLATENCYCCYS + DELTAIRQCCYS) >> 1 : IRQLATENCYCCYS + DELTAIRQCCYS)) {
228-
timer1_write((clockCyclesPerMicrosecond() == 160) ? microsecondsToClockCycles(1) >> 1 : microsecondsToClockCycles(1));
228+
timer1_write(IRQLATENCYCCYS);
229229
}
230230
while (waveform.toDisableBits) {
231231
/* no-op */ // Can't delay() since stopWaveform may be called from an IRQ

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.