mirror of
https://github.com/esphome/esphome.git
synced 2024-11-30 18:54:14 +01:00
Merge branch 'dev' into dev
This commit is contained in:
commit
abe78835cf
4 changed files with 12 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
|
|
@ -32,7 +32,7 @@ void Rtttl::play(std::string rtttl) {
|
|||
if (this->state_ != State::STATE_STOPPED && this->state_ != State::STATE_STOPPING) {
|
||||
int pos = this->rtttl_.find(':');
|
||||
auto name = this->rtttl_.substr(0, pos);
|
||||
ESP_LOGW(TAG, "RTTL Component is already playing: %s", name.c_str());
|
||||
ESP_LOGW(TAG, "RTTTL Component is already playing: %s", name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,7 @@ void Rtttl::stop() {
|
|||
#ifdef USE_OUTPUT
|
||||
if (this->output_ != nullptr) {
|
||||
this->output_->set_level(0.0);
|
||||
this->set_state_(STATE_STOPPED);
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_SPEAKER
|
||||
|
@ -129,10 +130,10 @@ void Rtttl::stop() {
|
|||
if (this->speaker_->is_running()) {
|
||||
this->speaker_->stop();
|
||||
}
|
||||
this->set_state_(STATE_STOPPING);
|
||||
}
|
||||
#endif
|
||||
this->note_duration_ = 0;
|
||||
this->set_state_(STATE_STOPPING);
|
||||
}
|
||||
|
||||
void Rtttl::loop() {
|
||||
|
@ -342,6 +343,7 @@ void Rtttl::finish_() {
|
|||
#ifdef USE_OUTPUT
|
||||
if (this->output_ != nullptr) {
|
||||
this->output_->set_level(0.0);
|
||||
this->set_state_(State::STATE_STOPPED);
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_SPEAKER
|
||||
|
@ -354,9 +356,9 @@ void Rtttl::finish_() {
|
|||
this->speaker_->play((uint8_t *) (&sample), 8);
|
||||
|
||||
this->speaker_->finish();
|
||||
this->set_state_(State::STATE_STOPPING);
|
||||
}
|
||||
#endif
|
||||
this->set_state_(State::STATE_STOPPING);
|
||||
this->note_duration_ = 0;
|
||||
this->on_finished_playback_callback_.call();
|
||||
ESP_LOGD(TAG, "Playback finished");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -480,7 +480,7 @@ void HOT WaveshareEPaperTypeA::display() {
|
|||
this->start_data_();
|
||||
switch (this->model_) {
|
||||
case TTGO_EPAPER_2_13_IN_B1: { // block needed because of variable initializations
|
||||
int16_t wb = ((this->get_width_internal()) >> 3);
|
||||
int16_t wb = ((this->get_width_controller()) >> 3);
|
||||
for (int i = 0; i < this->get_height_internal(); i++) {
|
||||
for (int j = 0; j < wb; j++) {
|
||||
int idx = j + (this->get_height_internal() - 1 - i) * wb;
|
||||
|
@ -766,7 +766,7 @@ void WaveshareEPaper2P7InV2::initialize() {
|
|||
// XRAM_START_AND_END_POSITION
|
||||
this->command(0x44);
|
||||
this->data(0x00);
|
||||
this->data(((get_width_internal() - 1) >> 3) & 0xFF);
|
||||
this->data(((this->get_width_controller() - 1) >> 3) & 0xFF);
|
||||
// YRAM_START_AND_END_POSITION
|
||||
this->command(0x45);
|
||||
this->data(0x00);
|
||||
|
@ -928,8 +928,8 @@ void HOT WaveshareEPaper2P7InB::display() {
|
|||
|
||||
// TCON_RESOLUTION
|
||||
this->command(0x61);
|
||||
this->data(this->get_width_internal() >> 8);
|
||||
this->data(this->get_width_internal() & 0xff); // 176
|
||||
this->data(this->get_width_controller() >> 8);
|
||||
this->data(this->get_width_controller() & 0xff); // 176
|
||||
this->data(this->get_height_internal() >> 8);
|
||||
this->data(this->get_height_internal() & 0xff); // 264
|
||||
|
||||
|
@ -994,7 +994,7 @@ void WaveshareEPaper2P7InBV2::initialize() {
|
|||
// self.SetWindows(0, 0, self.width-1, self.height-1)
|
||||
// SetWindows(self, Xstart, Ystart, Xend, Yend):
|
||||
|
||||
uint32_t xend = this->get_width_internal() - 1;
|
||||
uint32_t xend = this->get_width_controller() - 1;
|
||||
uint32_t yend = this->get_height_internal() - 1;
|
||||
this->command(0x44);
|
||||
this->data(0x00);
|
||||
|
|
Loading…
Reference in a new issue