Skip to content

Commit

Permalink
Fixing chart axis
Browse files Browse the repository at this point in the history
(cherry picked from commit 65e7a8abac5eef66f73ef9285baa7d66581ce323)
  • Loading branch information
mathieucarbou committed Jun 24, 2024
1 parent e1d463a commit b23a84b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Website.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,9 @@ void YaSolR::WebsiteClass::updateCards() {

void YaSolR::WebsiteClass::updateCharts() {
// graphs
int now = static_cast<int>(millis() / 1000);
for (size_t i = 0; i < YASOLR_GRAPH_POINTS; i++) {
_historyX[i] = timeHistory[i] / 1000;
_historyX[i] = static_cast<int>((timeHistory[i] / 1000)) - now;
}

gridPowerHistory.copy(_gridPowerHistoryY);
Expand Down
1 change: 1 addition & 0 deletions src/init/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Mycila::Task initConfigTask("Init Config", [](void* params) {
dashboardCards.setEnabledWhen([]() { return ESPConnect.isConnected() && dashboard.hasClient() && !dashboard.isAsyncAccessInProgress() && !routingTask.isRunning(); });
dashboardCards.setInterval(751 * Mycila::TaskDuration::MILLISECONDS);
dashboardCharts.setEnabledWhen([]() { return ESPConnect.isConnected() && dashboard.hasClient() && !dashboard.isAsyncAccessInProgress() && !routingTask.isRunning(); });
dashboardCharts.setInterval(1000 * Mycila::TaskDuration::MILLISECONDS);
displayTask.setEnabledWhen([]() { return display.isEnabled(); });
displayTask.setInterval(293 * Mycila::TaskDuration::MILLISECONDS);
ds18Task.setEnabledWhen([]() { return ds18Sys.isEnabled() || ds18O1.isEnabled() || ds18O2.isEnabled(); });
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/Dashboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Mycila::Task dashboardCards("Dashboard", [](void* params) {
dashboard.sendUpdates();
});

Mycila::Task dashboardCharts("Dashboard Charts", Mycila::TaskType::ONCE, [](void* params) {
Mycila::Task dashboardCharts("Dashboard Charts", [](void* params) {
YaSolR::Website.updateCharts();
dashboard.sendUpdates();
});
1 change: 0 additions & 1 deletion src/tasks/Router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Mycila::Task routingTask("Routing", Mycila::TaskType::ONCE, [](void* params) {
gridPowerHistory.add(gridMetrics.power);
routedPowerHistory.add(routerMetrics.power);
routerTHDiHistory.add(routerMetrics.thdi * 100);
dashboardCharts.resume();

float virtualGridPower = gridMetrics.power - routerMetrics.power;

Expand Down

0 comments on commit b23a84b

Please sign in to comment.