rtttl player (#1171)

* rtttl player

* fixes

* Cleanup, add action, condition, etc.

* add test

* updates

* fixes

* Add better error messages

* lint
This commit is contained in:
Guillermo Ruffino
2020-07-25 12:57:11 -03:00
committed by GitHub
parent 4996967c79
commit f6e3070dd8
8 changed files with 356 additions and 6 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ void LEDCOutput::write_state(float state) {
}
void LEDCOutput::setup() {
this->apply_frequency(this->frequency_);
this->update_frequency(this->frequency_);
this->turn_off();
// Attach pin after setting default value
ledcAttachPin(this->pin_->get_pin(), this->channel_);
@@ -50,7 +50,7 @@ optional<uint8_t> ledc_bit_depth_for_frequency(float frequency) {
return {};
}
void LEDCOutput::apply_frequency(float frequency) {
void LEDCOutput::update_frequency(float frequency) {
auto bit_depth_opt = ledc_bit_depth_for_frequency(frequency);
if (!bit_depth_opt.has_value()) {
ESP_LOGW(TAG, "Frequency %f can't be achieved with any bit depth", frequency);