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

Add PWM frequency to system settings #389

Merged

Conversation

blurfl
Copy link
Collaborator

@blurfl blurfl commented Feb 10, 2018

This builds upon PR #385 and #386 to allow changing the PWM prescaler frequency from GroundControl.

This needs a cooresponding GroundControl PR (GroundControl #619).

  • add a system setting $39 fPWM
  • set the default value to 3 = 490Hz
  • change the prescaler for timers2-4 on change of fPWM
  • report the change if verboseDebug > 0

This needs a cooresponding GroundControl PR (as yet unsubmitted).

 - add a system setting $39 fPWM
 - set the default value to 3 = 490Hz
 - change the prescaler for timers2-4 on change of fPWM
 - report the change if verboseDebug > 0
@krkeegan
Copy link
Collaborator

You also need to increment the SettingsVersion number in settings.h as well. This ensures that settings on the arduino are wiped and reloaded with the default and then loaded from GC. Otherwise, the new variable or potentially other variables can have some very odd values or even overflows.

@blurfl
Copy link
Collaborator Author

blurfl commented Feb 10, 2018

Interesting, you can change PWM frequency within a cut file using $39= commands in the cut file.
$39=1 -> 31,000Hz $39=2 -> 4,100Hz $39=3 -> 490Hz
Most changes seem pretty benign, though changing fPWM into 4,100Hz causes quite a lag sometimes. Probably not something to be used in every-day cutting, but interesting to use while exploring 😀.

@blurfl
Copy link
Collaborator Author

blurfl commented Feb 10, 2018

it seems like the lag can happen with any speed change during a cut, but putting in a manual z-axis change (or a several-second long auto one) seems to give the affected routine (PID?) time to clear or catch up. Not that a speed change would be useful, but it does cast interesting shadows of some internal process.

@blurfl
Copy link
Collaborator Author

blurfl commented Feb 13, 2018

To see it change, turn on 'verboseDebug' in Config.h...

@BarbourSmith
Copy link
Member

This is so mind blowing. Wow. I want to keep playing around with it more, but even just changing the settings and hearing the tone change is incredible. It's funny that the noise has been with us for so long and now we can change it. What a fundamentally cool thing! It feels like this PR really touches the heart of the machine. Awesome work @blurfl!! You are really on fire here.

@BarbourSmith BarbourSmith merged commit 8488335 into MaslowCNC:master Feb 13, 2018
blurfl added a commit to blurfl/Firmware that referenced this pull request Apr 13, 2018
PR MaslowCNC#389 replaced this function with one of the same name which accepts a setting parameter.
BarbourSmith added a commit that referenced this pull request Apr 13, 2018
…tion

remove function that was replaced in PR #389
@blurfl blurfl deleted the add-PWM-frequency-to-system-settings branch June 18, 2018 17:52
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

Successfully merging this pull request may close these issues.

3 participants