Unverified Commit 90390890 authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Fix PWMAudio::write(buffer, len) (#2202)

PWMAudio was only ever writing one half the buffer passed in because
of an off-by-2 error.  Fixes the sine output in KeyboardPiano.
parent 8bc8c824
......@@ -242,8 +242,8 @@ size_t PWMAudio::write(const uint8_t *buffer, size_t size) {
return writtenSize;
} else {
p++;
size -= 4;
writtenSize += 4;
size -= 2;
writtenSize += 2;
}
}
return writtenSize;
......@@ -288,4 +288,4 @@ void PWMAudio::find_pacer_fraction(int target, uint16_t *numerator, uint16_t *de
last_target = target;
*numerator = bestNum;
*denominator = bestDenom;
}
\ No newline at end of file
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment