Skip to content
This repository has been archived by the owner on Sep 14, 2019. It is now read-only.

Commit

Permalink
Oops, helps to actually commit the fix too..
Browse files Browse the repository at this point in the history
  • Loading branch information
mutability committed Jan 17, 2015
1 parent d1f274d commit f0fe466
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mode_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,11 @@ void applyPhaseCorrection(uint16_t *pPayload) {
uint32_t early = (pPayload[-1] + pPayload[6]) << 1;
uint32_t late = (pPayload[3] + pPayload[10]) << 1;

if (onTime == 0 && early == 0 && late == 0) {
// Blah, can't do anything with this, avoid a divide-by-zero
return;
}

if (early > late) {
// Our sample period starts late and so includes some of the next bit.

Expand Down

0 comments on commit f0fe466

Please sign in to comment.