Skip to content

Commit

Permalink
0.8.111
Browse files Browse the repository at this point in the history
* merge PR: Disable upload and import buttons when no file is selected #1586 #1519
  • Loading branch information
lumapu committed Apr 17, 2024
1 parent fd8c9e2 commit 388cd89
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 33 deletions.
1 change: 1 addition & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* 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
Expand Down
38 changes: 21 additions & 17 deletions src/hm/hmInverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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};


/**
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/hm/hmSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/web/Protection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 3 additions & 7 deletions src/web/html/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -612,23 +612,19 @@
var obj = {cmd: "discovery_cfg", token: "*"}
getAjax("/api/setup", apiCbMqtt, "POST", JSON.stringify(obj));
}
// Wait for the DOM to be fully loaded

document.addEventListener('DOMContentLoaded', () => {
// Get references to the file input and button elements
const fileInput = document.querySelector('#importFileInput');
const button = document.querySelector('#importButton');
// Initially disable the button
button.disabled = true;
button.title = "Please select a file first";
// Listen for changes on the file input
fileInput.addEventListener('change', () => {
// Enable or disable the button based on whether a file is selected
if (fileInput.value) {
button.disabled = false;
button.title = ""; // Clear the tooltip when a file is selected
button.title = "";
} else {
button.disabled = true;
button.title = "Please select a file first"; // Show the tooltip when no file is selected
button.title = "Please select a file first";
}
});
});
Expand Down
11 changes: 3 additions & 8 deletions src/web/html/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,18 @@
</div>
{#HTML_FOOTER}
<script type="text/javascript">
// Wait for the DOM to be fully loaded
document.addEventListener('DOMContentLoaded', () => {
// Get references to the file input and button elements
const fileInput = document.querySelector('#uploadFileInput');
const button = document.querySelector('#uploadButton');
// Initially disable the button
button.disabled = true;
button.title = "Please select a file first"; // Show the tooltip when no file is selected
// Listen for changes on the file input
button.title = "Please select a file first";
fileInput.addEventListener('change', () => {
// Enable or disable the button based on whether a file is selected
if (fileInput.value) {
button.disabled = false;
button.title = ""; // Clear the tooltip when a file is selected
button.title = "";
} else {
button.disabled = true;
button.title = "Please select a file first"; // Show the tooltip when no file is selected
button.title = "Please select a file first";
}
});
});
Expand Down

0 comments on commit 388cd89

Please sign in to comment.