mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 17:54:13 +01:00
Don't allow fingerprint_grow enroll cancellation when no enrollment started (#4745)
This commit is contained in:
parent
55ec082628
commit
70aa38f5bd
2 changed files with 7 additions and 3 deletions
|
@ -77,10 +77,12 @@ void FingerprintGrowComponent::finish_enrollment(uint8_t result) {
|
||||||
this->enrollment_done_callback_.call(this->enrollment_slot_);
|
this->enrollment_done_callback_.call(this->enrollment_slot_);
|
||||||
this->get_fingerprint_count_();
|
this->get_fingerprint_count_();
|
||||||
} else {
|
} else {
|
||||||
|
if (this->enrollment_slot_ != ENROLLMENT_SLOT_UNUSED) {
|
||||||
this->enrollment_failed_callback_.call(this->enrollment_slot_);
|
this->enrollment_failed_callback_.call(this->enrollment_slot_);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this->enrollment_image_ = 0;
|
this->enrollment_image_ = 0;
|
||||||
this->enrollment_slot_ = 0;
|
this->enrollment_slot_ = ENROLLMENT_SLOT_UNUSED;
|
||||||
if (this->enrolling_binary_sensor_ != nullptr) {
|
if (this->enrolling_binary_sensor_ != nullptr) {
|
||||||
this->enrolling_binary_sensor_->publish_state(false);
|
this->enrolling_binary_sensor_->publish_state(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ namespace fingerprint_grow {
|
||||||
|
|
||||||
static const uint16_t START_CODE = 0xEF01;
|
static const uint16_t START_CODE = 0xEF01;
|
||||||
|
|
||||||
|
static const uint16_t ENROLLMENT_SLOT_UNUSED = 0xFFFF;
|
||||||
|
|
||||||
enum GrowPacketType {
|
enum GrowPacketType {
|
||||||
COMMAND = 0x01,
|
COMMAND = 0x01,
|
||||||
DATA = 0x02,
|
DATA = 0x02,
|
||||||
|
@ -158,7 +160,7 @@ class FingerprintGrowComponent : public PollingComponent, public uart::UARTDevic
|
||||||
uint32_t new_password_ = -1;
|
uint32_t new_password_ = -1;
|
||||||
GPIOPin *sensing_pin_{nullptr};
|
GPIOPin *sensing_pin_{nullptr};
|
||||||
uint8_t enrollment_image_ = 0;
|
uint8_t enrollment_image_ = 0;
|
||||||
uint16_t enrollment_slot_ = 0;
|
uint16_t enrollment_slot_ = ENROLLMENT_SLOT_UNUSED;
|
||||||
uint8_t enrollment_buffers_ = 5;
|
uint8_t enrollment_buffers_ = 5;
|
||||||
bool waiting_removal_ = false;
|
bool waiting_removal_ = false;
|
||||||
uint32_t last_aura_led_control_ = 0;
|
uint32_t last_aura_led_control_ = 0;
|
||||||
|
|
Loading…
Reference in a new issue