Skip to content

Commit

Permalink
Move announcement to click event and increase timer
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardtfn committed Oct 29, 2024
1 parent d0ac482 commit 7119998
Show file tree
Hide file tree
Showing 22 changed files with 206 additions and 161 deletions.
16 changes: 13 additions & 3 deletions esphome/nspanel_esphome_core_hw_display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,8 @@ script:
parameters:
cmd: string
then:
- script.execute: nextion_queue_add
- delay: !lambda return (10*(id(nextion_queue)+disp1->queue_size()+tf_uart->available()));
- lambda: |-
nextion_queue_add->execute();
disp1->send_command(cmd.c_str());
nextion_queue_del->execute();
Expand Down Expand Up @@ -818,7 +817,18 @@ sensor:
icon: mdi:brightness-percent
internal: false
disabled_by_default: false
update_interval: 15s
update_interval: 60s

- id: current_page_id
name: Current Page Id
platform: nextion
variable_name: dp
precision: 0
accuracy_decimals: 0
icon: mdi:tablet-dashboard
internal: false
disabled_by_default: false
update_interval: 60s

switch:
- name: Nextion display - Power # DISPLAY ALWAYS ON
Expand Down
48 changes: 27 additions & 21 deletions hmi/dev/nspanel_CJK_eu_code/boot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Page boot
dim=100
ver_tft.txt="TFT: "+version.txt
click sys_baudrate,1
click initializing,0

Variable (string) version
Attributes
Expand Down Expand Up @@ -110,9 +111,32 @@ Text initializing
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : Initializing...
Text : Initializing..
Max. Text Size : 15

Events
Touch Release Event
printh 92
prints "current_page",0
printh 00
prints "boot",0
printh 00
printh FF FF FF
json.txt="{\"page\":\"boot\",\"event\":\"params\""
covx display_mode,num_to_str.txt,0,0
json.txt+=",\"display_mode\":"+num_to_str.txt
covx charset,num_to_str.txt,0,0
json.txt+=",\"charset\":"+num_to_str.txt
json.txt+=",\"version\":\""+version.txt+"\""
json.txt+="}"
printh 92
prints "localevent",0
printh 00
prints json.txt,0
printh 00
printh FF FF FF
initializing.txt+="."

Text ver_box
Attributes
ID : 4
Expand Down Expand Up @@ -313,17 +337,11 @@ Timer tm_esphome
Attributes
ID : 27
Scope : local
Period (ms): 1000
Period (ms): 10000
Enabled : yes

Events
Timer Event
printh 92
prints "current_page",0
printh 00
prints "boot",0
printh 00
printh FF FF FF
counter.val++
if(counter.val>360)
{
Expand All @@ -335,18 +353,6 @@ Timer tm_esphome
bauds=921600
}
click sys_baudrate,1
click initializing,0
doevents
json.txt="{\"event\":\"params\""
covx display_mode,num_to_str.txt,0,0
json.txt+=",\"display_mode\":"+num_to_str.txt
covx charset,num_to_str.txt,0,0
json.txt+=",\"charset\":"+num_to_str.txt
json.txt+=",\"version\":\""+version.txt+"\""
json.txt+="}"
printh 92
prints "localevent",0
printh 00
prints json.txt,0
printh 00
printh FF FF FF

48 changes: 27 additions & 21 deletions hmi/dev/nspanel_CJK_us_code/boot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Page boot
dim=100
ver_tft.txt="TFT: "+version.txt
click sys_baudrate,1
click initializing,0

Variable (string) version
Attributes
Expand Down Expand Up @@ -110,9 +111,32 @@ Text initializing
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : Initializing...
Text : Initializing..
Max. Text Size : 15

Events
Touch Release Event
printh 92
prints "current_page",0
printh 00
prints "boot",0
printh 00
printh FF FF FF
json.txt="{\"page\":\"boot\",\"event\":\"params\""
covx display_mode,num_to_str.txt,0,0
json.txt+=",\"display_mode\":"+num_to_str.txt
covx charset,num_to_str.txt,0,0
json.txt+=",\"charset\":"+num_to_str.txt
json.txt+=",\"version\":\""+version.txt+"\""
json.txt+="}"
printh 92
prints "localevent",0
printh 00
prints json.txt,0
printh 00
printh FF FF FF
initializing.txt+="."

Text ver_box
Attributes
ID : 4
Expand Down Expand Up @@ -313,17 +337,11 @@ Timer tm_esphome
Attributes
ID : 27
Scope : local
Period (ms): 1000
Period (ms): 10000
Enabled : yes

Events
Timer Event
printh 92
prints "current_page",0
printh 00
prints "boot",0
printh 00
printh FF FF FF
counter.val++
if(counter.val>360)
{
Expand All @@ -335,18 +353,6 @@ Timer tm_esphome
bauds=921600
}
click sys_baudrate,1
click initializing,0
doevents
json.txt="{\"event\":\"params\""
covx display_mode,num_to_str.txt,0,0
json.txt+=",\"display_mode\":"+num_to_str.txt
covx charset,num_to_str.txt,0,0
json.txt+=",\"charset\":"+num_to_str.txt
json.txt+=",\"version\":\""+version.txt+"\""
json.txt+="}"
printh 92
prints "localevent",0
printh 00
prints json.txt,0
printh 00
printh FF FF FF

