Skip to content

Commit

Permalink
Winky copy Teleinfo driver example to FS (#31)
Browse files Browse the repository at this point in the history
* Create cp2fs.be

* disable driver load by default

* exec copy files to filesystem
  • Loading branch information
hallard authored Oct 31, 2023
1 parent ad96787 commit f282bd4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion raw/esp32c3/Winky/autoexec.be
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# load Winky teleinfo driver
load("teleinfo.be")
#load("teleinfo.be")
36 changes: 36 additions & 0 deletions raw/esp32c3/Winky/cp2fs.be
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copy teleinfo driver to file system to be end user editable

# simple function to copy from autoconfig archive to filesystem
# return true if ok
def cp(from, to)
import path
if to == nil to = from end # to is optional
tasmota.log("OTA: copying "+tasmota.wd + to, 2)
if !path.exists(to)
try
# tasmota.log("f_in="+tasmota.wd + from)
var f_in = open(tasmota.wd + from)
var f_content = f_in.readbytes()
f_in.close()
var f_out = open(to, "w")
f_out.write(f_content)
f_out.close()
except .. as e,m
tasmota.log("OTA: Couldn't copy "+to+" "+e+" "+m,2)
return false
end
return true
end
return true
end

import path

# copy some samples files from autoconf
# to filesystem for end user speed up learn
var ok
ok = cp("autoexec.be")
ok = cp("teleinfo.be")


# Done
1 change: 1 addition & 0 deletions raw/esp32c3/Winky/init.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Br load("Winky.autoconf#cp2fs.be")
Template {"NAME":"Winky","GPIO":[1,4704,1376,5632,4705,640,608,1,1,32,1,0,0,0,0,0,0,0,1,1,1,1],"FLAG":0,"BASE":1}
Module 0

Expand Down

0 comments on commit f282bd4

Please sign in to comment.