Skip to content

Commit

Permalink
Merge pull request #37 from vortigont/embui_280
Browse files Browse the repository at this point in the history
Embui 280
  • Loading branch information
vortigont authored Oct 6, 2023
2 parents 808ae0b + 2fe67a3 commit 832b24f
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 199 deletions.
4 changes: 2 additions & 2 deletions espem/espem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ bool ESPEM::tsSet(size_t size, uint32_t interval){
//tsc.addTS(300, esp_timer_get_time() >> 20, 10, "per10sec", 2);
//tsc.addTS(300, esp_timer_get_time() >> 20, 60, "permin", 2);

LOG(printf, "SRAM: heap %d, free %d\n", ESP.getHeapSize(), ESP.getFreeHeap());
LOG(printf, "SPI-RAM: heap %d, free %d\n", ESP.getPsramSize(), ESP.getFreePsram());
LOG(printf, "SRAM: heap %u, free %u\n", ESP.getHeapSize(), ESP.getFreeHeap());
LOG(printf, "SPI-RAM: heap %u, free %u\n", ESP.getPsramSize(), ESP.getFreePsram());

return (bool)tsc.getTScap();
}
Expand Down
165 changes: 82 additions & 83 deletions espem/interface.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion espem/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


#define BAUD_RATE 115200 // serial debug port baud rate
#define HTTP_VER_BUFSIZE 200
#define HTTP_VER_BUFSIZE 256

#define WEBUI_PUBLISH_INTERVAL 20