48 changes: 27 additions & 21 deletions hmi/dev/nspanel_CJK_us_land_code/boot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Page boot
dim=100
ver_tft.txt="TFT: "+version.txt
click sys_baudrate,1
click initializing,0

Variable (string) version
Attributes
Expand Down Expand Up @@ -110,9 +111,32 @@ Text initializing
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : Initializing...
Text : Initializing..
Max. Text Size : 15

Events
Touch Release Event
printh 92
prints "current_page",0
printh 00
prints "boot",0
printh 00
printh FF FF FF
json.txt="{\"page\":\"boot\",\"event\":\"params\""
covx display_mode,num_to_str.txt,0,0
json.txt+=",\"display_mode\":"+num_to_str.txt
covx charset,num_to_str.txt,0,0
json.txt+=",\"charset\":"+num_to_str.txt
json.txt+=",\"version\":\""+version.txt+"\""
json.txt+="}"
printh 92
prints "localevent",0
printh 00
prints json.txt,0
printh 00
printh FF FF FF
initializing.txt+="."

Text ver_box
Attributes
ID : 4
Expand Down Expand Up @@ -313,17 +337,11 @@ Timer tm_esphome
Attributes
ID : 27
Scope : local
Period (ms): 1000
Period (ms): 10000
Enabled : yes

Events
Timer Event
printh 92
prints "current_page",0
printh 00
prints "boot",0
printh 00
printh FF FF FF
counter.val++
if(counter.val>360)
{
Expand All @@ -335,18 +353,6 @@ Timer tm_esphome
bauds=921600
}
click sys_baudrate,1
click initializing,0
doevents
json.txt="{\"event\":\"params\""
covx display_mode,num_to_str.txt,0,0
json.txt+=",\"display_mode\":"+num_to_str.txt
covx charset,num_to_str.txt,0,0
json.txt+=",\"charset\":"+num_to_str.txt
json.txt+=",\"version\":\""+version.txt+"\""
json.txt+="}"
printh 92
prints "localevent",0
printh 00
prints json.txt,0
printh 00
printh FF FF FF

63 changes: 31 additions & 32 deletions hmi/dev/nspanel_blank_code/blank.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Page blank
Events
Preinitialize Event
dim=100
click sys_baudrate,0
tft_version.txt="TFT: v"+version.txt
click qr0,0

Touch Press Event
dim=100
Expand Down Expand Up @@ -54,8 +54,8 @@ Variable (string) num_to_str
Variable (string) version
Attributes
ID : 13
Scope : local
Text : 2024.10.1
Scope : global
Text : 2024.10.2
Max. Text Size: 15

Variable (string) tmp_baudrate
Expand Down Expand Up @@ -100,10 +100,8 @@ Text sys_baudrate
tm0.en=1

Touch Release Event
covx baud,tmp_baudrate.txt,0,0
sys_baudrate.txt="Baud rate: "
sys_baudrate.txt+=tmp_baudrate.txt
sys_baudrate.txt+=" bps"
dim=100
tm0.en=1

Text tft_version
Attributes
Expand Down Expand Up @@ -167,7 +165,7 @@ QR Code qr0
ID : 1
Scope : local
Dragging : 0
Send Component ID: on press and release
Send Component ID: on press
Text : https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/nspanel_blank.md#what-to-do-after-installing-nspanel_blanktft
Max. Text Size : 150

Expand All @@ -177,8 +175,29 @@ QR Code qr0
tm0.en=1

Touch Release Event
dim=100
tm0.en=1
printh 92
prints "current_page",0
printh 00
prints "blank",0
printh 00
printh FF FF FF
json.txt="{\"page\":\"blank\",\"event\":\"params\""
covx display_mode,num_to_str.txt,0,0
json.txt+=",\"display_mode\":"+num_to_str.txt
covx charset,num_to_str.txt,0,0
json.txt+=",\"charset\":"+num_to_str.txt
json.txt+=",\"version\":\""+version.txt+"\""
json.txt+="}"
printh 92
prints "localevent",0
printh 00
prints json.txt,0
printh 00
printh FF FF FF
covx baud,tmp_baudrate.txt,0,0
sys_baudrate.txt="Baud rate: "
sys_baudrate.txt+=tmp_baudrate.txt
sys_baudrate.txt+=" bps"

Timer tm0
Attributes
Expand Down Expand Up @@ -209,16 +228,10 @@ Timer tm_esphome
ID : 3
Scope : local
Period (ms): 30000
Enabled : no
Enabled : yes

Events
Timer Event
printh 92
prints "current_page",0
printh 00
prints "blank",0
printh 00
printh FF FF FF
counter.val++
if(counter.val>360)
{
Expand All @@ -229,19 +242,5 @@ Timer tm_esphome
{
bauds=921600
}
click sys_baudrate,0
doevents
json.txt="{\"event\":\"params\""
covx display_mode,num_to_str.txt,0,0
json.txt+=",\"display_mode\":"+num_to_str.txt
covx charset,num_to_str.txt,0,0
json.txt+=",\"charset\":"+num_to_str.txt
json.txt+=",\"version\":\""+version.txt+"\""
json.txt+="}"
printh 92
prints "localevent",0
printh 00
prints json.txt,0
printh 00
printh FF FF FF
click qr0,0

Loading

0 comments on commit 7119998

Please sign in to comment.