Automatically tune the optimal baud value for the next packet (#69)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
f323e02df1
commit
7da1282ecb
|
@ -84,11 +84,11 @@ async def to_code(config):
|
||||||
|
|
||||||
cg.add_library(
|
cg.add_library(
|
||||||
name="secplus",
|
name="secplus",
|
||||||
repository="https://github.com/esphome-ratgdo/secplus",
|
repository="https://github.com/ratgdo/secplus#f98c3220356c27717a25102c0b35815ebbd26ccc",
|
||||||
version="f98c3220356c27717a25102c0b35815ebbd26ccc",
|
version=None,
|
||||||
)
|
)
|
||||||
cg.add_library(
|
cg.add_library(
|
||||||
name="espsoftwareserial",
|
name="espsoftwareserial",
|
||||||
repository="https://github.com/esphome-ratgdo/espsoftwareserial",
|
repository="https://github.com/ratgdo/espsoftwareserial#autobaud",
|
||||||
version="2f408224633316b997f82339e5b2731b1e561060",
|
version=None,
|
||||||
)
|
)
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace ratgdo {
|
||||||
}
|
}
|
||||||
this->sw_serial_.begin(9600, SWSERIAL_8N1, this->input_gdo_pin_->get_pin(), this->output_gdo_pin_->get_pin(), true);
|
this->sw_serial_.begin(9600, SWSERIAL_8N1, this->input_gdo_pin_->get_pin(), this->output_gdo_pin_->get_pin(), true);
|
||||||
this->sw_serial_.enableIntTx(false);
|
this->sw_serial_.enableIntTx(false);
|
||||||
|
this->sw_serial_.enableAutoBaud(true);
|
||||||
|
|
||||||
ESP_LOGV(TAG, "Syncing rolling code counter after reboot...");
|
ESP_LOGV(TAG, "Syncing rolling code counter after reboot...");
|
||||||
|
|
||||||
|
@ -400,6 +401,7 @@ namespace ratgdo {
|
||||||
|
|
||||||
// if we are at the start of a message, capture the next 16 bytes
|
// if we are at the start of a message, capture the next 16 bytes
|
||||||
if (msg_start == 0x550100) {
|
if (msg_start == 0x550100) {
|
||||||
|
ESP_LOG1(TAG, "Baud: %d", this->sw_serial_.baudRate());
|
||||||
rx_packet[0] = 0x55;
|
rx_packet[0] = 0x55;
|
||||||
rx_packet[1] = 0x01;
|
rx_packet[1] = 0x01;
|
||||||
rx_packet[2] = 0x00;
|
rx_packet[2] = 0x00;
|
||||||
|
|
Loading…
Reference in New Issue