mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 11:47:30 +01:00
ld2420: Firmware v1.5.4+ bug workaround (#6168)
This commit is contained in:
parent
e7fe2a2816
commit
d692b5404c
@ -211,10 +211,11 @@ void LD2420Component::factory_reset_action() {
|
||||
void LD2420Component::restart_module_action() {
|
||||
ESP_LOGCONFIG(TAG, "Restarting LD2420 module...");
|
||||
this->send_module_restart();
|
||||
delay_microseconds_safe(45000);
|
||||
this->set_timeout(250, [this]() {
|
||||
this->set_config_mode(true);
|
||||
this->set_system_mode(system_mode_);
|
||||
this->set_config_mode(false);
|
||||
});
|
||||
ESP_LOGCONFIG(TAG, "LD2420 Restarted.");
|
||||
}
|
||||
|
||||
@ -527,10 +528,8 @@ int LD2420Component::send_cmd_from_array(CmdFrameT frame) {
|
||||
this->write_byte(cmd_buffer[index]);
|
||||
}
|
||||
|
||||
delay_microseconds_safe(500); // give the module a moment to process it
|
||||
error = 0;
|
||||
if (frame.command == CMD_RESTART) {
|
||||
delay_microseconds_safe(25000); // Wait for the restart
|
||||
return 0; // restart does not reply exit now
|
||||
}
|
||||
|
||||
@ -538,7 +537,7 @@ int LD2420Component::send_cmd_from_array(CmdFrameT frame) {
|
||||
while (available()) {
|
||||
this->readline_(read(), ack_buffer, sizeof(ack_buffer));
|
||||
}
|
||||
delay_microseconds_safe(250);
|
||||
delay_microseconds_safe(1450);
|
||||
if (loop_count <= 0) {
|
||||
error = LD2420_ERROR_TIMEOUT;
|
||||
retry--;
|
||||
|
Loading…
Reference in New Issue
Block a user