Wrong call for tatget temp, should be just target

This commit is contained in:
P43YM
2025-02-27 17:06:59 +03:00
parent 5dd76c9168
commit 54095892e1

View File

@@ -975,10 +975,10 @@
console.log(error);
}
//График
let equithermChart;
//График
let equithermChart;
async function initChart() {
async function initChart() {
try {
const response = await fetch("/api/settings", {
cache: "no-cache",
@@ -992,7 +992,7 @@ async function initChart() {
const result = await response.json();
//График переменные
const targetTemp = result?.heating?.target_temp ?? 24;
const targetTemp = result?.heating?.target ?? 24;
const maxOut = result?.heating?.maxTemp ?? 90;
const Kn = result?.equitherm?.n_factor ?? 1;
const Ke = result?.equitherm?.e_factor ?? 1.3;
@@ -1079,10 +1079,10 @@ async function initChart() {
} catch (error) {
console.log(error);
}
}
}
// Обновление графика
function updateChart(formData) {
// Обновление графика
function updateChart(formData) {
if (!equithermChart) return;
fetch("/api/settings", {
@@ -1091,7 +1091,7 @@ function updateChart(formData) {
})
.then(response => response.json())
.then(result => {
const targetTemp = result?.heating?.target_temp ?? 24;
const targetTemp = result?.heating?.target ?? 24;
const maxOut = result?.heating?.maxTemp ?? 90;
const Kn = parseFloat(formData.get('equitherm[n_factor]')) || 1;
const Ke = parseFloat(formData.get('equitherm[e_factor]')) || 1.3;
@@ -1134,7 +1134,7 @@ function updateChart(formData) {
updateChart(formData);
});
// Слушаем кнопку сохранить
// Слушаем кнопку сохранить
const equithermSection = document.querySelector('details');
const saveButton = equithermSection.querySelector('button[data-i18n="button.save"]');
saveButton.addEventListener('click', () => {
@@ -1143,8 +1143,8 @@ function updateChart(formData) {
updateChart(formData);
});
// инициализируем
initChart();
// инициализируем
initChart();
});