mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 12:37:45 +01:00
Validating input for num_segments_x and num_segments_y, addding cinttypes for those black magic macros for uint32_t printf
This commit is contained in:
parent
b735c1cd92
commit
7c849a194f
30
dependencies.lock
Normal file
30
dependencies.lock
Normal file
@ -0,0 +1,30 @@
|
||||
dependencies:
|
||||
esp-tflite-micro:
|
||||
component_hash: 09acb9889f98d0e7b5d9d1aa7184d455cfd30268d627b43371b7593106d0fc4b
|
||||
source:
|
||||
git: https://github.com/espressif/esp-tflite-micro.git
|
||||
path: .
|
||||
type: git
|
||||
version: c5d97c9577de0eb9b8f05078da84bbb9ff0f748f
|
||||
esp32_camera:
|
||||
component_hash: 659f1353ee3dd6db885667c61e45fad5574c6c4d832fbe6797ea224d6f61d1e3
|
||||
source:
|
||||
git: https://github.com/espressif/esp32-camera.git
|
||||
path: .
|
||||
type: git
|
||||
version: 30aeeeed61e2b0182d673fe2cfedb1b7aa43b1b9
|
||||
espressif/esp-nn:
|
||||
component_hash: b32869798bdb40dec6bc99caca48cd65d42f8a9f506b9ab9c598a076f891ede9
|
||||
source:
|
||||
pre_release: true
|
||||
service_url: https://api.components.espressif.com/
|
||||
type: service
|
||||
version: 1.0.2
|
||||
idf:
|
||||
component_hash: null
|
||||
source:
|
||||
type: idf
|
||||
version: 4.4.7
|
||||
manifest_hash: c329277baa8ef760348eeece89727f1fecb1127f44ebc3173274cdf9723ed264
|
||||
target: esp32
|
||||
version: 1.0.0
|
@ -144,7 +144,9 @@ MODELS = {
|
||||
}
|
||||
|
||||
RESET_PIN_REQUIRED_MODELS = ("2.13inv2", "2.13in-ttgo-b74")
|
||||
SEGMENT_UPDATEABLE_MODELS = "7.5in-bgr-gd"
|
||||
SEGMENT_UPDATEABLE_MODELS = {
|
||||
"7.5in-bgr-gd": (800, 480),
|
||||
}
|
||||
|
||||
|
||||
def validate_full_update_every_only_types_ac(value):
|
||||
@ -169,6 +171,21 @@ def validate_num_segments_supported(config):
|
||||
raise cv.Invalid(
|
||||
f"'num_segments_x' and num_segment_y' are not supported by {config[CONF_MODEL]}"
|
||||
)
|
||||
if CONF_NUM_SEGMENTS_X in config and (
|
||||
SEGMENT_UPDATEABLE_MODELS[config[CONF_MODEL]][0]
|
||||
% (config[CONF_NUM_SEGMENTS_X] * 8)
|
||||
> 0
|
||||
):
|
||||
raise cv.Invalid(
|
||||
f"The horizontal resolution of the display ({SEGMENT_UPDATEABLE_MODELS[config[CONF_MODEL]][0]}px) must be divisible by 'num_segments_x * 8'"
|
||||
)
|
||||
if CONF_NUM_SEGMENTS_Y in config and (
|
||||
SEGMENT_UPDATEABLE_MODELS[config[CONF_MODEL]][1] % config[CONF_NUM_SEGMENTS_Y]
|
||||
> 0
|
||||
):
|
||||
raise cv.Invalid(
|
||||
f"The vertical resolution of the display ({SEGMENT_UPDATEABLE_MODELS[config[CONF_MODEL]][1]}px) must be divisible by 'num_segments_y'"
|
||||
)
|
||||
return config
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/components/spi/spi.h"
|
||||
#include "esphome/components/display/display_buffer.h"
|
||||
#include <cinttypes>
|
||||
|
||||
namespace esphome {
|
||||
namespace waveshare_epaper {
|
||||
|
Loading…
Reference in New Issue
Block a user