Browse Source

Merge branch 'development03' into epd2_hal

pull/1626/head
lumapu 6 months ago
parent
commit
008c5a1698
  1. 6
      src/CHANGES.md
  2. 38
      src/hm/hmInverter.h
  3. 1
      src/hm/hmSystem.h
  4. 3
      src/network/AhoyWifiEsp32.h
  5. 3
      src/publisher/pubMqtt.h
  6. 2
      src/web/Protection.h
  7. 1
      src/web/html/colorBright.css
  8. 1
      src/web/html/colorDark.css
  9. 4
      src/web/html/index.html
  10. 20
      src/web/html/setup.html
  11. 8
      src/web/html/style.css
  12. 20
      src/web/html/update.html

6
src/CHANGES.md

@ -1,5 +1,11 @@
# Development Changes
## 0.8.111 - 2024-04-17
* fix MqTT discovery field `ALARM_MES_ID` #1591
* fix Wifi reconnect for ESP32 #1589 #1575
* open link from `index.html` in new tab #1588 #1587
* merge PR: Disable upload and import buttons when no file is selected #1586 #1519
## 0.8.110 - 2024-04-11
* revert CMT2300A changes #1553
* merged PR: fix closing tag #1584

38
src/hm/hmInverter.h

@ -33,28 +33,28 @@
// prototypes
template<class T=float>
static T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0);
T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0);
T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcUdcCh(Inverter<> *iv, uint8_t arg0);
T calcUdcCh(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0);
T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0);
T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcIrradiation(Inverter<> *iv, uint8_t arg0);
T calcIrradiation(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0);
T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0);
template<class T=float>
static T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0);
T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0);
template<class T=float>
using func_t = T (Inverter<> *, uint8_t);
@ -270,7 +270,8 @@ class Inverter {
if(InverterStatus::OFF != status) {
mDevControlRequest = true;
devControlCmd = cmd;
//app->triggerTickSend(); // done in RestApi.h, because of "chicken-and-egg problem ;-)"
//assert(App);
//App->triggerTickSend(0);
}
return (InverterStatus::OFF != status);
}
@ -818,6 +819,7 @@ class Inverter {
public:
static uint32_t *timestamp; // system timestamp
static cfgInst_t *generalConfig; // general inverter configuration from setup
static IApp *App;
uint16_t mDtuRxCnt = 0;
uint16_t mDtuTxCnt = 0;
@ -838,6 +840,8 @@ template <class REC_TYP>
uint32_t *Inverter<REC_TYP>::timestamp {0};
template <class REC_TYP>
cfgInst_t *Inverter<REC_TYP>::generalConfig {0};
template <class REC_TYP>
IApp *Inverter<REC_TYP>::App {nullptr};
/**
@ -847,7 +851,7 @@ cfgInst_t *Inverter<REC_TYP>::generalConfig {0};
*/
template<class T=float>
static T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0) {
T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcYieldTotalCh0"));
if(NULL != iv) {
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
@ -861,7 +865,7 @@ static T calcYieldTotalCh0(Inverter<> *iv, uint8_t arg0) {
}
template<class T=float>
static T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0) {
T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcYieldDayCh0"));
if(NULL != iv) {
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
@ -875,7 +879,7 @@ static T calcYieldDayCh0(Inverter<> *iv, uint8_t arg0) {
}
template<class T=float>
static T calcUdcCh(Inverter<> *iv, uint8_t arg0) {
T calcUdcCh(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcUdcCh"));
// arg0 = channel of source
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
@ -889,7 +893,7 @@ static T calcUdcCh(Inverter<> *iv, uint8_t arg0) {
}
template<class T=float>
static T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0) {
T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcPowerDcCh0"));
if(NULL != iv) {
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
@ -903,7 +907,7 @@ static T calcPowerDcCh0(Inverter<> *iv, uint8_t arg0) {
}
template<class T=float>
static T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0) {
T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcEfficiencyCh0"));
if(NULL != iv) {
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
@ -919,7 +923,7 @@ static T calcEffiencyCh0(Inverter<> *iv, uint8_t arg0) {
}
template<class T=float>
static T calcIrradiation(Inverter<> *iv, uint8_t arg0) {
T calcIrradiation(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcIrradiation"));
// arg0 = channel
if(NULL != iv) {
@ -931,7 +935,7 @@ static T calcIrradiation(Inverter<> *iv, uint8_t arg0) {
}
template<class T=float>
static T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0) {
T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcMaxPowerAcCh0"));
T acMaxPower = 0.0;
if(NULL != iv) {
@ -952,7 +956,7 @@ static T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0) {
}
template<class T=float>
static T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0) {
T calcMaxPowerDc(Inverter<> *iv, uint8_t arg0) {
DPRINTLN(DBG_VERBOSE, F("hmInverter.h:calcMaxPowerDc"));
// arg0 = channel
T dcMaxPower = 0.0;

1
src/hm/hmSystem.h

@ -18,6 +18,7 @@ class HmSystem {
void setup(uint32_t *timestamp, cfgInst_t *config, IApp *app) {
INVERTERTYPE::timestamp = timestamp;
INVERTERTYPE::generalConfig = config;
INVERTERTYPE::App = app;
//mInverter[0].app = app;
}

3
src/network/AhoyWifiEsp32.h

@ -43,8 +43,8 @@ class AhoyWifi : public AhoyNetwork {
if(mConnected) {
mConnected = false;
mOnNetworkCB(false);
mAp.enable();
MDNS.end();
begin();
}
break;
@ -59,7 +59,6 @@ class AhoyWifi : public AhoyNetwork {
mConnected = true;
ah::welcome(WiFi.localIP().toString(), F("Station"));
MDNS.begin(mConfig->sys.deviceName);
//MDNS.addServiceTxt("http", "tcp", "path", "/");
mOnNetworkCB(true);
}
break;

3
src/publisher/pubMqtt.h

@ -443,7 +443,8 @@ class PubMqtt {
snprintf(topic.data(), topic.size(), "%s/sensor/%s/total_%s/config", MQTT_DISCOVERY_PREFIX, node_id.c_str(), fields[fldTotal[mDiscovery.sub]]);
size_t size = measureJson(doc2) + 1;
serializeJson(doc2, buf.data(), size);
publish(topic.data(), buf.data(), true, false);
if(FLD_EVT != rec->assign[mDiscovery.sub].fieldId)
publish(topic.data(), buf.data(), true, false);
if(++mDiscovery.sub == ((!total) ? (rec->length) : 4)) {
mDiscovery.sub = 0;

2
src/web/Protection.h

@ -24,7 +24,7 @@ class Protection {
}
public:
Protection(Protection &other) = delete;
Protection(const Protection &other) = delete;
void operator=(const Protection &) = delete;
static Protection* getInstance(const char *pwd) {

1
src/web/html/colorBright.css

@ -12,6 +12,7 @@
--nav-bg: #333;
--primary: #006ec0;
--primary-disabled: #ccc;
--primary-hover: #044e86;
--secondary: #0072c8;
--nav-active: #555;

1
src/web/html/colorDark.css

@ -12,6 +12,7 @@
--nav-bg: #333;
--primary: #004d87;
--primary-disabled: #ccc;
--primary-hover: #023155;
--secondary: #0072c8;
--nav-active: #555;

4
src/web/html/index.html

@ -23,9 +23,9 @@
<h3>{#SUPPORT}:</h3>
<ul>
<li><a href="https://github.com/lumapu/ahoy/blob/main/src/CHANGES.md" target="_blank">{#CHANGELOG}</a></li>
<li>{#DISCUSS} <a href="https://discord.gg/WzhxEY62mB">Discord</a></li>
<li>{#DISCUSS} <a href="https://discord.gg/WzhxEY62mB" target="_blank">Discord</a></li>
<li>{#REPORT} <a href="https://github.com/lumapu/ahoy/issues" target="_blank">{#ISSUES}</a></li>
<li>{#CONTRIBUTE} <a href="https://github.com/lumapu/ahoy/blob/main/User_Manual.md" target="_blank">{#DOCUMENTATION}</a></li>
<li>{#CONTRIBUTE} <a href="https://docs.ahoydtu.de" target="_blank">{#DOCUMENTATION}</a></li>
<li><a href="https://fw.ahoydtu.de/fw/dev/" target="_blank">Download</a> & Test {#DEV_FIRMWARE}, <a href="https://github.com/lumapu/ahoy/blob/development03/src/CHANGES.md" target="_blank">{#DEV_CHANGELOG}</a></li>
<li>{#DON_MAKE} <a href="https://paypal.me/lupusch" target="_blank">{#DONATION}</a></li>
</ul>

20
src/web/html/setup.html

@ -321,8 +321,8 @@
<div class="col-12 col-sm-9">
<form id="form" method="POST" action="/upload" enctype="multipart/form-data" accept-charset="utf-8">
<div class="row">
<div class="col-12 col-sm-8 my-2"><input type="file" name="upload"></div>
<div class="col-12 col-sm-4 my-2"><input type="button" class="btn" value="Import" onclick="hide()"></div>
<div class="col-12 col-sm-8 my-2"><input type="file" id="importFileInput" name="upload"></div>
<div class="col-12 col-sm-4 my-2"><input type="button" id="importButton" class="btn" value="Import" onclick="hide()"></div>
</div>
</form>
</div>
@ -613,6 +613,22 @@
getAjax("/api/setup", apiCbMqtt, "POST", JSON.stringify(obj));
}
document.addEventListener('DOMContentLoaded', () => {
const fileInput = document.querySelector('#importFileInput');
const button = document.querySelector('#importButton');
button.disabled = true;
button.title = "Please select a file first";
fileInput.addEventListener('change', () => {
if (fileInput.value) {
button.disabled = false;
button.title = "";
} else {
button.disabled = true;
button.title = "Please select a file first";
}
});
});
function hide() {
document.getElementById("form").submit();
var e = document.getElementById("content");

8
src/web/html/style.css

@ -563,7 +563,13 @@ input.btn {
cursor: pointer;
}
input.btn:hover {
input.btn:disabled {
background-color: var(--primary-disabled);
color: #888;
cursor: not-allowed;
}
input.btn:not(:disabled):hover {
background-color: #044e86;
}

20
src/web/html/update.html

@ -12,8 +12,8 @@
<legend class="des">{#SELECT_FILE} (*.bin)</legend>
<p>{#INSTALLED_VERSION}:<br/><span id="version" style="background-color: var(--input-bg); padding: 7px; display: block; margin: 3px;"></span></p>
<form id="form" method="POST" action="/update" enctype="multipart/form-data" accept-charset="utf-8">
<input type="file" name="update">
<input type="button" class="btn my-4" value="{#BTN_UPDATE}" onclick="hide()">
<input type="file" id="uploadFileInput" name="update">
<input type="button" id="uploadButton" class="btn my-4" value="{#BTN_UPDATE}" onclick="hide()">
</form>
</fieldset>
<div class="row mt-4">
@ -23,6 +23,22 @@
</div>
{#HTML_FOOTER}
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
const fileInput = document.querySelector('#uploadFileInput');
const button = document.querySelector('#uploadButton');
button.disabled = true;
button.title = "Please select a file first";
fileInput.addEventListener('change', () => {
if (fileInput.value) {
button.disabled = false;
button.title = "";
} else {
button.disabled = true;
button.title = "Please select a file first";
}
});
});
var env;
function parseGeneric(obj) {
parseNav(obj)

Loading…
Cancel
Save