Skip to content

Commit

Permalink
0.8.58
Browse files Browse the repository at this point in the history
* full refresh of ePaper after booting #1107
* add optional custom link #1199
* pinout has an own subgroup in `/settings`
* grid profile will be displayed as hex in every case #1199
  • Loading branch information
lumapu committed Jan 17, 2024
1 parent 5d4d5e7 commit c3a2ad0
Show file tree
Hide file tree
Showing 13 changed files with 264 additions and 202 deletions.
4 changes: 4 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
* fix protection mask #1352
* merge PR: Add Watchdog for ESP32 #1367
* merge PR: ETH support for CMT2300A - HMS/HMT #1356
* full refresh of ePaper after booting #1107
* add optional custom link #1199
* pinout has an own subgroup in `/settings`
* grid profile will be displayed as hex in every case #1199

## 0.8.57 - 2024-01-15
* merge PR: fix immediate clearing of display after sunset #1364
Expand Down
4 changes: 3 additions & 1 deletion src/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@
// reconnect delay
#define MQTT_RECONNECT_DELAY 5000


// maximum custom link length
#define MAX_CUSTOM_LINK_LEN 100
#define MAX_CUSTOM_LINK_TEXT_LEN 32
// syslog settings
#ifdef ENABLE_SYSLOG
#define SYSLOG_HOST "<hostname-or-ip-address-of-syslog-server>"
Expand Down
6 changes: 6 additions & 0 deletions src/config/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ typedef struct {

typedef struct {
display_t display;
char customLink[MAX_CUSTOM_LINK_LEN];
char customLinkText[MAX_CUSTOM_LINK_TEXT_LEN];
} plugins_t;

typedef struct {
Expand Down Expand Up @@ -716,6 +718,8 @@ class settings {
disp[F("busy")] = mCfg.plugin.display.disp_busy;
disp[F("dc")] = mCfg.plugin.display.disp_dc;
disp[F("pirPin")] = mCfg.plugin.display.pirPin;
obj[F("cst_lnk")] = mCfg.plugin.customLink;
obj[F("cst_lnk_txt")] = mCfg.plugin.customLinkText;
} else {
JsonObject disp = obj["disp"];
getVal<uint8_t>(disp, F("type"), &mCfg.plugin.display.type);
Expand All @@ -734,6 +738,8 @@ class settings {
getVal<uint8_t>(disp, F("busy"), &mCfg.plugin.display.disp_busy);
getVal<uint8_t>(disp, F("dc"), &mCfg.plugin.display.disp_dc);
getVal<uint8_t>(disp, F("pirPin"), &mCfg.plugin.display.pirPin);
getChar(obj, F("cst_lnk"), mCfg.plugin.customLink, MAX_CUSTOM_LINK_LEN);
getChar(obj, F("cst_lnk_txt"), mCfg.plugin.customLinkText, MAX_CUSTOM_LINK_TEXT_LEN);
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/plugins/Display/Display_ePaper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ DisplayEPaper::DisplayEPaper() {
void DisplayEPaper::init(uint8_t type, uint8_t _CS, uint8_t _DC, uint8_t _RST, uint8_t _BUSY, uint8_t _SCK, uint8_t _MOSI, uint32_t *utcTs, const char *version) {
mUtcTs = utcTs;

mRefreshState = RefreshStatus::LOGO;
mSecondCnt = 0;
mRefreshState = RefreshStatus::BLACK;
mSecondCnt = 2;

if (type == 10) {
Serial.begin(115200);
Expand Down Expand Up @@ -63,6 +63,7 @@ void DisplayEPaper::fullRefresh() {
void DisplayEPaper::refreshLoop() {
switch(mRefreshState) {
case RefreshStatus::LOGO:
mFirst = false;
_display->fillScreen(GxEPD_BLACK);
_display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE);
mNextRefreshState = RefreshStatus::PARTITIALS;
Expand All @@ -79,7 +80,7 @@ void DisplayEPaper::refreshLoop() {
if(mSecondCnt == 0) {
_display->fillScreen(GxEPD_WHITE);
mNextRefreshState = RefreshStatus::PARTITIALS;
mRefreshState = RefreshStatus::WAIT;
mRefreshState = (mFirst) ? RefreshStatus::LOGO : RefreshStatus::WAIT;
}
break;

Expand Down
1 change: 1 addition & 0 deletions src/plugins/Display/Display_ePaper.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class DisplayEPaper {
const char* _version;
RefreshStatus mRefreshState, mNextRefreshState;
uint8_t mSecondCnt;
bool mFirst = true;
};

#endif // ESP32
3 changes: 2 additions & 1 deletion src/web/RestApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ class RestApi {
obj[F("menu_prot")] = mApp->getProtection(request);
obj[F("menu_mask")] = (uint16_t)(mConfig->sys.protectionMask );
obj[F("menu_protEn")] = (bool) (strlen(mConfig->sys.adminPwd) > 0);
obj[F("cst_lnk")] = String(mConfig->plugin.customLink);
obj[F("cst_lnk_txt")] = String(mConfig->plugin.customLinkText);

#if defined(ESP32)
obj[F("esp_type")] = F("ESP32");
Expand Down Expand Up @@ -354,7 +356,6 @@ class RestApi {
obj[F("pending")] = (bool)mApp->getSavePending();
obj[F("success")] = (bool)mApp->getLastSaveSucceed();
obj[F("reboot")] = (bool)mApp->getShouldReboot();
obj[F("refresh_url")] = "/";
#if defined(ETHERNET) && defined(CONFIG_IDF_TARGET_ESP32S3)
obj[F("reload")] = 5;
#else
Expand Down
10 changes: 9 additions & 1 deletion src/web/html/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,18 @@ function topnav() {
}

function parseNav(obj) {
for(i = 0; i < 12; i++) {
for(i = 0; i < 13; i++) {
if(i == 2)
continue;
var l = document.getElementById("nav"+i);
if(12 == i) {
if(obj.cst_lnk.length > 0) {
l.href = obj.cst_lnk
l.innerHTML = obj.cst_lnk_txt
l.classList.remove("hide");
}
continue;
}
if(window.location.pathname == "/" + l.href.substring(0, l.href.indexOf("?")).split('/').pop()) {
if((i != 8 )&& (i != 9))
l.classList.add("active");
Expand Down
1 change: 1 addition & 0 deletions src/web/html/includes/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<a id="nav8" href="/api" target="_blank">REST API</a>
<a id="nav9" href="https://ahoydtu.de" target="_blank">{#NAV_DOCUMENTATION}</a>
<a id="nav10" href="/about?v={#VERSION}">{#NAV_ABOUT}</a>
<a id="nav12" href="#" class="hide" target="_blank">Custom Link</a>
<span class="seperator"></span>
<a id="nav0" class="hide" href="/login">Login</a>
<a id="nav1" class="hide" href="/logout">Logout</a>
Expand Down
4 changes: 2 additions & 2 deletions src/web/html/save.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
meta.httpEquiv = "refresh"
if(!obj.reboot) {
html = "{#SUCCESS_SAVED_RELOAD}";
meta.content = 3;
meta.content = "2; URL=/setup"
} else {
html = "{#SUCCESS_SAVED_REBOOT} " + obj.reload + " {#SECONDS}.";
meta.content = obj.reload + "; URL=/";
meta.content = obj.reload + "; URL=/"
}
document.getElementsByTagName('head')[0].appendChild(meta);
} else {
Expand Down
Loading

0 comments on commit c3a2ad0

Please sign in to comment.