Expand Down
26 changes: 13 additions & 13 deletions espem/ui_i18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ enum CD : uint8_t {

// Infoclock - English Strings (order does not matther)
// ИнфоЧасики - Русские тексты (порядок значения не имеет)
static const char T_EN_ESPEM[] PROGMEM = "ESP Energy Monitor";
static const char T_RU_ESPEM[] PROGMEM = "ESP Энергометр";
static const char T_EN_ESPEM_DB[] PROGMEM = "ESPEM Dashboard";
static const char T_RU_ESPEM_DB[] PROGMEM = "ESPEM Индикаторы";
static const char T_EN_ESPEMSet[] PROGMEM = "ESPEM Setup";
static const char T_RU_ESPEMSet[] PROGMEM = "ESPEM Параметры";
static const char T_EN_MScale[] PROGMEM = "Metrics scale";
static const char T_RU_MScale[] PROGMEM = "Масштаб выборки";
static const char T_EN_Voltage[] PROGMEM = "Voltage meter";
static const char T_RU_Voltage[] PROGMEM = "Напряжение сети";
static const char T_EN_PowerF[] PROGMEM = "Power Factor";
static const char T_RU_PowerF[] PROGMEM = "Коэффициент мощности";
static constexpr const char T_EN_ESPEM[] PROGMEM = "ESP Energy Monitor";
static constexpr const char T_RU_ESPEM[] PROGMEM = "ESP Энергометр";
static constexpr const char T_EN_ESPEM_DB[] PROGMEM = "ESPEM Dashboard";
static constexpr const char T_RU_ESPEM_DB[] PROGMEM = "ESPEM Индикаторы";
static constexpr const char T_EN_ESPEMSet[] PROGMEM = "ESPEM Setup";
static constexpr const char T_RU_ESPEMSet[] PROGMEM = "ESPEM Параметры";
static constexpr const char T_EN_MScale[] PROGMEM = "Metrics scale";
static constexpr const char T_RU_MScale[] PROGMEM = "Масштаб выборки";
static constexpr const char T_EN_Voltage[] PROGMEM = "Voltage meter";
static constexpr const char T_RU_Voltage[] PROGMEM = "Напряжение сети";
static constexpr const char T_EN_PowerF[] PROGMEM = "Power Factor";
static constexpr const char T_RU_PowerF[] PROGMEM = "Коэффициент мощности";


/**
Expand All @@ -47,7 +47,7 @@ static const char T_RU_PowerF[] PROGMEM = "Коэффициент мощност
* Messages indexes of each lang must match each other
* it is possible to reuse untraslated mesages from other lang's
*/
static const char *const C_DICT[][UI_DICT_SIZE] PROGMEM = {
static constexpr const char *const C_DICT[][UI_DICT_SIZE] PROGMEM = {
// Index 0 - English lang
{ T_EN_ESPEM,
T_EN_ESPEM_DB,
Expand Down
44 changes: 22 additions & 22 deletions espem/uistrings.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@
// Set of flash-strings that might be reused multiple times within the code

// General
static const char C_ONE[] PROGMEM = "1";
static const char C_mkchart[] PROGMEM = "mkchart";
static const char C_js[] PROGMEM = "js";
static constexpr const char C_ONE[] PROGMEM = "1";
static constexpr const char C_mkchart[] PROGMEM = "mkchart";
static constexpr const char C_js[] PROGMEM = "js";

//////////////////////
// Configuration variables names - V_ prefix for 'Variable'
static const char V_EPOOLSIZE[] = "emplsz"; // sample pool size
static const char V_SMPL_PERIOD[] = "ems_prd"; // sampling period
static const char V_RX[] = "rx"; // rx pin
static const char V_TX[] = "tx"; // tx ping
static const char V_UART[] = "uart"; // uart interface
static const char V_EOFFSET[] = "eoffset"; // energy offset
static constexpr const char V_EPOOLSIZE[] = "emplsz"; // sample pool size
static constexpr const char V_SMPL_PERIOD[] = "ems_prd"; // sampling period
static constexpr const char V_RX[] = "rx"; // rx pin
static constexpr const char V_TX[] = "tx"; // tx ping
static constexpr const char V_UART[] = "uart"; // uart interface
static constexpr const char V_EOFFSET[] = "eoffset"; // energy offset

// directly changed vars
static const char V_EPOLLENA[] PROGMEM = "dctlpoll"; // Enable/disable poller
static const char V_EPFFIX[] PROGMEM = "dctlpffix"; // PowerFactor value correction
static const char V_UI_UPDRT[] = "dctlupdrt"; // UI update rate
static const char V_ECOLLECTORSTATE[] = "dctlmtrx"; // Metrics collector run/pause
static const char V_SMPLCNT[] = "dctlscnt"; // Metrics graph - number of samples to draw in a small power chart
static constexpr const char V_EPOLLENA[] PROGMEM = "dctlpoll"; // Enable/disable poller
static constexpr const char V_EPFFIX[] PROGMEM = "dctlpffix"; // PowerFactor value correction
static constexpr const char V_UI_UPDRT[] = "dctlupdrt"; // UI update rate
static constexpr const char V_ECOLLECTORSTATE[] = "dctlmtrx"; // Metrics collector run/pause
static constexpr const char V_SMPLCNT[] = "dctlscnt"; // Metrics graph - number of samples to draw in a small power chart


// UI blocks - B_ prefix for 'web Block'
static const char B_ESPEM[] PROGMEM = "b_espem";
static const char B_ESPEMSET[] PROGMEM = "b_emset";
static const char B_WEATHER[] PROGMEM = "b_wthr";
static const char B_MORE[] PROGMEM = "b_more";
static constexpr const char B_ESPEM[] PROGMEM = "b_espem";
static constexpr const char B_ESPEMSET[] PROGMEM = "b_emset";
static constexpr const char B_WEATHER[] PROGMEM = "b_wthr";
static constexpr const char B_MORE[] PROGMEM = "b_more";

// direct control elements
static const char A_DIRECT_CTL[] PROGMEM = "dctl*"; // checkboxes/controls that should be processed in real-time
static constexpr const char A_DIRECT_CTL[] PROGMEM = "dctl*"; // checkboxes/controls that should be processed in real-time


// UI handlers - A_ prefix for 'Action'
static const char A_SET_ESPEM[] PROGMEM = "a_setem"; // ESPEM settings update
static const char A_SET_UART[] PROGMEM = "a_uart";
static const char A_SET_PZOPTS[] PROGMEM = "a_pzopt";
static constexpr const char A_SET_ESPEM[] PROGMEM = "a_setem"; // ESPEM settings update
static constexpr const char A_SET_UART[] PROGMEM = "a_uart";
static constexpr const char A_SET_PZOPTS[] PROGMEM = "a_pzopt";

// other constants
15 changes: 7 additions & 8 deletions flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@

# print("OS: %s" % os.name)
if os.name == 'nt':
print("-DFW_VER='\"unknown\"'")
print("-DGIT_REV='\"n/a\"'")
quit()


# PIO build flags
# https://docs.platformio.org/en/latest/projectconf/section_env_build.html#src-build-flags
revision = (
subprocess.check_output(["git", "describe", "--abbrev=4", "--always", "--tags", "--long"])
.strip()
.decode("utf-8")
)
print("-DFW_VER='\"%s\"'" % revision)

try:
#revision = subprocess.check_output(["git", "describe", "--abbrev=4", "--always", "--tags", "--long"], stderr=subprocess.DEVNULL).strip().decode("utf-8")
revision = subprocess.check_output(["git", "describe", "--abbrev=7", "--always"], stderr=subprocess.DEVNULL).strip().decode("utf-8")
print ("-DGIT_REV='\"%s\"'" % revision)
except:
print ("-DGIT_REV='\"n/a\"'")
29 changes: 5 additions & 24 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ board_build.filesystem = littlefs
framework = arduino
build_flags =
-DFZ_WITH_ASYNCSRV
-DNO_GLOBAL_UPDATE
; -DCOUNTRY="ru"
build_src_flags =
!python flags.py
-std=gnu++14
-std=gnu++17
src_build_unflags =
-std=gnu++11
lib_deps =
https://github.com/vortigont/EmbUI.git#v2.7.2
;https://github.com/vortigont/EmbUI.git
https://github.com/vortigont/EmbUI.git#v2.8.1
lib_ignore =
ESPAsyncTCP
monitor_speed = 115200
Expand Down Expand Up @@ -115,28 +115,9 @@ build_flags =
;upload_port = http://espem/update
;upload_flags = compress


; ##########
; DEPRECATED
; Arduino core 1.5.x based on ESP32 IDF v3.x
;[esp32_pio350]
;[env:espem_s3]
;extends = esp32_base
;platform = espressif32@3.5.0
;build_flags =
; -DUSE_LittleFS
; -DCONFIG_LITTLEFS_FOR_IDF_3_2
;extra_scripts = replace_fs.py

; build with esp32 arduino core 1.5.x
;[env:espem_pio350]
;extends = esp32_pio350
;board = lolin_s3
;lib_deps =
; ${esp32_base.lib_deps}
; https://github.com/lorol/LITTLEFS.git
; https://github.com/vortigont/pzem-edl
;build_flags =
; ${esp32_base.build_flags}
; -DCOUNTRY="ru"
;lib_ignore =
; ESPAsyncTCP

9 changes: 0 additions & 9 deletions replace_fs.py

This file was deleted.

48 changes: 12 additions & 36 deletions resources/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,44 +37,20 @@
</ul>
</div>
<div class="left-block">
<div>
<span class="menu-title">Voltage:</span><span id="U" class="menu-value">{{value.U}}</span>
</div>
<div>
<span class="menu-title">Current:</span><span id="I" class="menu-value">{{value.I}}</span>
</div>
<div>
<span class="menu-title">Power:</span><span id="P" class="menu-value">{{value.P}}</span>
</div>
<div>
<span class="menu-title">Energy:</span><span id="W" class="menu-value">{{value.W}}</span>
</div>
<div>
<span class="menu-title">Power Factor:</span><span id="Pf" class="menu-value">{{value.Pf}}</span>
</div>
<div>
<span class="menu-title">Frequency:</span><span id="freq" class="menu-value">{{value.freq}}</span>
</div>
<div><span class="menu-title">Voltage:</span><span id="U" class="menu-value">{{value.U}}</span></div>
<div><span class="menu-title">Current:</span><span id="I" class="menu-value">{{value.I}}</span></div>
<div><span class="menu-title">Power:</span><span id="P" class="menu-value">{{value.P}}</span></div>
<div><span class="menu-title">Energy:</span><span id="W" class="menu-value">{{value.W}}</span></div>
<div><span class="menu-title">Power Factor:</span><span id="Pf" class="menu-value">{{value.Pf}}</span></div>
<div><span class="menu-title">Frequency:</span><span id="freq" class="menu-value">{{value.freq}}</span></div>
</div>
<div class="left-block">
<div>
<span class="menu-title">Time:</span><span id="pTime" class="menu-value">{{value.pTime}}</span>
</div>
<div>
<span class="menu-title">Memory:</span><span id="pMem" class="menu-value">{{value.pMem}}</span>
</div>
<div>
<span class="menu-title">Uptime:</span><span id="pUptime" class="menu-value">{{value.pUptime}}</span>
</div>
<div>
<span class="menu-title">ChipID:</span><span class="menu-value">{{mc}}</span>
</div>
<div>
<span class="menu-title">EmbUI ver:</span><span class="menu-value">{{ver}}</span>
</div>
<div>
<span class="menu-title">Firmware ver:</span><span id="fwver" class="menu-value">{{value.fwver}}</span>
</div>
<div><span class="menu-title">Time:</span><span id="pTime" class="menu-value">{{value.pTime}}</span></div>
<div><span class="menu-title">Memory:</span><span id="pMem" class="menu-value">{{value.pMem}}</span></div>
<div><span class="menu-title">Uptime:</span><span id="pUptime" class="menu-value">{{value.pUptime}}</span></div>
<div><span class="menu-title">ChipID:</span><span class="menu-value">{{macid}}</span></div>
<div><span class="menu-title">EmbUI ver:</span><span class="menu-value">{{uiver}}</span></div>
<div><span class="menu-title">FirmWare ver:</span><span id="fwver" class="menu-value">{{appver}}</span></div>
<div>
<span class="menu-title">Theme:</span><span class="menu-value">
<a href="#" onclick="setDynCSS('css/style.css');">[C]</a>
Expand Down
2 changes: 1 addition & 1 deletion resources/respack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ USAGE="Usage: `basename $0` [-h] [-t embuitag] [-f]"

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

#####
# no changes below this point!
Expand Down

0 comments on commit 832b24f

Please sign in to comment.