chore(mr60fda2): edit value

This commit is contained in:
Spencer Yan 2024-10-24 11:15:55 +08:00
parent 02b1eb6382
commit e0ee4a5bdd
4 changed files with 6 additions and 6 deletions

View file

@ -16,7 +16,7 @@ GetRadarParametersButton = mr60fda2_ns.class_("GetRadarParametersButton", button
ResetRadarButton = mr60fda2_ns.class_("ResetRadarButton", button.Button)
CONF_GET_RADAR_PARAMETERS = "get_radar_parameters"
CONF_FACTORY_RESET = "reset_radar"
CONF_FACTORY_RESET = "factory_reset"
CONFIG_SCHEMA = {
cv.GenerateID(CONF_MR60FDA2_ID): cv.use_id(MR60FDA2Component),
@ -39,7 +39,7 @@ async def to_code(config):
b = await button.new_button(get_radar_parameters_config)
await cg.register_parented(b, config[CONF_MR60FDA2_ID])
cg.add(mr60fda2_component.set_get_radar_parameters_button(b))
if reset_radar_config := config.get(CONF_FACTORY_RESET):
b = await button.new_button(reset_radar_config)
if factory_reset_config := config.get(CONF_FACTORY_RESET):
b = await button.new_button(factory_reset_config)
await cg.register_parented(b, config[CONF_MR60FDA2_ID])
cg.add(mr60fda2_component.set_factory_reset_button(b))

View file

@ -3,7 +3,7 @@
namespace esphome {
namespace seeed_mr60fda2 {
void ResetRadarButton::press_action() { this->parent_->reset_radar(); }
void ResetRadarButton::press_action() { this->parent_->factory_reset(); }
} // namespace seeed_mr60fda2
} // namespace esphome

View file

@ -377,7 +377,7 @@ void MR60FDA2Component::get_radar_parameters() {
ESP_LOGV(TAG, "SEND GET PARAMETERS: %s", format_hex_pretty(send_data, 8).c_str());
}
void MR60FDA2Component::reset_radar() {
void MR60FDA2Component::factory_reset() {
uint8_t send_data[8] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x21, 0x10, 0xCF};
this->send_query_(send_data, 8);
ESP_LOGV(TAG, "SEND RESET: %s", format_hex_pretty(send_data, 8).c_str());

View file

@ -101,7 +101,7 @@ class MR60FDA2Component : public Component,
void set_height_threshold(uint8_t index);
void set_sensitivity(uint8_t index);
void get_radar_parameters();
void reset_radar();
void factory_reset();
};
} // namespace seeed_mr60fda2