Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmod crashes teensy 4.1, fmodf does not #11

Open
nmz787 opened this issue Nov 13, 2020 · 0 comments
Open

fmod crashes teensy 4.1, fmodf does not #11

nmz787 opened this issue Nov 13, 2020 · 0 comments

Comments

@nmz787
Copy link

nmz787 commented Nov 13, 2020

when compiling and flashing this library as-is, my teensy 4.1 would crash, at least I would fail to get any serial logs out of the device... after debugging, I found the fmod function is for doubles, but fmodf is for floats. Thus these changes are suggested:

 void AD9833 :: SetPhase ( Registers phaseReg, float phaseInDeg ) {
        // Sanity checks on input
-       phaseInDeg = fmod(phaseInDeg,360);
-       if ( phaseInDeg < 0 ) phaseInDeg += 360;
+       // fmod crashes the teensy, fmodf does not
+       phaseInDeg = fmodf(phaseInDeg, 360.);
+       if ( phaseInDeg < 0 ) phaseInDeg += 360.;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant