Browse Source

Merge branch 'geronet1-development03' into development03

pull/1670/head^2
lumapu 7 months ago
parent
commit
c998522418
  1. 5
      src/config/config.h
  2. 3
      src/config/config_override_example.h
  3. 2
      src/network/AhoyWifiEsp32.h
  4. 13
      src/publisher/pubMqttIvData.h
  5. 18
      src/web/html/index.html

5
src/config/config.h

@ -16,9 +16,8 @@
//------------------------------------- //-------------------------------------
// Fallback WiFi Info // Fallback WiFi Info
#define FB_WIFI_SSID "YOUR_WIFI_SSID" #define FB_WIFI_SSID ""
#define FB_WIFI_PWD "YOUR_WIFI_PWD" #define FB_WIFI_PWD ""
// Access Point Info // Access Point Info
// In case there is no WiFi Network or Ahoy can not connect to it, it will act as an Access Point // In case there is no WiFi Network or Ahoy can not connect to it, it will act as an Access Point

3
src/config/config_override_example.h

@ -6,9 +6,6 @@
#ifndef __CONFIG_OVERRIDE_H__ #ifndef __CONFIG_OVERRIDE_H__
#define __CONFIG_OVERRIDE_H__ #define __CONFIG_OVERRIDE_H__
// override fallback WiFi info
#define FB_WIFI_OVERRIDDEN
// each override must be preceded with an #undef statement // each override must be preceded with an #undef statement
#undef FB_WIFI_SSID #undef FB_WIFI_SSID
#define FB_WIFI_SSID "MY_SSID" #define FB_WIFI_SSID "MY_SSID"

2
src/network/AhoyWifiEsp32.h

@ -17,7 +17,7 @@ class AhoyWifi : public AhoyNetwork {
void begin() override { void begin() override {
mAp.enable(); mAp.enable();
if(String(FB_WIFI_SSID) == mConfig->sys.stationSsid) if(strlen(mConfig->sys.stationSsid) == 0)
return; // no station wifi defined return; // no station wifi defined
WiFi.disconnect(); // clean up WiFi.disconnect(); // clean up

13
src/publisher/pubMqttIvData.h

@ -197,13 +197,20 @@ class PubMqttIvData {
if (!mCfg->json) { if (!mCfg->json) {
snprintf(mSubTopic.data(), mSubTopic.size(), "%s/ch%d/%s", mIv->config->name, rec->assign[mPos].ch, fields[rec->assign[mPos].fieldId]); snprintf(mSubTopic.data(), mSubTopic.size(), "%s/ch%d/%s", mIv->config->name, rec->assign[mPos].ch, fields[rec->assign[mPos].fieldId]);
snprintf(mVal.data(), mVal.size(), "%g", ah::round3(mIv->getValue(mPos, rec))); snprintf(mVal.data(), mVal.size(), "%g", ah::round3(mIv->getValue(mPos, rec)));
} else {
if (FLD_ACT_ACTIVE_PWR_LIMIT == rec->assign[mPos].fieldId) {
uint8_t qos = (FLD_ACT_ACTIVE_PWR_LIMIT == rec->assign[mPos].fieldId) ? QOS_2 : QOS_0;
snprintf(mSubTopic.data(), mSubTopic.size(), "%s/%s", mIv->config->name, fields[rec->assign[mPos].fieldId]);
snprintf(mVal.data(), mVal.size(), "%g", ah::round3(mIv->getValue(mPos, rec)));
mPublish(mSubTopic.data(), mVal.data(), retained, qos);
}
} }
} }
if ((InverterDevInform_All == mCmd) || (InverterDevInform_Simple == mCmd) || !mCfg->json) { if ((InverterDevInform_All == mCmd) || (InverterDevInform_Simple == mCmd) || !mCfg->json)
{
uint8_t qos = (FLD_ACT_ACTIVE_PWR_LIMIT == rec->assign[mPos].fieldId) ? QOS_2 : QOS_0; uint8_t qos = (FLD_ACT_ACTIVE_PWR_LIMIT == rec->assign[mPos].fieldId) ? QOS_2 : QOS_0;
if((FLD_EVT != rec->assign[mPos].fieldId) if((FLD_EVT != rec->assign[mPos].fieldId) && (FLD_LAST_ALARM_CODE != rec->assign[mPos].fieldId))
&& (FLD_LAST_ALARM_CODE != rec->assign[mPos].fieldId))
mPublish(mSubTopic.data(), mVal.data(), retained, qos); mPublish(mSubTopic.data(), mVal.data(), retained, qos);
} }
} }

18
src/web/html/index.html

@ -116,6 +116,8 @@
var p = div(["none"]); var p = div(["none"]);
var total = 0; var total = 0;
var count = 0; var count = 0;
var mobile = window.screen.width < 470;
for(var i of obj) { for(var i of obj) {
var icon = iconSuccess; var icon = iconSuccess;
var cl = "icon-success"; var cl = "icon-success";
@ -131,7 +133,8 @@
} else if(0 == i["ts_last_success"]) { } else if(0 == i["ts_last_success"]) {
avail = "{#AVAIL_NO_DATA}"; avail = "{#AVAIL_NO_DATA}";
} else { } else {
avail = "{#AVAIL} "; if (!mobile)
avail = "{#AVAIL} ";
if(false == i["is_producing"]) if(false == i["is_producing"])
avail += "{#NOT_PRODUCING}"; avail += "{#NOT_PRODUCING}";
else { else {
@ -142,11 +145,16 @@
} }
} }
var text;
if (mobile)
text = "#";
else
text = "{#INVERTER} #";
p.append( p.append(
svg(icon, 30, 30, "icon " + cl), svg(icon, 30, 30, "icon " + cl),
span("{#INVERTER} #" + i["id"] + ": " + i["name"] + " {#IS} " + avail), span(text + i["id"] + ": " + i["name"] + " {#IS} " + avail),
br() br()
); );
if(false == i["is_avail"]) { if(false == i["is_avail"]) {
if(i["ts_last_success"] > 0) { if(i["ts_last_success"] > 0) {

Loading…
Cancel
Save