mirror of
https://github.com/esphome/esphome.git
synced 2025-09-17 10:42:21 +01:00
Add get_size method to QR Code header (#6430)
This commit is contained in:
committed by
GitHub
parent
0ff543ffe5
commit
9194f7eb27
@@ -51,5 +51,17 @@ void QrCode::draw(display::Display *buff, uint16_t x_offset, uint16_t y_offset,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t QrCode::get_size() {
|
||||
if (this->needs_update_) {
|
||||
this->generate_qr_code();
|
||||
this->needs_update_ = false;
|
||||
}
|
||||
|
||||
uint8_t size = qrcodegen_getSize(this->qr_);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
} // namespace qr_code
|
||||
} // namespace esphome
|
||||
|
@@ -24,6 +24,8 @@ class QrCode : public Component {
|
||||
|
||||
void generate_qr_code();
|
||||
|
||||
uint8_t get_size();
|
||||
|
||||
protected:
|
||||
std::string value_;
|
||||
qrcodegen_Ecc ecc_;
|
||||
|
Reference in New Issue
Block a user