Skip to content

Commit

Permalink
HASPmota demo of Renaissance Watch for 480x480 displays (arendst#21290)
Browse files Browse the repository at this point in the history
* HASPmota demo of Renaissance Watch for 480x480 displays

* Put arrow in front of date
  • Loading branch information
s-hadinger authored and hawa-lc4 committed May 7, 2024
1 parent 6d5132d commit 56be210
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
- esp32_partition_app3904k_fs3392k partition scheme for 8MB ESP32S3
- TCP Tx En GPIO type
- Berry `webserver.content_close()`
- HASPmota demo of Renaissance Watch for 480x480 displays

### Breaking Changed
- ESP32-C3 OTA binary name from `tasmota32c3cdc.bin` to `tasmota32c3.bin` with USB HWCDC and fallback to serial (#21212)
Expand Down
Binary file added tasmota/berry/haspmota/haspmota_watch_480.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tasmota/berry/haspmota/haspmota_watch_480.tapp
Binary file not shown.
73 changes: 73 additions & 0 deletions tasmota/berry/haspmota_src/haspmota_watch_480/autoexec.be
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This is a simple demo of displaying Renaissance Watch adapted for 480x480 displays
#
# Just install `haspmota_watch_480.tapp` in the filesystem
#
# Generate with
# rm haspmota_watch_480.tapp ; zip -j -0 haspmota_watch_480.tapp ../haspmota_src/haspmota_watch_480/*


# Test if display is at least 480x480
lv.start()
hres = lv.get_hor_res() # should be 320
vres = lv.get_ver_res() # should be 240
if lv.get_hor_res() < 480 || lv.get_ver_res() < 480
print("Renaissance Watch 480 demo requires a screen at least 480x480")
return
end

import haspmota
haspmota.start(false, tasmota.wd + "pages.jsonl")

var prev_day = -1
def set_watch()
import global
var now = tasmota.rtc()
var time_raw = now['local']
var time = tasmota.time_dump(time_raw)
# set second
if global.contains("p23b13")
global.p23b13.angle = 60 * time['sec']
end
# set minutes
global.p100b12.angle = 60 * time['min'] + (time['sec'] / 10) * 10
# set hours
global.p100b11.angle = 300 * (time['hour'] % 12) + time['min'] * 5
# set day
if time['day'] != prev_day
global.p100b15.text = str(time['day'])
prev_day = time['day']
end
end

def run_watch()
set_watch()
tasmota.set_timer(1000, run_watch)
end
run_watch()

def watch_in()
import global
global.p0b90.hidden = true
global.p0b101.bg_opa = 0
global.p0b101.border_opa = 0
global.p0b102.bg_opa = 0
global.p0b102.border_opa = 0
global.p0b102.text_opa = 0
global.p0b103.bg_opa = 0
global.p0b103.border_opa = 0
end

def watch_out()
import global
global.p0b90.hidden = false
global.p0b101.bg_opa = 255
global.p0b101.border_opa = 255
global.p0b102.bg_opa = 255
global.p0b102.border_opa = 255
global.p0b102.text_opa = 255
global.p0b103.bg_opa = 255
global.p0b103.border_opa = 255
end

tasmota.add_rule("hasp#p100=in", watch_in)
tasmota.add_rule("hasp#p100=out", watch_out)
29 changes: 29 additions & 0 deletions tasmota/berry/haspmota_src/haspmota_watch_480/pages.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{"page":0,"comment":"---------- Upper stat line ----------"}
{"id":0,"text_color":"#FFFF44"}

{"id":90,"obj":"flex","x":0,"y":0,"w%":100,"h":24,"bg_color":"#4f4f4f","bg_opa":255,"radius":0,"border_side":1,"border_width":1,"border_color":"#FFFF44","text_color":"#FFFF44"}
{"id":91,"obj":"label","parentid":90,"x":0,"y":0,"w":100,"h%":100,"long_mode":3,"text":"Tasmota","flex_grow":1}
{"id":92,"obj":"fixed","parentid":90,"w":102,"text_color":"#FFFF44"}
{"id":95,"parentid":92,"comment":"-- Clock --","obj":"lv_clock","x":0,"y":3,"w":55,"h":16,"radius":0,"border_side":0}
{"id":96,"parentid":92,"comment":"-- Battery indicator --","obj":"label","x":57,"y":0,"w":20,"h":20,"text":"\uE6A5","align":0,"text_font":"icons-18"}
{"id":97,"parentid":92,"comment":"-- Wifi indicator --","obj":"lv_wifi_arcs","x":73,"y":0,"w":29,"h":20,"radius":0,"border_side":0,"bg_color":"#000000","line_color":"#FFFF44"}

{"comment":"---------- Bottom buttons - prev/home/next ----------"}
{"id":100,"obj":"flex","x":0,"y%":84,"h%":16,"w%":100,"flex_main_place":3}
{"id":101,"obj":"btn","parentid":100,"w%":25,"h%":100,"action":"prev","bg_color":"#4f4f4f","text_color":"#FFFF44","radius":10,"text":"\uF053","text_font":"montserrat-20","border_width":3,"border_side":15,"border_color":"#FFFF44","border_opa":210}
{"id":102,"obj":"btn","parentid":100,"w%":25,"h%":100,"action":"back","bg_color":"#4f4f4f","text_color":"#FFFF44","radius":10,"text":"\uF015","text_font":"montserrat-20","border_width":3,"border_side":15,"border_color":"#FFFF44","border_opa":210}
{"id":103,"obj":"btn","parentid":100,"w%":25,"h%":100,"action":"next","bg_color":"#4f4f4f","text_color":"#FFFF44","radius":10,"text":"\uF054","text_font":"montserrat-20","border_width":3,"border_side":15,"border_color":"#FFFF44","border_opa":210}

{"page":1,"comment":"---------- Page 1 Obj ----------"}
{"id":0,"bg_color":"#000000","text_color":"#FFFFFF"}

{"id":10,"obj":"label","x":0,"y":30,"w%":100,"h":24,"text":"Demo of Renaissance watch 480x480","text_font":"montserrat-20"}

{"page":100,"comment":"---------- Page 100 Renaissance Watch ----------"}
{"id":0,"bg_color":"#000000","bg_grad_color":"#000000","bg_grad_dir":1,"text_color":"#000000"}

{"id":10,"obj":"img","src":"A:haspmota_watch_480.tapp#/ren_back_480.png","x":0,"y":0,"w":480,"h":480}
{"id":15,"obj":"label","parentid":10,"x":367,"y":225,"w":36,"h":36,"text":"29","align":"right","text_font":"montserrat-28"}
{"id":11,"obj":"img","parentid":10,"src":"A:/haspmota_watch_480.tapp#ren_hour_480.png","x":218,"y":94,"angle":-550}
{"id":12,"obj":"img","parentid":10,"src":"A:/haspmota_watch_480.tapp#ren_min_480.png","angle":500}
{"id":13,"obj":"img","parentid":10,"src":"A:/haspmota_watch_480.tapp#ren_sec_480.png","x":220,"y":20,"angle":1400,"hidden":true}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 56be210

Please sign in to comment.