Skip to content

Commit

Permalink
Merge pull request #11 from FedericoBusero/FedericoBusero-patch-tone
Browse files Browse the repository at this point in the history
Fix tone functions
  • Loading branch information
madhephaestus authored Jan 16, 2020
2 parents f153202 + cacdac0 commit f5461a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ESP32PWM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ double ESP32PWM::writeTone(double freq) {
ChannelUsed[pwm]->adjustFrequencyLocal(freq,
ChannelUsed[pwm]->getDutyScaled());
}
write(1 << (resolutionBits-1)); // writeScaled(0.5);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ESP32Tone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ void tone(int APin,unsigned int frequency){
chan = new ESP32PWM();
}
if(!chan->attached()){
chan->attachPin(APin,1000, 10); // This adds the PWM instance to the factory list
//Serial.println("Attaching AnalogWrite : "+String(APin)+" on PWM "+String(chan->getChannel()));
chan->attachPin(APin,frequency, 10); // This adds the PWM instance to the factory list
//Serial.println("Attaching tone : "+String(APin)+" on PWM "+String(chan->getChannel()));
}
chan->writeTone(frequency);// update the time base of the PWM
}
Expand Down

0 comments on commit f5461a4

Please sign in to comment.