mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-11 07:01:38 +02:00
potential fix of #526 duplicates in API /api/record/live
This commit is contained in:
parent
ed16cff06e
commit
4f962ff962
2 changed files with 8 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
||||||
## 0.5.63
|
## 0.5.63
|
||||||
* fix Update button protection (prevent double click #527)
|
* fix Update button protection (prevent double click #527)
|
||||||
* optimized scheduler #515 (thx @beegee3)
|
* optimized scheduler #515 (thx @beegee3)
|
||||||
|
* potential fix of #526 duplicates in API `/api/record/live`
|
||||||
|
|
||||||
## 0.5.62
|
## 0.5.62
|
||||||
* fix MQTT `status` update
|
* fix MQTT `status` update
|
||||||
|
|
|
@ -69,10 +69,10 @@ class RestApi {
|
||||||
else if(path == "setup") getSetup(root);
|
else if(path == "setup") getSetup(root);
|
||||||
else if(path == "setup/networks") getNetworks(root);
|
else if(path == "setup/networks") getNetworks(root);
|
||||||
else if(path == "live") getLive(root);
|
else if(path == "live") getLive(root);
|
||||||
else if(path == "record/info") getRecord(root, iv->getRecordStruct(InverterDevInform_All));
|
else if(path == "record/info") getRecord(root, InverterDevInform_All);
|
||||||
else if(path == "record/alarm") getRecord(root, iv->getRecordStruct(AlarmData));
|
else if(path == "record/alarm") getRecord(root, AlarmData);
|
||||||
else if(path == "record/config") getRecord(root, iv->getRecordStruct(SystemConfigPara));
|
else if(path == "record/config") getRecord(root, SystemConfigPara);
|
||||||
else if(path == "record/live") getRecord(root, iv->getRecordStruct(RealTimeRunData_Debug));
|
else if(path == "record/live") getRecord(root, RealTimeRunData_Debug);
|
||||||
else
|
else
|
||||||
getNotFound(root, F("http://") + request->host() + F("/api/"));
|
getNotFound(root, F("http://") + request->host() + F("/api/"));
|
||||||
|
|
||||||
|
@ -484,14 +484,16 @@ class RestApi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getRecord(JsonObject obj, record_t<> *rec) {
|
void getRecord(JsonObject obj, uint8_t recType) {
|
||||||
JsonArray invArr = obj.createNestedArray(F("inverter"));
|
JsonArray invArr = obj.createNestedArray(F("inverter"));
|
||||||
|
|
||||||
Inverter<> *iv;
|
Inverter<> *iv;
|
||||||
|
record_t<> *rec;
|
||||||
uint8_t pos;
|
uint8_t pos;
|
||||||
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i ++) {
|
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i ++) {
|
||||||
iv = mSys->getInverterByPos(i);
|
iv = mSys->getInverterByPos(i);
|
||||||
if(NULL != iv) {
|
if(NULL != iv) {
|
||||||
|
rec = iv->getRecordStruct(recType);
|
||||||
JsonArray obj2 = invArr.createNestedArray();
|
JsonArray obj2 = invArr.createNestedArray();
|
||||||
for(uint8_t j = 0; j < rec->length; j++) {
|
for(uint8_t j = 0; j < rec->length; j++) {
|
||||||
byteAssign_t *assign = iv->getByteAssign(j, rec);
|
byteAssign_t *assign = iv->getByteAssign(j, rec);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue