mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-28 09:46:26 +02:00
0.8.141
* fix display IP in ePaper display (ETH or WiFi, static or DHCP) #1439
This commit is contained in:
parent
d14d783929
commit
f90aacc3c9
10 changed files with 26 additions and 17 deletions
|
@ -6,6 +6,7 @@
|
|||
* increased maximum number of alarms to 50 for ESP32 #1470
|
||||
* fix German translation #1688
|
||||
* fix display of delete and edit buttons in `/setup` #1372
|
||||
* fix display IP in ePaper display (ETH or WiFi, static or DHCP) #1439
|
||||
|
||||
# RELEASE 0.8.140 - 2024-08-16
|
||||
|
||||
|
|
|
@ -195,6 +195,10 @@ class app : public IApp, public ah::Scheduler {
|
|||
return mNetwork->isApActive();
|
||||
}
|
||||
|
||||
bool isNetworkConnected() override {
|
||||
return mNetwork->isConnected();
|
||||
}
|
||||
|
||||
void setRebootFlag() override {
|
||||
once(std::bind(&app::tickReboot, this), 3, "rboot");
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class IApp {
|
|||
virtual String getIp(void) = 0;
|
||||
virtual String getMac(void) = 0;
|
||||
virtual bool isApActive(void) = 0;
|
||||
virtual bool isNetworkConnected() = 0;
|
||||
|
||||
virtual uint32_t getUptime() = 0;
|
||||
virtual uint32_t getTimestamp() = 0;
|
||||
|
|
|
@ -117,7 +117,7 @@ const calcFunc_t<T> calcFunctions[] = {
|
|||
template <class REC_TYP>
|
||||
class Inverter {
|
||||
public: /*types*/
|
||||
#ifdef(ESP32)
|
||||
#if defined(ESP32)
|
||||
constexpr static uint8_t MaxAlarmNum = 50;
|
||||
#else
|
||||
constexpr static uint8_t MaxAlarmNum = 10;
|
||||
|
|
|
@ -52,7 +52,7 @@ class AhoyNetwork {
|
|||
}
|
||||
|
||||
bool isConnected() const {
|
||||
return (mStatus == NetworkState::CONNECTED);
|
||||
return ((mStatus == NetworkState::CONNECTED) || (mStatus == NetworkState::GOT_IP));
|
||||
}
|
||||
|
||||
bool updateNtpTime(void) {
|
||||
|
|
|
@ -195,7 +195,7 @@ class Display {
|
|||
}
|
||||
#if defined(ESP32)
|
||||
else if (DISP_TYPE_T10_EPAPER == mCfg->type) {
|
||||
mEpaper.loop((totalPower), totalYieldDay, totalYieldTotal, nrprod);
|
||||
mEpaper.loop((totalPower), totalYieldDay, totalYieldTotal, nrprod, mApp->getIp(), mApp->isNetworkConnected());
|
||||
mRefreshCycle++;
|
||||
|
||||
if (mRefreshCycle > 2880) { // 15 * 2280 = 44300s = 12h
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "Display_ePaper.h"
|
||||
|
||||
#if defined(ESP32)
|
||||
#include <WiFi.h>
|
||||
#include "../../utils/helper.h"
|
||||
#include "imagedata.h"
|
||||
#include "defines.h"
|
||||
|
@ -13,7 +12,9 @@ static const uint32_t spiClk = 4000000; // 4 MHz
|
|||
SPIClass hspi(HSPI);
|
||||
#endif
|
||||
|
||||
DisplayEPaper::DisplayEPaper() {
|
||||
DisplayEPaper::DisplayEPaper()
|
||||
: mNetworkConnected {false}
|
||||
{
|
||||
mDisplayRotation = 2;
|
||||
mHeadFootPadding = 16;
|
||||
memset(_fmtText, 0, EPAPER_MAX_TEXT_LEN);
|
||||
|
@ -122,8 +123,8 @@ void DisplayEPaper::headlineIP() {
|
|||
_display->fillScreen(GxEPD_BLACK);
|
||||
|
||||
do {
|
||||
if ((WiFi.isConnected() == true) && (WiFi.localIP() > 0)) {
|
||||
snprintf(_fmtText, EPAPER_MAX_TEXT_LEN, "%s", WiFi.localIP().toString().c_str());
|
||||
if (mNetworkConnected == true) {
|
||||
snprintf(_fmtText, EPAPER_MAX_TEXT_LEN, "%s", _settedIP.c_str());
|
||||
} else {
|
||||
snprintf(_fmtText, EPAPER_MAX_TEXT_LEN, STR_NO_WIFI);
|
||||
}
|
||||
|
@ -289,14 +290,15 @@ void DisplayEPaper::actualPowerPaged(float totalPower, float totalYieldDay, floa
|
|||
} while (_display->nextPage());
|
||||
}
|
||||
//***************************************************************************
|
||||
void DisplayEPaper::loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod) {
|
||||
void DisplayEPaper::loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod, String ip, bool networkConnected) {
|
||||
mNetworkConnected = networkConnected;
|
||||
if(RefreshStatus::DONE != mRefreshState)
|
||||
return;
|
||||
|
||||
// check if the IP has changed
|
||||
if (_settedIP != WiFi.localIP().toString()) {
|
||||
if (_settedIP != ip) {
|
||||
// save the new IP and call the Headline Function to adapt the Headline
|
||||
_settedIP = WiFi.localIP().toString();
|
||||
_settedIP = ip;
|
||||
headlineIP();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class DisplayEPaper {
|
|||
void fullRefresh();
|
||||
void 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);
|
||||
void config(uint8_t rotation, bool enPowerSave);
|
||||
void loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod);
|
||||
void loop(float totalPower, float totalYieldDay, float totalYieldTotal, uint8_t isprod, String ip, bool networkConnected);
|
||||
void refreshLoop();
|
||||
void tickerSecond();
|
||||
|
||||
|
@ -66,6 +66,7 @@ class DisplayEPaper {
|
|||
|
||||
uint8_t mSecondCnt;
|
||||
bool mLogoDisplayed;
|
||||
bool mNetworkConnected;
|
||||
#if defined(SPI_HAL)
|
||||
epdHal hal;
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define STR_OFFLINE "aus"
|
||||
#define STR_ONLINE "aktiv"
|
||||
#define STR_NO_INVERTER "kein inverter"
|
||||
#define STR_NO_WIFI "WLAN nicht verbunden"
|
||||
#define STR_NO_WIFI "Netzwerk nicht verbunden"
|
||||
#define STR_VERSION "Version"
|
||||
#define STR_ACTIVE_INVERTERS "aktive WR"
|
||||
#define STR_TODAY "heute"
|
||||
|
@ -23,7 +23,7 @@
|
|||
#define STR_OFFLINE "eteint"
|
||||
#define STR_ONLINE "online"
|
||||
#define STR_NO_INVERTER "pas d'onduleur"
|
||||
#define STR_NO_WIFI "WiFi not connected"
|
||||
#define STR_NO_WIFI "Network not connected"
|
||||
#define STR_VERSION "Version"
|
||||
#define STR_ACTIVE_INVERTERS "active Inv"
|
||||
#define STR_TODAY "today"
|
||||
|
@ -34,7 +34,7 @@
|
|||
#define STR_OFFLINE "offline"
|
||||
#define STR_ONLINE "online"
|
||||
#define STR_NO_INVERTER "no inverter"
|
||||
#define STR_NO_WIFI "WiFi not connected"
|
||||
#define STR_NO_WIFI "Network not connected"
|
||||
#define STR_VERSION "Version"
|
||||
#define STR_ACTIVE_INVERTERS "active Inv"
|
||||
#define STR_TODAY "today"
|
||||
|
|
|
@ -674,15 +674,15 @@ class RestApi {
|
|||
// find oldest alarm
|
||||
uint8_t offset = 0;
|
||||
uint32_t oldestStart = 0xffffffff;
|
||||
for(uint8_t i = 0; i < hmInverter::MaxAlarmNum; i++) {
|
||||
for(uint8_t i = 0; i < Inverter<>::MaxAlarmNum; i++) {
|
||||
if((iv->lastAlarm[i].start != 0) && (iv->lastAlarm[i].start < oldestStart)) {
|
||||
offset = i;
|
||||
oldestStart = iv->lastAlarm[i].start;
|
||||
}
|
||||
}
|
||||
|
||||
for(uint8_t i = 0; i < hmInverter::MaxAlarmNum; i++) {
|
||||
uint8_t pos = (i + offset) % hmInverter::MaxAlarmNum;
|
||||
for(uint8_t i = 0; i < Inverter<>::MaxAlarmNum; i++) {
|
||||
uint8_t pos = (i + offset) % Inverter<>::MaxAlarmNum;
|
||||
alarm[pos][F("code")] = iv->lastAlarm[pos].code;
|
||||
alarm[pos][F("str")] = iv->getAlarmStr(iv->lastAlarm[pos].code);
|
||||
alarm[pos][F("start")] = iv->lastAlarm[pos].start;
|
||||
|
|
Loading…
Add table
Reference in a new issue