Skip to content

Commit

Permalink
Merge pull request #715 from MaslowCNC/explore-bug-in-setting-chain-len
Browse files Browse the repository at this point in the history
Truncate number of digits sent for distperrot
  • Loading branch information
BarbourSmith authored Apr 25, 2018
2 parents 1ba4d44 + 1406330 commit b2ca3d7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,18 @@ def computeSettings(self, section, key, value):

if self.config.has_option('Advanced Settings', 'leftChainTolerance'):
distPerRotLeftChainTolerance = (1 + (float(self.config.get('Advanced Settings', 'leftChainTolerance')) / 100)) * float(self.config.get('Advanced Settings', 'gearTeeth')) * float(self.config.get('Advanced Settings', 'chainPitch'))
self.config.set('Computed Settings', "distPerRotLeftChainTolerance", str(distPerRotLeftChainTolerance))
self.config.set('Computed Settings', "distPerRotLeftChainTolerance", str("{0:.5f}".format(distPerRotLeftChainTolerance)))
if self.config.has_option('Advanced Settings', 'rightChainTolerance'):
distPerRotRightChainTolerance = (1 + (float(self.config.get('Advanced Settings', 'rightChainTolerance')) / 100)) * float(self.config.get('Advanced Settings', 'gearTeeth')) * float(self.config.get('Advanced Settings', 'chainPitch'))
self.config.set('Computed Settings', "distPerRotRightChainTolerance", str(distPerRotRightChainTolerance))
self.config.set('Computed Settings', "distPerRotRightChainTolerance", str("{0:.5f}".format(distPerRotRightChainTolerance)))

elif key == 'leftChainTolerance' and self.config.has_option('Advanced Settings', 'leftChainTolerance') and self.config.has_option('Computed Settings', 'distPerRot'):
distPerRotLeftChainTolerance = (1 + (float(self.config.get('Advanced Settings', 'leftChainTolerance')) / 100)) * float(self.config.get('Computed Settings', 'distPerRot'))
self.config.set('Computed Settings', "distPerRotLeftChainTolerance", str(distPerRotLeftChainTolerance))
self.config.set('Computed Settings', "distPerRotLeftChainTolerance", str("{0:.5f}".format(distPerRotLeftChainTolerance)))

elif key == 'rightChainTolerance' and self.config.has_option('Advanced Settings', 'rightChainTolerance') and self.config.has_option('Computed Settings', 'distPerRot'):
distPerRotRightChainTolerance = (1 + (float(self.config.get('Advanced Settings', 'rightChainTolerance')) / 100)) * float(self.config.get('Computed Settings', 'distPerRot'))
self.config.set('Computed Settings', "distPerRotRightChainTolerance", str(distPerRotRightChainTolerance))
self.config.set('Computed Settings', "distPerRotRightChainTolerance", str("{0:.5f}".format(distPerRotRightChainTolerance)))

elif key == 'enablePosPIDValues':
for key in ('KpPos', 'KiPos', 'KdPos', 'propWeight'):
Expand Down Expand Up @@ -250,7 +250,7 @@ def configSettingChange(self, section, key, value):
value = 3
else:
value = 0

# Update Computed Settings
self.computeSettings(section, key, value)
Expand Down

0 comments on commit b2ca3d7

Please sign in to comment.