Merge pull request #49 from Aircoookie/master

Update
pull/755/head
srg74 2020-02-27 14:34:55 -05:00 zatwierdzone przez GitHub
commit 5b9eda9c63
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 9 dodań i 3 usunięć

Wyświetl plik

@ -224,8 +224,8 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
endPin = 32 - __builtin_clz(waveformEnabled); endPin = 32 - __builtin_clz(waveformEnabled);
} }
if (waveformEnabled) {
bool done = false; bool done = false;
if (waveformEnabled) {
do { do {
nextEventCycles = microsecondsToClockCycles(MAXIRQUS); nextEventCycles = microsecondsToClockCycles(MAXIRQUS);
for (int i = startPin; i <= endPin; i++) { for (int i = startPin; i <= endPin; i++) {
@ -257,7 +257,13 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
// Check for toggles // Check for toggles
int32_t cyclesToGo = wave->nextServiceCycle - now; int32_t cyclesToGo = wave->nextServiceCycle - now;
if (cyclesToGo < 0) { if (cyclesToGo < 0) {
cyclesToGo = -((-cyclesToGo) % (wave->nextTimeHighCycles + wave->nextTimeLowCycles)); // See #7057
// The following is a no-op unless we have overshot by an entire waveform cycle.
// As modulus is an expensive operation, this code is removed for now:
// cyclesToGo = -((-cyclesToGo) % (wave->nextTimeHighCycles + wave->nextTimeLowCycles));
//
// Alternative version with lower CPU impact:
// while (-cyclesToGo > wave->nextTimeHighCycles + wave->nextTimeLowCycles) { cyclesToGo += wave->nextTimeHighCycles + wave->nextTimeLowCycles)};
waveformState ^= mask; waveformState ^= mask;
if (waveformState & mask) { if (waveformState & mask) {
if (i == 16) { if (i == 16) {