Skip to content

Commit

Permalink
Release v2.0.1
Browse files Browse the repository at this point in the history
+ WebUI displays for Voltage, Current, Energy
+ ESP32 support (hardware serial only, with pin remapping)
+ PZEM-004Tv30 support (WIP)
- SoftwareSerial from now on is deprecated
+ heap curruption fix
* bump EmbUI version up to v2.5
  • Loading branch information
vortigont committed Sep 3, 2021
1 parent 0b2b60c commit 4ee8cd7
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 48 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Change Log

## current master

## v 2.0.1 (2021-09-03)
+ WebUI displays for Voltage, Current, Energy
+ ESP32 support (hardware serial only, with pin remapping)
+ PZEM-004Tv30 support (WIP)
SoftwareSerial from now on is deprecated
- SoftwareSerial from now on is deprecated
+ heap curruption fix
* bump EmbUI version up to v2.5

## v 2.0.0 (2021-04-12)

Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ src_build_flags =
!python flags.py
lib_deps =
https://github.com/charno/FTPClientServer
https://github.com/vortigont/EmbUI.git#v2.4.3
https://github.com/vortigont/EmbUI.git#v2.5
monitor_speed = 115200
;extra_scripts = .pio/strip-floats.py

Expand Down
9 changes: 9 additions & 0 deletions replace_fs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Import("env")
import platform

if platform.system() == 'Windows':
print("Replace MKSPIFFSTOOL with mklittlefs.exe")
env.Replace (MKSPIFFSTOOL = "./mklittlefs.exe")
else:
print("Replace MKSPIFFSTOOL with mklittlefs")
env.Replace (MKSPIFFSTOOL = "./mklittlefs")
127 changes: 81 additions & 46 deletions resources/respack.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
#!/bin/sh

USAGE="Usage: `basename $0` [-h] [-t embuitag] args"
USAGE="Usage: `basename $0` [-h] [-t embuitag] [-f]"

# embui branch/tag name to fetch
embuirepo='https://github.com/vortigont/EmbUI'
embuitag="v2.5"

#####
# no changes below this point!

# etag file
tags=etags.txt
# embui branch/tag name to fetch
embuitag="v2.4.3"

refresh_styles=0
refresh_data=0
refresh_js=0

embuijs_files='lib.js maker.js dyncss.js'

# parse cmd options
while getopts ht: OPT; do
case "$OPT" in
h)
echo $USAGE
exit 0
;;
f)
echo "Force refresh"
rm -f $tags
refresh_data=1
refresh_js=1
;;
t)
echo "EmbUI tag is set to: $OPTARG"
embuitag=$OPTARG
Expand Down Expand Up @@ -45,78 +58,100 @@ freshtag(){
return 1
}

# get resource file from EmbUI repo
getResgz(){
local res=$1
local url="${embuirepo}/raw/$embuitag/resources/html/${res}"
if freshtag ${url} ; then
curl -sL $url | gzip -9 > ../data/${res}.gz
fi
}

# update local file
updlocalgz(){
local res=$1
[ ! -f ../data/${res} ] || [ html/${res} -nt ../data/${res}.gz ] && gzip -9kf html/${res} && mv -f html/${res}.gz ../data/${res}.gz
}

echo "Preparing resources for ESPEM FS image into ../data/ dir"

mkdir -p ../data/css ../data/js

# собираем скрипты и стили из репозитория EmbUI
if freshtag https://github.com/vortigont/EmbUI/raw/$embuitag/resources/data.zip ; then
refresh_styles=1
if freshtag ${embuirepo}/raw/$embuitag/resources/data.zip ; then
refresh_data=1
echo "EmbUI resources requires updating"
else
echo "EmbUI is up to date"
fi

if freshtag https://github.com/vortigont/EmbUI/raw/$embuitag/resources/html/js/lib.js ; then
refresh_js=1
fi
if freshtag https://github.com/vortigont/EmbUI/raw/$embuitag/resources/html/js/maker.js ; then
refresh_js=1
fi
if freshtag https://github.com/vortigont/EmbUI/raw/$embuitag/resources/html/js/dyncss.js ; then
refresh_js=1
fi
# check for newer js files
for f in ${embuijs_files}
do
if freshtag ${embuirepo}/raw/$embuitag/resources/html/js/${f} ; then
refresh_js=1
break
fi
done


