Skip to content

Commit

Permalink
Add random variability to looptime for testing (assuming looptime is >0)
Browse files Browse the repository at this point in the history
CAUTION: NO PROPS! DON'T FLY! NO PROPS! DON'T FLY!
  • Loading branch information
thenickdude committed Mar 16, 2015
1 parent 1e7fb08 commit 664c932
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/mw.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,9 @@ void loop(void)
if (masterConfig.looptime == 0 || (int32_t)(currentTime - loopTime) >= 0) {
loopTime = currentTime + masterConfig.looptime;

// Use the currentTime as a source of entropy to add random variability to the loop time
loopTime += 301 * (currentTime % 511);

imuUpdate(&currentProfile->accelerometerTrims, masterConfig.mixerMode);

// Measure loop rate just after reading the sensors
Expand Down

0 comments on commit 664c932

Please sign in to comment.