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

Pickup some loose ends from PR #7122 #7218

Merged
merged 3 commits into from
Apr 19, 2020
Merged

Conversation

dok-net
Copy link
Contributor

@dok-net dok-net commented Apr 17, 2020

Future-proofing #7122, newly introduced public startWaveformCycles() is more aptly named startWaveformClockCycles() (like in rest of core API for this type of use).
Fix/clarify comments.

Fix redundancies in Tone, end Tone waveform on exact period limit for proper sound.
Fix redundancies in wiring_pwm.
Extend Servo to map in-use pins, Tone already has this.

…ckCycles (like in rest of core API for this type of use).

Fix/clarify comments.
Fix redundancies in Tone, end Tone waveform on exact period limit for proper sound.
Fix redundancies in wiring_pwmExtend Servo to map in-use pins, Tone already has this.
@dok-net dok-net changed the title Pickup lose some ends from PR #7211 Pickup some lose ends from PR #7211 Apr 17, 2020
@dok-net dok-net changed the title Pickup some lose ends from PR #7211 Pickup some loose ends from PR #7211 Apr 17, 2020
Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup and fixing the comments to match the code.

For the Servo changes, I'm not seeing it used anywhere but keeping a mask like in the other 2 users of waveforms seems like a nice thing to do.

@@ -49,7 +52,7 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration) {
if (frequency == 0) {
noTone(_pin);
} else {
uint32_t period = (1000000L * system_get_cpu_freq()) / frequency;
uint32_t period = microsecondsToClockCycles(1000000UL) / frequency;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether this change is ok. The microsecondsToClockCycles() define uses the F_CPU macro, while system_get_cpu_freq() is the SDK api call.
I think it is ok because these functions aren't supposed to be called from an ISR. Also, if built for 160MHz, execution will be done at that speed something like 95% of the time.

@d-a-v d-a-v merged commit ea1fdb2 into esp8266:master Apr 19, 2020
@dok-net dok-net deleted the fixup_7211 branch April 19, 2020 14:17
@d-a-v d-a-v changed the title Pickup some loose ends from PR #7211 Pickup some loose ends from PR #122 Apr 26, 2020
@d-a-v d-a-v changed the title Pickup some loose ends from PR #122 Pickup some loose ends from PR #7122 Apr 26, 2020
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.

4 participants