# проверяем есть ли обновленные стили для тем embui
#for f in html/css/style_*.css
#do
# [ ! -f ../data/css/$( basename $f).gz ] || [ $f -nt ../data/css/$( basename $f).gz ] && refresh_styles=1
#done
# check if there are any fresh styles for the project to merge with EmbUI
if [ -f html/css/style_*.css ] ; then
for f in "html/css/style_*.css"
do
[ ! -f ../data/css/$( basename $f).gz ] || [ $f -nt ../data/css/$( basename $f).gz ] && refresh_data=1
done
fi

# if any of the styles needs updating, than we need to repack both embui and local files
if [ $refresh_styles -eq 1 ] ; then
if [ $refresh_data -eq 1 ] ; then

echo "refreshing embui css files..."
echo "Refreshing EmbUI css files/pics..."

curl -sL https://github.com/vortigont/EmbUI/raw/$embuitag/resources/data.zip > embui.zip
# т.к. неизвестно что изменилось во фреймворке, скрипты или цсски, обновляем всё
#unzip -o -d ../data/ embui.zip "css/*" "js/*"
curl -sL ${embuirepo}/raw/$embuitag/resources/data.zip > embui.zip
unzip -o -d ../data/ embui.zip "css/*" "js/tz*"

# append our styles to the embui
# for f in css/style_*.css
# do
# gzip -d ../data/css/$( basename $f).gz
# cat $f >> ../data/css/$( basename $f)
# gzip -9 ../data/css/$( basename $f)
# touch -r $f ../data/css/$( basename $f).gz
# done
# append our local styles to the embui
if [ -f html/css/style_*.css ] ; then
for f in "css/style_*.css"
do
gzip -d ../data/css/$( basename $f).gz
cat $f >> ../data/css/$( basename $f)
gzip -9 ../data/css/$( basename $f)
touch -r $f ../data/css/$( basename $f).gz
done
fi

rm -f embui.zip
fi

if [ $refresh_js -eq 1 ] ; then
echo "refreshing embui js files..."

curl -sL https://github.com/vortigont/EmbUI/raw/$embuitag/resources/html/js/lib.js > embui.js
curl -sL https://github.com/vortigont/EmbUI/raw/$embuitag/resources/html/js/maker.js >> embui.js
curl -sL https://github.com/vortigont/EmbUI/raw/$embuitag/resources/html/js/dyncss.js >> embui.js
rm -f embui.js
for f in ${embuijs_files}
do
curl -sL ${embuirepo}/raw/$embuitag/resources/html/js/${f} >> embui.js
done
gzip -9 embui.js && mv -f embui.js.gz ../data/js/
fi


# update static files if newer
[ ! -f ../data/index.html.gz ] || [ html/index.html -nt ../data/index.html.gz ] && gzip -9kf html/index.html && mv -f html/index.html.gz ../data/
[ ! -f ../data/favicon.ico.gz ] || [ html/favicon.ico -nt ../data/favicon.ico.gz ] && gzip -9kf html/favicon.ico && mv -f html/favicon.ico.gz ../data/
[ ! -f ../data/js/espem.js.gz ] || [ html/js/espem.js -nt ../data/js/espem.js.gz ] && gzip -9kf html/js/espem.js && mv -f html/js/espem.js.gz ../data/js/
[ ! -f ../data/css/espem.css.gz ] || [ html/css/espem.css -nt ../data/css/espem.css.gz ] && gzip -9kf html/css/espem.css && mv -f html/css/espem.css.gz ../data/css/

#cp -u html/.exclude.files ../data/
# update index file if missing or newer
if [ ! -f html/index.html ] ; then
getResgz index.html
else
updlocalgz 'index.html'
fi

###
# обновляем ace-editor в data/extras folder
# collect all required ACE editor extensions here
if [ ! -f html/favicon.ico ] ; then
getResgz favicon.ico
else
updlocalgz 'favicon.ico'
fi

mv -f newetags.txt $tags

## update local js/css if newer
updlocalgz 'js/espem.js'
updlocalgz 'css/espem.css'

0 comments on commit 4ee8cd7

Please sign in to comment.