diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82921ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# === .gitignore for Global/VisualStudioCode (https://raw.githubusercontent.com/github/gitignore/main/Global/VisualStudioCode.gitignore) === + +# Visual Studio Code +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets +!*.code-workspace + +# Built Visual Studio Code Extensions +*.vsix + + +# === .gitignore for community/embedded/esp-idf (https://raw.githubusercontent.com/github/gitignore/main/community/embedded/esp-idf.gitignore) === + +# gitignore template for esp-idf, the official development framework for ESP32 +# https://github.com/espressif/esp-idf + +build/ +sdkconfig +sdkconfig.old diff --git a/Components/Base_Module_V2.md b/Components/Base_Module_V2.md new file mode 100644 index 0000000..8bf90ce --- /dev/null +++ b/Components/Base_Module_V2.md @@ -0,0 +1,155 @@ +# Base module + +## Controller +Brand: Espressif +Type: ESP32-S3-WROOM-1 +Driver IC: ST7735S (ESPHome compatible) + +[Datasheet](../Datasheets/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf) + +### Pinout / IO + +``` +1 GND +2 3.3V +3 EN +4 IO4 Neopixel LED's +5 IO5 SPI MOSI +6 IO6 SPI SCK +7 IO7 +8 IO15 +9 IO16 +10 IO17 +11 IO18 +12 IO8 +13 IO19 +14 IO20 +15 IO3 Backlight main display +16 IO46 Backlight mini displays +17 IO9 +18 IO10 +19 IO11 +20 IO12 +21 IO13 +22 IO14 +23 IO21 +24 IO47 I2C SDA > Buttons +25 IO48 I2C SCL > Buttons +26 IO45 +27 IO0 +28 IO35 +29 IO36 +30 IO37 SPI Register select +31 IO38 +32 IO39 +33 IO40 +34 IO41 +35 IO42 +36 TXD0 +37 RXD0 +38 IO1 I2C SDA > Temperature Sensor +39 IO2 I2S SCL > Temperature Sensor +40 GND +``` + +## Connectors + +### Connector J0 + +``` +MCP I2C address: 0x20 + +PIN Description Destination +1 GND + 2 +3.3V +3 Reset ESP32 #3 EN + 4 I2C SDA ESP32 #24 IO47 +5 SPI MOSI ESP32 #28 IO35 + 6 I2C SCK ESP32 #25 IO48 +7 SPI SCK ESP32 #29 IO36 + 8 I2C Address MSP A0 GND +9 SPI Register select ESP32 #30 IO37 + 10 I2C Address MSP A1 GND +11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) + 12 I2C Address MSP A2 GND +13 Extensionplate... + 14 Connected with J1,2,3 +15 Main Display Backlight anode ESP32 #15 IO3 (via transistor) + 16 Neopixel Data OUT J1 #17 +17 Neopixel Data IN ESP32 #4 IO4 +``` + +### Connector J1 + +``` +MCP I2C address: 0x21 + +PIN Description Destination +1 GND + 2 +3.3V +3 Reset ESP32 #3 EN + 4 I2C SDA ESP32 #24 IO47 +5 SPI MOSI ESP32 #28 IO35 + 6 I2C SCK ESP32 #25 IO48 +7 SPI SCK ESP32 #29 IO36 + 8 I2C Address MSP A0 3.3V +9 SPI Register select ESP32 #30 IO37 + 10 I2C Address MSP A1 GND +11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) + 12 I2C Address MSP A2 GND +13 Extensionplate... + 14 Connected with J0,2,3 +15 Main Display Backlight anode ESP32 #15 IO3 (via transistor) + 16 Neopixel Data OUT J2 #17 +17 Neopixel Data IN J0 #16 +``` + +### Connector J2 + +``` +MCP I2C address: 0x22 + +PIN Description Destination +1 GND + 2 +3.3V +3 Reset ESP32 #3 EN + 4 I2C SDA ESP32 #24 IO47 +5 SPI MOSI ESP32 #28 IO35 + 6 I2C SCK ESP32 #25 IO48 +7 SPI SCK ESP32 #29 IO36 + 8 I2C Address MSP A0 GND +9 SPI Register select ESP32 #30 IO37 + 10 I2C Address MSP A1 3.3V +11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) + 12 I2C Address MSP A2 GND +13 Extensionplate... + 14 Connected with J0,1,3 +15 Main Display Backlight anode ESP32 #15 IO3 (via transistor) + 16 Neopixel Data OUT J3 #17 +17 Neopixel Data IN J1 #16 +``` + +### Connector J3 + +``` +MCP I2C address: 0x23 + +PIN Description Destination +1 GND + 2 +3.3V +3 Reset ESP32 #3 EN + 4 I2C SDA ESP32 #24 IO47 +5 SPI MOSI ESP32 #28 IO35 + 6 I2C SCK ESP32 #25 IO48 +7 SPI SCL ESP32 #29 IO36 + 8 I2C Address MSP A0 3.3V +9 SPI Register select ESP32 #30 IO37 + 10 I2C Address MSP A1 3.3V +11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) + 12 I2C Address MSP A2 GND +13 Extensionplate... + 14 Connected with J0,1,2 +15 Main Display Backlight anode ESP32 #15 IO3 (via transistor) + 16 Neopixel Data OUT Extensionplate #5 +17 Neopixel Data IN J2 #16 +``` diff --git a/ESPHome_ButtonPlusV2.code-workspace b/ESPHome_ButtonPlusV2.code-workspace new file mode 100644 index 0000000..876a149 --- /dev/null +++ b/ESPHome_ButtonPlusV2.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": {} +} \ No newline at end of file diff --git a/Examples/1BAR_1Display_Basic.yaml b/Examples/1BAR_1Display_Basic.yaml deleted file mode 100644 index 328f271..0000000 --- a/Examples/1BAR_1Display_Basic.yaml +++ /dev/null @@ -1,178 +0,0 @@ -packages: - remote_package_files: - url: https://github.com/dixi83/ESPHome_ButtonPlus - files: - - 'package/1bar_1display.yaml' - ref: main - refresh: 1d - -globals: - - id: !extend nr_of_pages - initial_value: '1' - -font: - - file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf" - id: font_arial20 - size: 20 - bpp: 4 - - file: "https://torinak.com/font/7segment.ttf" - id: font_clock - size: 64 - bpp: 4 - - file: "https://torinak.com/font/7segment.ttf" - id: font_date - size: 24 - bpp: 4 - -image: - - file: mdi:lightbulb - id: lightbulb - resize: 80x80 - - file: mdi:alert - id: alert - resize: 80x80 - - file: mdi:chevron-right - id: icon_next_page - resize: 30x30 - - file: mdi:chevron-left - id: icon_prev_page - resize: 30x30 - - file: mdi:home-thermometer-outline - id: icon_temp_inside - resize: 40x40 - -color: - - id: red - hex: FF0000 - - id: blue - hex: 0000FF - - id: yellow - hex: FFFF00 - - id: green - hex: 00FF00 - - id: orange - hex: FF7F00 - - id: white - hex: FFFFFF - - id: grey - hex: A6A6A6 - -event: - - platform: template - name: BAR1 button Left event - id: bar1_btn_left_event - event_types: - - "press page 0" - - "release page 0" - - "long press page 0" - - platform: template - name: BAR1 button Right event - id: bar1_btn_right_event - event_types: - - "press page 0" - - "release page 0" - - "long press page 0" - -binary_sensor: - - id: !extend main_display_btn_left - on_click: - - script.execute: prev_page - - id: !extend main_display_btn_right - on_click: - - script.execute: next_page - - id: !extend bar1_btn_left - on_click: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_left_event).trigger("press page 0"); - break; - } - on_release: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_left_event).trigger("release page 0"); - break; - } - on_multi_click: - - timing: - - ON for at least 2s - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_left_event).trigger("long press page 0"); - break; - } - - id: !extend bar1_btn_right - on_click: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_right_event).trigger("press page 0"); - break; - } - on_release: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_right_event).trigger("release page 0"); - break; - } - on_multi_click: - - timing: - - ON for at least 2s - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_right_event).trigger("long press page 0"); - break; - } - -display: - ######### - # MAIN ## - ######### - - id: !extend main_display - # data_rate: 40MHz - lambda: |- - id(all_pages_main).execute(); - switch (id(actual_page)){ - case 0: - it.print(100, 160, id(font_arial20), "This is page 0!"); - break; - } - -script: - - id: all_pages_main - then: - - lambda: |- - //>>> prev/next icons next to butotns - id(main_display).image(0, 208, id(icon_prev_page), ImageAlign::TOP_LEFT, id(red)); - id(main_display).image(320, 208, id(icon_next_page), ImageAlign::TOP_RIGHT, id(red)); - // - //>>> temperature inside: - id(main_display).image(36, 15, id(icon_temp_inside), ImageAlign::TOP_CENTER, id(red)); - id(main_display).printf(36, 80, id(font_arial20), id(white), TextAlign::TOP_CENTER , "%.1f°", id(inside_temperature).state); - // - //>>> print time and date - id(main_display).strftime(160, 5, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(datetime).now()); - id(main_display).strftime(160, 80, id(font_date), TextAlign::TOP_CENTER, "%d-%m-%Y", id(datetime).now()); - - id: !extend bar1_left_draw - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); - break; - } - - id: !extend bar1_right_draw - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); - break; - } diff --git a/Examples/2BAR_1Display_Basic.yaml b/Examples/2BAR_1Display_Basic.yaml deleted file mode 100644 index 3b1a8bf..0000000 --- a/Examples/2BAR_1Display_Basic.yaml +++ /dev/null @@ -1,259 +0,0 @@ -packages: - remote_package_files: - url: https://github.com/dixi83/ESPHome_ButtonPlus - files: - - 'package/2bar_1display.yaml' - ref: main - refresh: 1d - -globals: - - id: !extend nr_of_pages - initial_value: '1' - -font: - - file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf" - id: font_arial20 - size: 20 - bpp: 4 - - file: "https://torinak.com/font/7segment.ttf" - id: font_clock - size: 64 - bpp: 4 - - file: "https://torinak.com/font/7segment.ttf" - id: font_date - size: 24 - bpp: 4 - -image: - - file: mdi:lightbulb - id: lightbulb - resize: 80x80 - - file: mdi:alert - id: alert - resize: 80x80 - - file: mdi:chevron-right - id: icon_next_page - resize: 30x30 - - file: mdi:chevron-left - id: icon_prev_page - resize: 30x30 - - file: mdi:home-thermometer-outline - id: icon_temp_inside - resize: 40x40 - -color: - - id: red - hex: FF0000 - - id: blue - hex: 0000FF - - id: yellow - hex: FFFF00 - - id: green - hex: 00FF00 - - id: orange - hex: FF7F00 - - id: white - hex: FFFFFF - - id: grey - hex: A6A6A6 - -event: - - platform: template - name: BAR1 button Left event - id: bar1_btn_left_event - event_types: - - "press page 0" - - "release page 0" - - "long press page 0" - - platform: template - name: BAR1 button Right event - id: bar1_btn_right_event - event_types: - - "press page 0" - - "release page 0" - - "long press page 0" - - platform: template - name: BAR2 button Left event - id: bar2_btn_left_event - event_types: - - "press page 0" - - "release page 0" - - "long press page 0" - - platform: template - name: BAR2 button Right event - id: bar2_btn_right_event - event_types: - - "press page 0" - - "release page 0" - - "long press page 0" - -binary_sensor: - - id: !extend main_display_btn_left - on_click: - - script.execute: prev_page - - id: !extend main_display_btn_right - on_click: - - script.execute: next_page - - id: !extend bar1_btn_left - on_click: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_left_event).trigger("press page 0"); - break; - } - on_release: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_left_event).trigger("release page 0"); - break; - } - on_multi_click: - - timing: - - ON for at least 2s - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_left_event).trigger("long press page 0"); - break; - } - - id: !extend bar1_btn_right - on_click: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_right_event).trigger("press page 0"); - break; - } - on_release: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_right_event).trigger("release page 0"); - break; - } - on_multi_click: - - timing: - - ON for at least 2s - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar1_btn_right_event).trigger("long press page 0"); - break; - } - - id: !extend bar2_btn_left - on_click: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar2_btn_left_event).trigger("press page 0"); - break; - } - on_release: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar2_btn_left_event).trigger("release page 0"); - break; - } - on_multi_click: - - timing: - - ON for at least 2s - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar2_btn_left_event).trigger("long press page 0"); - break; - } - - id: !extend bar2_btn_right - on_click: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar2_btn_right_event).trigger("press page 0"); - break; - } - on_release: - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar2_btn_right_event).trigger("release page 0"); - break; - } - on_multi_click: - - timing: - - ON for at least 2s - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar2_btn_right_event).trigger("long press page 0"); - break; - } - - -display: - ######### - # MAIN ## - ######### - - id: !extend main_display - # data_rate: 40MHz - lambda: |- - id(all_pages_main).execute(); - switch (id(actual_page)){ - case 0: - it.print(100, 160, id(font_arial20), "This is page 0!"); - break; - } - -script: - - id: all_pages_main - then: - - lambda: |- - //>>> prev/next icons next to butotns - id(main_display).image(0, 208, id(icon_prev_page), ImageAlign::TOP_LEFT, id(red)); - id(main_display).image(320, 208, id(icon_next_page), ImageAlign::TOP_RIGHT, id(red)); - // - //>>> temperature inside: - id(main_display).image(36, 15, id(icon_temp_inside), ImageAlign::TOP_CENTER, id(red)); - id(main_display).printf(36, 80, id(font_arial20), id(white), TextAlign::TOP_CENTER , "%.1f°", id(inside_temperature).state); - // - //>>> print time and date - id(main_display).strftime(160, 5, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(datetime).now()); - id(main_display).strftime(160, 80, id(font_date), TextAlign::TOP_CENTER, "%d-%m-%Y", id(datetime).now()); - - id: !extend bar1_left_draw - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); - break; - } - - id: !extend bar1_right_draw - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); - break; - } - - id: !extend bar2_left_draw - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); - break; - } - - id: !extend bar2_right_draw - then: - - lambda: |- - switch (id(actual_page)){ - case 0: - id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); - break; - } diff --git a/Examples/3BAR_1Display_Basic.yaml b/Examples/3BAR_1Display_Basic.yaml index 52b8ff9..143633a 100644 --- a/Examples/3BAR_1Display_Basic.yaml +++ b/Examples/3BAR_1Display_Basic.yaml @@ -1,6 +1,6 @@ packages: remote_package_files: - url: https://github.com/dixi83/ESPHome_ButtonPlus + url: https://gitea.furb.it/kennyboy55/ESPHome_ButtonPlusV2 files: - 'package/3bar_1display.yaml' ref: main diff --git a/Examples/3pages_TotalExample.yml b/Examples/3pages_TotalExample.yml index b779ab2..30575ee 100644 --- a/Examples/3pages_TotalExample.yml +++ b/Examples/3pages_TotalExample.yml @@ -36,7 +36,7 @@ substitutions: packages: remote_package_files: - url: https://github.com/dixi83/ESPHome_ButtonPlus + url: https://gitea.furb.it/kennyboy55/ESPHome_ButtonPlusV2 files: - 'package/3bar_1display.yaml' - 'package/cards/music.yaml' diff --git a/Examples/basic_example.yaml b/Examples/basic_example.yaml index a3a2d4e..556a3d3 100644 --- a/Examples/basic_example.yaml +++ b/Examples/basic_example.yaml @@ -34,7 +34,7 @@ wifi: packages: remote_package_files: - url: https://github.com/dixi83/ESPHome_ButtonPlus + url: https://gitea.furb.it/kennyboy55/ESPHome_ButtonPlusV2 files: [package/1bar_1display.yaml] ref: main refresh: 1d diff --git a/LICENSE b/LICENSE index 2b3c42d..aca2b94 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License Copyright (c) 2024 Martijn +Copyright (c) 2026 Kenneth van Ewijk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml deleted file mode 100644 index e0f8800..0000000 --- a/package/1bar_1display.yaml +++ /dev/null @@ -1,167 +0,0 @@ -############################################ -## ## -## filename: 1bar_1display.yaml ## -## description: Specific configuration ## -## for the 1 BAR 1 Display setup ## -## ## -############################################ - -packages: - base: !include base.yaml - scripts: !include 1bar_1display_scripts.yaml - -esphome: - on_boot: - priority: -100 - then: - - script.execute: setup_bar_displays - - script.execute: update_bar1_left - - script.execute: update_bar1_right - -mcp23008: - - id: 'base_J2' - i2c_id: buttons - address: 0x22 - - id: 'base_J3' - i2c_id: buttons - address: 0x23 - -binary_sensor: - ############################ - ### Buttons Main Display ### - ############################ - - platform: gpio - id: 'main_display_btn_left' - name: "Main Display button Left" - pin: - mcp23xxx: base_J2 - number: 6 - mode: INPUT_PULLUP - inverted: true - - platform: gpio - id: 'main_display_btn_right' - name: "Main Display button Right" - pin: - mcp23xxx: base_J2 - number: 2 - mode: INPUT_PULLUP - inverted: true - - ############################ - ### Buttons BAR module 1 ### - ############################ - - platform: gpio - id: 'bar1_btn_left' - name: "BAR 1 button Left" - pin: - mcp23xxx: base_J3 - number: 6 - mode: INPUT_PULLUP - inverted: true - - platform: gpio - id: 'bar1_btn_right' - name: "BAR 1 button Right" - pin: - mcp23xxx: base_J3 - number: 2 - mode: INPUT_PULLUP - inverted: true - -light: - - id: !extend neopixels - num_leds: 5 - ############################ - ### RGB LED's BAR module ### - ############################ - - platform: partition - name: "BAR 1 Left RGB Front" - id: bar1_left_rgb_front - segments: - - id: neopixels - from: 0 - to: 0 - - platform: partition - name: "BAR 1 Left RGB Back" - id: bar1_left_rgb_back - segments: - - id: neopixels - from: 1 - to: 1 - - platform: partition - name: "BAR 1 Right RGB Front" - id: bar1_right_rgb_front - segments: - - id: neopixels - from: 2 - to: 2 - - platform: partition - name: "BAR 1 Right RGB Back" - id: bar1_right_rgb_back - segments: - - id: neopixels - from: 3 - to: 3 - -output: - ####################################### - ### CS pins to control BAR Displays ### - ####################################### - - id: cs_pin_bar1_left - platform: gpio - pin: - mcp23xxx: base_J3 - number: 5 - mode: - output: true - inverted: true - - id: cs_pin_bar1_right - platform: gpio - pin: - mcp23xxx: base_J3 - number: 1 - mode: - output: true - inverted: true - -display: - #################### - ### Main Display ### - #################### - - id: main_display - platform: ili9xxx - model: ili9341 - invert_colors: false - color_order: rgb - update_interval: 30s - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J2 - number: 5 - mode: - output: true - inverted: false - show_test_card: false - dimensions: - height: 240 - width: 320 - rotation: 180 - ################## - ### BAR module ### - ################## - - id: bar_display - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - invert_colors: false - show_test_card: false - auto_clear_enabled: false - dimensions: - height: 160 - width: 80 - offset_width: 24 diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml deleted file mode 100644 index 221f208..0000000 --- a/package/1bar_1display_scripts.yaml +++ /dev/null @@ -1,68 +0,0 @@ -############################################## -## ## -## filename: 1bar_1display_scripts.yaml ## -## description: Specific pre-defined ## -## scripts for 1 BAR 1 Display setup ## -## ## -############################################## - -script: -###################### -### update scripts ### -###################### - - id: update_bar1_left - then: - - lambda: |- - id(cs_pin_bar1_left).turn_on(); // << - id(cs_pin_bar1_right).turn_off(); - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - id(bar1_left_draw).execute(); - id(bar_display).update(); - delay(2); - id(cs_pin_bar1_left).turn_off(); - - id: update_bar1_right - then: - - lambda: |- - id(cs_pin_bar1_left).turn_off(); - id(cs_pin_bar1_right).turn_on(); // << - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar1_right_draw).execute(); - id(bar_display).update(); - delay(2); - id(cs_pin_bar1_right).turn_off(); -################################## -### setup mini display scripts ### -################################## - - id: setup_bar_displays - then: - - lambda: |- - id(cs_pin_bar1_left).turn_on(); - id(bar_display).setup(); - id(cs_pin_bar1_left).turn_off(); - delay(5); - id(cs_pin_bar1_right).turn_on(); - id(bar_display).setup(); - id(cs_pin_bar1_right).turn_off(); -#################### -### draw scripts ### -#################### - - id: bar1_left_draw - then: - - id: bar1_right_draw - then: -############################## -### other handling scripts ### -############################## - - id: update_main - then: - - component.update: main_display - - id: update_all - then: - - component.update: main_display - - delay: 0.1s - - script.execute: update_bar1_left - - delay: 0.1s - - script.execute: update_bar1_right - - delay: 0.1s diff --git a/package/2bar_1display.yaml b/package/2bar_1display.yaml deleted file mode 100644 index faffb1b..0000000 --- a/package/2bar_1display.yaml +++ /dev/null @@ -1,239 +0,0 @@ -############################################ -## ## -## filename: 2bar_1display.yaml ## -## description: Specific configuration ## -## for the 2 BAR's, 1 Display setup ## -## ## -############################################ - -packages: - base: !include base.yaml - scripts: !include 2bar_1display_scripts.yaml - -esphome: - on_boot: - priority: -100 - then: - - script.execute: setup_bar_displays - - script.execute: update_bar1_left - - script.execute: update_bar1_right - - script.execute: update_bar2_left - - script.execute: update_bar2_right - -mcp23008: - - id: 'base_J1' - i2c_id: buttons - address: 0x21 - - id: 'base_J2' - i2c_id: buttons - address: 0x22 - - id: 'base_J3' - i2c_id: buttons - address: 0x23 - -binary_sensor: - ############################ - ### Buttons Main Display ### - ############################ - - platform: gpio - id: 'main_display_btn_left' - name: "Main Display button Left" - pin: - mcp23xxx: base_J1 - number: 6 - mode: INPUT_PULLUP - inverted: true - - platform: gpio - id: 'main_display_btn_right' - name: "Main Display button Right" - pin: - mcp23xxx: base_J1 - number: 2 - mode: INPUT_PULLUP - inverted: true - - ############################ - ### Buttons BAR module 1 ### - ############################ - - platform: gpio - id: 'bar1_btn_left' - name: "BAR 1 button Left" - pin: - mcp23xxx: base_J2 - number: 6 - mode: INPUT_PULLUP - inverted: true - - platform: gpio - id: 'bar1_btn_right' - name: "BAR 1 button Right" - pin: - mcp23xxx: base_J2 - number: 2 - mode: INPUT_PULLUP - inverted: true - - ############################ - ### Buttons BAR module 2 ### - ############################ - - platform: gpio - id: 'bar2_btn_left' - name: "BAR 2 button Left" - pin: - mcp23xxx: base_J3 - number: 6 - mode: INPUT_PULLUP - inverted: true - - platform: gpio - id: 'bar2_btn_right' - name: "BAR 2 button Right" - pin: - mcp23xxx: base_J3 - number: 2 - mode: INPUT_PULLUP - inverted: true - -light: - - id: !extend neopixels - num_leds: 9 - ############################## - ### RGB LED's BAR module 1 ### - ############################## - - platform: partition - name: "BAR 1 Left RGB Front" - id: bar1_left_rgb_front - segments: - - id: neopixels - from: 0 - to: 0 - - platform: partition - name: "BAR 1 Left RGB Back" - id: bar1_left_rgb_back - segments: - - id: neopixels - from: 1 - to: 1 - - platform: partition - name: "BAR 1 Right RGB Front" - id: bar1_right_rgb_front - segments: - - id: neopixels - from: 2 - to: 2 - - platform: partition - name: "BAR 1 Right RGB Back" - id: bar1_right_rgb_back - segments: - - id: neopixels - from: 3 - to: 3 - ############################## - ### RGB LED's BAR module 2 ### - ############################## - - platform: partition - name: "BAR 2 Left RGB Front" - id: bar2_left_rgb_front - segments: - - id: neopixels - from: 4 - to: 4 - - platform: partition - name: "BAR 2 Left RGB Back" - id: bar2_left_rgb_back - segments: - - id: neopixels - from: 5 - to: 5 - - platform: partition - name: "BAR 2 Right RGB Front" - id: bar2_right_rgb_front - segments: - - id: neopixels - from: 6 - to: 6 - - platform: partition - name: "BAR 2 Right RGB Back" - id: bar2_right_rgb_back - segments: - - id: neopixels - from: 7 - to: 7 - -output: - ####################################### - ### CS pins to control BAR Displays ### - ####################################### - - id: cs_pin_bar1_left - platform: gpio - pin: - mcp23xxx: base_J2 - number: 5 - mode: - output: true - inverted: true - - id: cs_pin_bar1_right - platform: gpio - pin: - mcp23xxx: base_J2 - number: 1 - mode: - output: true - inverted: true - - id: cs_pin_bar2_left - platform: gpio - pin: - mcp23xxx: base_J3 - number: 5 - mode: - output: true - inverted: true - - id: cs_pin_bar2_right - platform: gpio - pin: - mcp23xxx: base_J3 - number: 1 - mode: - output: true - inverted: true - -display: - #################### - ### Main Display ### - #################### - - id: main_display - platform: ili9xxx - model: ili9341 - invert_colors: false - color_order: rgb - update_interval: 30s - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J1 - number: 5 - mode: - output: true - inverted: false - show_test_card: false - dimensions: - height: 240 - width: 320 - rotation: 180 - ################### - ### BAR modules ### - ################### - - id: bar_display - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - invert_colors: false - show_test_card: false - auto_clear_enabled: false - dimensions: - height: 160 - width: 80 - offset_width: 24 diff --git a/package/2bar_1display_scripts.yaml b/package/2bar_1display_scripts.yaml deleted file mode 100644 index 98b8145..0000000 --- a/package/2bar_1display_scripts.yaml +++ /dev/null @@ -1,114 +0,0 @@ -############################################## -## ## -## filename: 1bar_1display_scripts.yaml ## -## description: Specific pre-defined ## -## scripts for 2 BAR 1 Display setup ## -## ## -############################################## - -script: -###################### -### update scripts ### -###################### - - id: update_bar1_left - then: - - lambda: |- - id(cs_pin_bar1_left).turn_on(); // << - id(cs_pin_bar1_right).turn_off(); - id(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_off(); - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - id(bar1_left_draw).execute(); - id(bar_display).update(); - delay(1); - id(cs_pin_bar1_left).turn_off(); - - id: update_bar1_right - then: - - lambda: |- - id(cs_pin_bar1_left).turn_off(); - id(cs_pin_bar1_right).turn_on(); // << - id(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_off(); - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar1_right_draw).execute(); - id(bar_display).update(); - delay(1); - id(cs_pin_bar1_right).turn_off(); - - id: update_bar2_left - then: - - lambda: |- - id(cs_pin_bar1_left).turn_off(); - id(cs_pin_bar1_right).turn_off(); - id(cs_pin_bar2_left).turn_on(); // << - id(cs_pin_bar2_right).turn_off(); - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - id(bar2_left_draw).execute(); - id(bar_display).update(); - delay(1); - id(cs_pin_bar2_left).turn_off(); - - id: update_bar2_right - then: - - lambda: |- - id(cs_pin_bar1_left).turn_off(); - id(cs_pin_bar1_right).turn_off(); - id(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_on(); // << - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar2_right_draw).execute(); - id(bar_display).update(); - delay(1); - id(cs_pin_bar2_right).turn_off(); -################################## -### setup mini display scripts ### -################################## - - id: setup_bar_displays - then: - - lambda: |- - id(cs_pin_bar1_left).turn_on(); - id(bar_display).setup(); - id(cs_pin_bar1_left).turn_off(); - delay(5); - id(cs_pin_bar1_right).turn_on(); - id(bar_display).setup(); - id(cs_pin_bar1_right).turn_off(); - delay(5); - id(cs_pin_bar2_left).turn_on(); - id(bar_display).setup(); - id(cs_pin_bar2_left).turn_off(); - delay(5); - id(cs_pin_bar2_right).turn_on(); - id(bar_display).setup(); - id(cs_pin_bar2_right).turn_off(); -#################### -### draw scripts ### -#################### - - id: bar1_left_draw - then: - - id: bar1_right_draw - then: - - id: bar2_left_draw - then: - - id: bar2_right_draw - then: -############################## -### other handling scripts ### -############################## - - id: update_main - then: - - component.update: main_display - - id: update_all - then: - - component.update: main_display - - delay: 0.1s - - script.execute: update_bar1_left - - delay: 0.1s - - script.execute: update_bar1_right - - delay: 0.1s - - script.execute: update_bar2_left - - delay: 0.1s - - script.execute: update_bar2_right - - delay: 0.1s diff --git a/package/base.yaml b/package/base.yaml index 94d30ab..6c1c935 100644 --- a/package/base.yaml +++ b/package/base.yaml @@ -13,7 +13,7 @@ esp32: interval: - interval: 1min then: - - logger.log: "ESPHome for Button+ v0.1.1" + - logger.log: "ESPHome for Button+ V2 v0.1.0" i2c: - id: temperature_sensor @@ -25,8 +25,11 @@ i2c: frequency: 400khz spi: - clk_pin: GPIO36 - mosi_pin: GPIO35 + clk_pin: GPIO6 + mosi_pin: GPIO5 + +psram: + mode: octal globals: - id: nr_of_pages diff --git a/package/cards/music.md b/package/cards/music.md index a3a6989..f92ada7 100644 --- a/package/cards/music.md +++ b/package/cards/music.md @@ -8,7 +8,7 @@ music_card_enity_id: 'media_player.media_keuken_2' package: remote_package_files: - url: https://github.com/dixi83/ESPHome_ButtonPlus + url: https://gitea.furb.it/kennyboy55/ESPHome_ButtonPlusV2 files: [,'package/cards/music.yaml'] ``` * Add the music card to the main display `lambda` and give it the position you want diff --git a/package/cards/music.yaml b/package/cards/music.yaml index ba38efc..9cd8915 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -9,7 +9,7 @@ ## music_card_enity_id: 'media_player.media_keuken_2' ## package: ## remote_package_files: -## url: https://github.com/dixi83/ESPHome_ButtonPlus +## url: https://gitea.furb.it/kennyboy55/ESPHome_ButtonPlusV2 ## files: [,'package/cards/music.yaml'] ## ## display: