From cad5e9d287c3eabeae106e884f861a8b80272783 Mon Sep 17 00:00:00 2001 From: Muhammad Izza Alfiansyah Date: Tue, 9 Jul 2024 14:54:53 +0700 Subject: [PATCH] fixed bug display on before running and remove console --- microcontroller/sketch_apr22a/sketch_apr22a.ino | 17 ++++++++++------- website/src/App.tsx | 2 -- website/src/pages/Index.tsx | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/microcontroller/sketch_apr22a/sketch_apr22a.ino b/microcontroller/sketch_apr22a/sketch_apr22a.ino index d6fac5c..4a24182 100644 --- a/microcontroller/sketch_apr22a/sketch_apr22a.ino +++ b/microcontroller/sketch_apr22a/sketch_apr22a.ino @@ -329,6 +329,7 @@ void loop(){ if (tickDiffSecond == (order / 4.0 * 4)) { lcd.clear(); lcd.setCursor(cursorPositions[i][0], cursorPositions[i][1]); + lcd.print("Aku siap!"); } } } @@ -477,16 +478,18 @@ void runFermentasi() { int waktuAkhirHistori = dataHistori[0]["waktu_akhir"]; int waktuAwal = dataPengujianAwal["created_time"]; - if (waktuAwal <= waktuAkhirHistori) { - bool historiTerakhirBerhasil = (bool) dataHistori[0]["berhasil"]; + if (dataPengujian.length() > 0) { + if (waktuAwal <= waktuAkhirHistori) { + bool historiTerakhirBerhasil = (bool) dataHistori[0]["berhasil"]; - if (historiTerakhirBerhasil) { - status = "Matang"; + if (historiTerakhirBerhasil) { + status = "Matang"; + } else { + status = "Gagal"; + } } else { - status = "Gagal"; + cekKematangan(); } - } else { - cekKematangan(); } insertKondisiTapai(); diff --git a/website/src/App.tsx b/website/src/App.tsx index 52fbe75..d299faa 100644 --- a/website/src/App.tsx +++ b/website/src/App.tsx @@ -139,8 +139,6 @@ export default function (props: JSX.HTMLAttributes) { // .order("created_time", { ascending: false }) // .limit(1); - console.log(lastData1![0], lastData2![0]); - if (lastData1![0] == lastData2![0]) { alert("Device offline!"); } else if (lastData1![0].created_time == lastData2![0].created_time) { diff --git a/website/src/pages/Index.tsx b/website/src/pages/Index.tsx index bcf5ce3..030f4a3 100644 --- a/website/src/pages/Index.tsx +++ b/website/src/pages/Index.tsx @@ -80,7 +80,7 @@ export default function () { data.forEach((item) => { setKadarGas((val) => { - val.push(item.kadar_gas.toString().slice(0, 4)); + val.push(item.kadar_gas); return val; }); @@ -177,7 +177,7 @@ export default function () { tooltip: { callbacks: { label(tooltipItem) { - return "Kadar Gas: " + tooltipItem.parsed.y + "%"; + return "Kadar Gas: " + tooltipItem.parsed.y.toFixed(2) + "%"; }, }, },