fixed one bug reports and one feature request
This commit is contained in:
parent
a2a2e2a67f
commit
c5016a376b
@ -98,7 +98,7 @@ size_t WebApiDatabaseClass::readchunk(uint8_t* buffer, size_t maxLen, size_t ind
|
|||||||
*pr++ = '[';
|
*pr++ = '[';
|
||||||
}
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
r = f.read((uint8_t*)&d, sizeof(pvData)); // read from database
|
r = f.read(reinterpret_cast<uint8_t*>(&d), sizeof(pvData)); // read from database
|
||||||
if (r <= 0) {
|
if (r <= 0) {
|
||||||
if (last) {
|
if (last) {
|
||||||
f.close();
|
f.close();
|
||||||
@ -115,7 +115,7 @@ size_t WebApiDatabaseClass::readchunk(uint8_t* buffer, size_t maxLen, size_t ind
|
|||||||
} else {
|
} else {
|
||||||
*pr++ = ',';
|
*pr++ = ',';
|
||||||
}
|
}
|
||||||
int len = sprintf((char*)pr, "[%d,%d,%d,%d,%f]",
|
int len = snprintf(reinterpret_cast<char*>(pr), maxLen, "[%d,%d,%d,%d,%f]",
|
||||||
d.tm_year, d.tm_mon, d.tm_mday, d.tm_hour, d.energy * 1e3);
|
d.tm_year, d.tm_mon, d.tm_mday, d.tm_hour, d.energy * 1e3);
|
||||||
if (len >= 0) {
|
if (len >= 0) {
|
||||||
pr += len;
|
pr += len;
|
||||||
@ -175,7 +175,7 @@ size_t WebApiDatabaseClass::readchunkHour(uint8_t* buffer, size_t maxLen, size_t
|
|||||||
*pr++ = '[';
|
*pr++ = '[';
|
||||||
}
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
r = f.read((uint8_t*)&d, sizeof(pvData)); // read from database
|
r = f.read(reinterpret_cast<uint8_t*>(&d), sizeof(pvData)); // read from database
|
||||||
if (r <= 0) {
|
if (r <= 0) {
|
||||||
if (last) {
|
if (last) {
|
||||||
f.close();
|
f.close();
|
||||||
@ -197,7 +197,7 @@ size_t WebApiDatabaseClass::readchunkHour(uint8_t* buffer, size_t maxLen, size_t
|
|||||||
cd.dd[1] = d.tm_mday;
|
cd.dd[1] = d.tm_mday;
|
||||||
cd.dd[0] = d.tm_hour;
|
cd.dd[0] = d.tm_hour;
|
||||||
// MessageOutput.println(cd,16);
|
// MessageOutput.println(cd,16);
|
||||||
if (cd.dh >= startdate.dh) {
|
if ((cd.dh >= startdate.dh) && (oldenergy > 0.0)) {
|
||||||
valid = true;
|
valid = true;
|
||||||
} else
|
} else
|
||||||
oldenergy = d.energy;
|
oldenergy = d.energy;
|
||||||
@ -205,9 +205,10 @@ size_t WebApiDatabaseClass::readchunkHour(uint8_t* buffer, size_t maxLen, size_t
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
} else
|
} else {
|
||||||
*pr++ = ',';
|
*pr++ = ',';
|
||||||
int len = sprintf((char*)pr, "[%d,%d,%d,%d,%f]",
|
}
|
||||||
|
int len = snprintf(reinterpret_cast<char*>(pr), maxLen, "[%d,%d,%d,%d,%f]",
|
||||||
d.tm_year, d.tm_mon, d.tm_mday, d.tm_hour,
|
d.tm_year, d.tm_mon, d.tm_mday, d.tm_hour,
|
||||||
(d.energy - oldenergy) * 1e3);
|
(d.energy - oldenergy) * 1e3);
|
||||||
oldenergy = d.energy;
|
oldenergy = d.energy;
|
||||||
@ -242,7 +243,7 @@ size_t WebApiDatabaseClass::readchunkDay(uint8_t* buffer, size_t maxLen, size_t
|
|||||||
*pr++ = '[';
|
*pr++ = '[';
|
||||||
}
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
r = f.read((uint8_t*)&d, sizeof(pvData)); // read from database
|
r = f.read(reinterpret_cast<uint8_t*>(&d), sizeof(pvData)); // read from database
|
||||||
if (r <= 0) {
|
if (r <= 0) {
|
||||||
if (last) {
|
if (last) {
|
||||||
f.close();
|
f.close();
|
||||||
@ -255,22 +256,24 @@ size_t WebApiDatabaseClass::readchunkDay(uint8_t* buffer, size_t maxLen, size_t
|
|||||||
last = true;
|
last = true;
|
||||||
if (!first)
|
if (!first)
|
||||||
*pr++ = ',';
|
*pr++ = ',';
|
||||||
int len = sprintf((char*)pr, "[%d,%d,%d,%d,%f]",
|
int len = snprintf(reinterpret_cast<char*>(pr), maxLen, "[%d,%d,%d,%d,%f]",
|
||||||
endofday.tm_year, endofday.tm_mon, endofday.tm_mday, endofday.tm_hour,
|
endofday.tm_year, endofday.tm_mon, endofday.tm_mday, endofday.tm_hour,
|
||||||
(endofday.energy - startenergy) * 1e3);
|
(endofday.energy - startenergy) * 1e3);
|
||||||
pr += len;
|
pr += len;
|
||||||
*pr++ = ']';
|
*pr++ = ']';
|
||||||
return (pr - buffer); // last chunk
|
return (pr - buffer); // last chunk
|
||||||
}
|
}
|
||||||
if (endofday.tm_year == 0) {
|
if (startenergy == 0.0) {
|
||||||
startenergy = d.energy;
|
if (d.energy > 0.0) {
|
||||||
|
startenergy = d.energy;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (endofday.tm_mday != d.tm_mday) { // next day
|
if (endofday.tm_mday != d.tm_mday) { // next day
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
} else
|
} else
|
||||||
*pr++ = ',';
|
*pr++ = ',';
|
||||||
int len = sprintf((char*)pr, "[%d,%d,%d,%d,%f]",
|
int len = snprintf(reinterpret_cast<char*>(pr), maxLen, "[%d,%d,%d,%d,%f]",
|
||||||
endofday.tm_year, endofday.tm_mon, endofday.tm_mday, endofday.tm_hour,
|
endofday.tm_year, endofday.tm_mon, endofday.tm_mday, endofday.tm_hour,
|
||||||
(endofday.energy - startenergy) * 1e3);
|
(endofday.energy - startenergy) * 1e3);
|
||||||
startenergy = endofday.energy;
|
startenergy = endofday.energy;
|
||||||
|
|||||||
@ -2,6 +2,14 @@
|
|||||||
<BasePage :title="$t('home.LiveData')" :isLoading="dataLoading" :isWideScreen="true">
|
<BasePage :title="$t('home.LiveData')" :isLoading="dataLoading" :isWideScreen="true">
|
||||||
<HintView :hints="liveData.hints" />
|
<HintView :hints="liveData.hints" />
|
||||||
<InverterTotalInfo :totalData="liveData.total" /><br />
|
<InverterTotalInfo :totalData="liveData.total" /><br />
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<BarChart />
|
||||||
|
<CalendarChart />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row gy-3">
|
<div class="row gy-3">
|
||||||
<div class="col-sm-3 col-md-2" :style="[inverterData.length == 1 ? { 'display': 'none' } : {}]">
|
<div class="col-sm-3 col-md-2" :style="[inverterData.length == 1 ? { 'display': 'none' } : {}]">
|
||||||
<div class="nav nav-pills row-cols-sm-1" id="v-pills-tab" role="tablist" aria-orientation="vertical">
|
<div class="nav nav-pills row-cols-sm-1" id="v-pills-tab" role="tablist" aria-orientation="vertical">
|
||||||
@ -16,14 +24,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<BarChart />
|
|
||||||
<CalendarChart />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-content" id="v-pills-tabContent" :class="{
|
<div class="tab-content" id="v-pills-tabContent" :class="{
|
||||||
'col-sm-9 col-md-10': inverterData.length > 1,
|
'col-sm-9 col-md-10': inverterData.length > 1,
|
||||||
|
|||||||
7048
webapp/yarn.lock
7048
webapp/yarn.lock
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user