Merge branch 'dev' into dev

This commit is contained in:
CptSkippy 2024-08-21 10:02:31 -07:00 committed by GitHub
commit abe78835cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 10 deletions

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <stddef.h> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <functional> #include <functional>
#include <vector> #include <vector>

View file

@ -32,7 +32,7 @@ void Rtttl::play(std::string rtttl) {
if (this->state_ != State::STATE_STOPPED && this->state_ != State::STATE_STOPPING) { if (this->state_ != State::STATE_STOPPED && this->state_ != State::STATE_STOPPING) {
int pos = this->rtttl_.find(':'); int pos = this->rtttl_.find(':');
auto name = this->rtttl_.substr(0, pos); 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; return;
} }
@ -122,6 +122,7 @@ void Rtttl::stop() {
#ifdef USE_OUTPUT #ifdef USE_OUTPUT
if (this->output_ != nullptr) { if (this->output_ != nullptr) {
this->output_->set_level(0.0); this->output_->set_level(0.0);
this->set_state_(STATE_STOPPED);
} }
#endif #endif
#ifdef USE_SPEAKER #ifdef USE_SPEAKER
@ -129,10 +130,10 @@ void Rtttl::stop() {
if (this->speaker_->is_running()) { if (this->speaker_->is_running()) {
this->speaker_->stop(); this->speaker_->stop();
} }
this->set_state_(STATE_STOPPING);
} }
#endif #endif
this->note_duration_ = 0; this->note_duration_ = 0;
this->set_state_(STATE_STOPPING);
} }
void Rtttl::loop() { void Rtttl::loop() {
@ -342,6 +343,7 @@ void Rtttl::finish_() {
#ifdef USE_OUTPUT #ifdef USE_OUTPUT
if (this->output_ != nullptr) { if (this->output_ != nullptr) {
this->output_->set_level(0.0); this->output_->set_level(0.0);
this->set_state_(State::STATE_STOPPED);
} }
#endif #endif
#ifdef USE_SPEAKER #ifdef USE_SPEAKER
@ -354,9 +356,9 @@ void Rtttl::finish_() {
this->speaker_->play((uint8_t *) (&sample), 8); this->speaker_->play((uint8_t *) (&sample), 8);
this->speaker_->finish(); this->speaker_->finish();
this->set_state_(State::STATE_STOPPING);
} }
#endif #endif
this->set_state_(State::STATE_STOPPING);
this->note_duration_ = 0; this->note_duration_ = 0;
this->on_finished_playback_callback_.call(); this->on_finished_playback_callback_.call();
ESP_LOGD(TAG, "Playback finished"); ESP_LOGD(TAG, "Playback finished");

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <stddef.h> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <vector> #include <vector>

View file

@ -480,7 +480,7 @@ void HOT WaveshareEPaperTypeA::display() {
this->start_data_(); this->start_data_();
switch (this->model_) { switch (this->model_) {
case TTGO_EPAPER_2_13_IN_B1: { // block needed because of variable initializations 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 i = 0; i < this->get_height_internal(); i++) {
for (int j = 0; j < wb; j++) { for (int j = 0; j < wb; j++) {
int idx = j + (this->get_height_internal() - 1 - i) * wb; int idx = j + (this->get_height_internal() - 1 - i) * wb;
@ -766,7 +766,7 @@ void WaveshareEPaper2P7InV2::initialize() {
// XRAM_START_AND_END_POSITION // XRAM_START_AND_END_POSITION
this->command(0x44); this->command(0x44);
this->data(0x00); 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 // YRAM_START_AND_END_POSITION
this->command(0x45); this->command(0x45);
this->data(0x00); this->data(0x00);
@ -928,8 +928,8 @@ void HOT WaveshareEPaper2P7InB::display() {
// TCON_RESOLUTION // TCON_RESOLUTION
this->command(0x61); this->command(0x61);
this->data(this->get_width_internal() >> 8); this->data(this->get_width_controller() >> 8);
this->data(this->get_width_internal() & 0xff); // 176 this->data(this->get_width_controller() & 0xff); // 176
this->data(this->get_height_internal() >> 8); this->data(this->get_height_internal() >> 8);
this->data(this->get_height_internal() & 0xff); // 264 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) // self.SetWindows(0, 0, self.width-1, self.height-1)
// SetWindows(self, Xstart, Ystart, Xend, Yend): // 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; uint32_t yend = this->get_height_internal() - 1;
this->command(0x44); this->command(0x44);
this->data(0x00); this->data(0x00);