mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Add get_size method to QR Code header (#6430)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							0ff543ffe5
						
					
				
				
					commit
					9194f7eb27
				
			| @@ -11,6 +11,13 @@ display: | ||||
|     cs_pin: 8 | ||||
|     dc_pin: 9 | ||||
|     reset_pin: 10 | ||||
|     lambda: |- | ||||
|       // Draw a QR code in the center of the screen | ||||
|       auto scale = 2; | ||||
|       auto size = id(homepage_qr).get_size() * scale; | ||||
|       auto x = (it.get_width() / 2) - (size / 2); | ||||
|       auto y = (it.get_height() / 2) - (size / 2); | ||||
|       it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale); | ||||
|  | ||||
| qr_code: | ||||
|   - id: homepage_qr | ||||
|   | ||||
| @@ -11,6 +11,13 @@ display: | ||||
|     cs_pin: 8 | ||||
|     dc_pin: 9 | ||||
|     reset_pin: 10 | ||||
|     lambda: |- | ||||
|       // Draw a QR code in the center of the screen | ||||
|       auto scale = 2; | ||||
|       auto size = id(homepage_qr).get_size() * scale; | ||||
|       auto x = (it.get_width() / 2) - (size / 2); | ||||
|       auto y = (it.get_height() / 2) - (size / 2); | ||||
|       it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale); | ||||
|  | ||||
| qr_code: | ||||
|   - id: homepage_qr | ||||
|   | ||||
| @@ -11,6 +11,13 @@ display: | ||||
|     cs_pin: 12 | ||||
|     dc_pin: 13 | ||||
|     reset_pin: 21 | ||||
|     lambda: |- | ||||
|       // Draw a QR code in the center of the screen | ||||
|       auto scale = 2; | ||||
|       auto size = id(homepage_qr).get_size() * scale; | ||||
|       auto x = (it.get_width() / 2) - (size / 2); | ||||
|       auto y = (it.get_height() / 2) - (size / 2); | ||||
|       it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale); | ||||
|  | ||||
| qr_code: | ||||
|   - id: homepage_qr | ||||
|   | ||||
| @@ -11,6 +11,13 @@ display: | ||||
|     cs_pin: 12 | ||||
|     dc_pin: 13 | ||||
|     reset_pin: 21 | ||||
|     lambda: |- | ||||
|       // Draw a QR code in the center of the screen | ||||
|       auto scale = 2; | ||||
|       auto size = id(homepage_qr).get_size() * scale; | ||||
|       auto x = (it.get_width() / 2) - (size / 2); | ||||
|       auto y = (it.get_height() / 2) - (size / 2); | ||||
|       it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale); | ||||
|  | ||||
| qr_code: | ||||
|   - id: homepage_qr | ||||
|   | ||||
| @@ -11,6 +11,13 @@ display: | ||||
|     cs_pin: 5 | ||||
|     dc_pin: 15 | ||||
|     reset_pin: 16 | ||||
|     lambda: |- | ||||
|       // Draw a QR code in the center of the screen | ||||
|       auto scale = 2; | ||||
|       auto size = id(homepage_qr).get_size() * scale; | ||||
|       auto x = (it.get_width() / 2) - (size / 2); | ||||
|       auto y = (it.get_height() / 2) - (size / 2); | ||||
|       it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale); | ||||
|  | ||||
| qr_code: | ||||
|   - id: homepage_qr | ||||
|   | ||||
| @@ -11,6 +11,13 @@ display: | ||||
|     cs_pin: 20 | ||||
|     dc_pin: 21 | ||||
|     reset_pin: 22 | ||||
|     lambda: |- | ||||
|       // Draw a QR code in the center of the screen | ||||
|       auto scale = 2; | ||||
|       auto size = id(homepage_qr).get_size() * scale; | ||||
|       auto x = (it.get_width() / 2) - (size / 2); | ||||
|       auto y = (it.get_height() / 2) - (size / 2); | ||||
|       it.qr_code(x, y, id(homepage_qr), Color(255,255,255), scale); | ||||
|  | ||||
| qr_code: | ||||
|   - id: homepage_qr | ||||
|   | ||||
		Reference in New Issue
	
	Block a user