Skip to content

Commit

Permalink
Merge pull request #783 from madgrizzle/chain-tolerance-correction
Browse files Browse the repository at this point in the history
Simplified Chain Tolerance Correction
  • Loading branch information
MaslowCommunityGardenRobot committed Oct 25, 2018
2 parents daad2a0 + a40505c commit 6ac8ced
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
16 changes: 4 additions & 12 deletions Settings/maslowSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,16 @@
"title": "Chain Tolerance, Left Chain",
"desc": "The tolerance adjustment for the left chain length, in percent",
"key": "leftChainTolerance",
"default": 0
"default": 0,
"firmwareKey": 40
},
{
"type": "string",
"title": "Chain Tolerance, Right Chain",
"desc": "The tolerance adjustment for the right chain length, in percent",
"key": "rightChainTolerance",
"default": 0
"default": 0,
"firmwareKey": 41
},
{
"type": "options",
Expand Down Expand Up @@ -576,16 +578,6 @@
"key": "fPWMComputed",
"firmwareKey": 39
},
{
"type": "string",
"key": "distPerRotLeftChainTolerance",
"firmwareKey": 40
},
{
"type": "string",
"key": "distPerRotRightChainTolerance",
"firmwareKey": 41
}
],
"Background Settings":
[
Expand Down
15 changes: 0 additions & 15 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,6 @@ def computeSettings(self, section, key, value):
distPerRot = float(self.config.get('Advanced Settings', 'gearTeeth')) * float(self.config.get('Advanced Settings', 'chainPitch'))
self.config.set('Computed Settings', "distPerRot", str(distPerRot))

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("{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("{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("{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("{0:.5f}".format(distPerRotRightChainTolerance)))

elif key == 'enablePosPIDValues':
for key in ('KpPos', 'KiPos', 'KdPos', 'propWeight'):
if int(self.config.get('Advanced Settings', 'enablePosPIDValues')) == 1:
Expand Down

0 comments on commit 6ac8ced

Please sign in to comment.