mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-29 22:24:26 +00:00 
			
		
		
		
	allow touchscreen buttons outside of display dimensions (#8296)
Co-authored-by: Dennis Marinus <dmarinus@apple.com> Co-authored-by: clydebarrow <2366188+clydebarrow@users.noreply.github.com>
This commit is contained in:
		| @@ -47,3 +47,19 @@ def test_binary_sensor_config_value_internal_set(generate_main): | ||||
|     # Then | ||||
|     assert "bs_1->set_internal(true);" in main_cpp | ||||
|     assert "bs_2->set_internal(false);" in main_cpp | ||||
|  | ||||
|  | ||||
| def test_binary_sensor_config_value_use_raw_set(generate_main): | ||||
|     """ | ||||
|     Test that the "use_raw" config value is correctly set | ||||
|     """ | ||||
|     # Given | ||||
|  | ||||
|     # When | ||||
|     main_cpp = generate_main( | ||||
|         "tests/component_tests/binary_sensor/test_binary_sensor.yaml" | ||||
|     ) | ||||
|  | ||||
|     # Then | ||||
|     assert "bs_3->set_use_raw(true);" in main_cpp | ||||
|     assert "bs_4->set_use_raw(false);" in main_cpp | ||||
|   | ||||
| @@ -2,8 +2,30 @@ | ||||
| esphome: | ||||
|   name: test | ||||
|  | ||||
| esp8266: | ||||
|   board: d1_mini_lite | ||||
| esp32: | ||||
|   board: m5stack-core2 | ||||
|  | ||||
| i2c: | ||||
|   sda: GPIO21 | ||||
|   scl: GPIO22 | ||||
|  | ||||
| spi: | ||||
|   clk_pin: GPIO18 | ||||
|   mosi_pin: GPIO23 | ||||
|   miso_pin: GPIO19 | ||||
|  | ||||
| display: | ||||
|   platform: ili9xxx | ||||
|   id: lcd | ||||
|   model: M5STACK | ||||
|   dc_pin: GPIO15 | ||||
|   cs_pin: GPIO5 | ||||
|   invert_colors: true | ||||
|  | ||||
| touchscreen: | ||||
|   platform: ft63x6 | ||||
|   id: touch | ||||
|   interrupt_pin: GPIO39 | ||||
|  | ||||
| binary_sensor: | ||||
|   - platform: gpio | ||||
| @@ -11,10 +33,25 @@ binary_sensor: | ||||
|     name: test bs1 | ||||
|     internal: true | ||||
|     pin: | ||||
|       number: D0 | ||||
|       number: GPIO32 | ||||
|   - platform: gpio | ||||
|     id: bs_2 | ||||
|     name: test bs2 | ||||
|     internal: false | ||||
|     pin: | ||||
|       number: D1 | ||||
|       number: GPIO33 | ||||
|   - platform: touchscreen | ||||
|     id: bs_3 | ||||
|     name: test bs3 | ||||
|     x_min: 100 | ||||
|     x_max: 200 | ||||
|     y_min: 300 | ||||
|     y_max: 400 | ||||
|     use_raw: true | ||||
|   - platform: touchscreen | ||||
|     id: bs_4 | ||||
|     name: test bs4 | ||||
|     x_min: 100 | ||||
|     x_max: 200 | ||||
|     y_min: 300 | ||||
|     y_max: 400 | ||||
|   | ||||
| @@ -34,3 +34,19 @@ touchscreen: | ||||
|     on_release: | ||||
|       - logger.log: | ||||
|           format: to released | ||||
|     calibration: | ||||
|       x_min: 0 | ||||
|       x_max: 320 | ||||
|       y_min: 0 | ||||
|       y_max: 400 | ||||
|  | ||||
| binary_sensor: | ||||
|   - platform: touchscreen | ||||
|     name: Bottom Left Touch | ||||
|     use_raw: true | ||||
|     x_min: 0 | ||||
|     x_max: 100 | ||||
|     y_min: 400 | ||||
|     y_max: 480 | ||||
|     on_press: | ||||
|       logger.log: Left pressed | ||||
|   | ||||
		Reference in New Issue
	
	Block a user