From bcf9dc10a4133df0e858dd77cd57d50d8ee1e0da Mon Sep 17 00:00:00 2001 From: HakkaNoodles Date: Sat, 6 Mar 2021 20:36:52 -0500 Subject: [PATCH 1/2] Update Data.tsx --- client/src/components/Data.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/src/components/Data.tsx b/client/src/components/Data.tsx index 025ac30..a01ce90 100644 --- a/client/src/components/Data.tsx +++ b/client/src/components/Data.tsx @@ -6,7 +6,7 @@ import { CaelusState } from "../store/reducers"; import Block from "./Block"; import BlockHeader from "./BlockHeader"; -import PandidBoxed from "../images/pandidboxed.png"; +import NitrousPID from "../images/nitrouspid.png"; const VALVE_MAP = { 1: "OPEN", @@ -65,6 +65,8 @@ const Data = () => { }; }); + + const blockStyle = "rounded-lg m-1 p-4 bg-gray-100"; const abortStyle = "animate-ping rounded-lg m-1 p-4 bg-pink-300"; const groupHeaderStyle = "font-bold mb-1"; @@ -89,9 +91,9 @@ const Data = () => { className="flexFont" > pandidboxed {Object.entries(SENSOR_TEXT_PADDING).map(([sensor, padding]) => ( @@ -143,7 +145,7 @@ const Data = () => {

From 53aa0c3829e73ec69d365a793ff7695c5fea70d1 Mon Sep 17 00:00:00 2001 From: HakkaNoodles Date: Sun, 7 Mar 2021 16:37:49 -0500 Subject: [PATCH 2/2] Color Change Idk whatever --- client/src/components/Data.tsx | 5 ++++- client/src/config.json | 8 ++++---- client/src/lib/getColor.ts | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/client/src/components/Data.tsx b/client/src/components/Data.tsx index a01ce90..c50b07b 100644 --- a/client/src/components/Data.tsx +++ b/client/src/components/Data.tsx @@ -1,6 +1,8 @@ import React from "react"; +import { StatsState } from "../store/reducers/stats"; import { useSelector } from "react-redux"; import getColor from "../lib/getColor"; +import sensorColor from "../lib/getColor"; import stylizeName from "../lib/camelize"; import { CaelusState } from "../store/reducers"; @@ -62,6 +64,7 @@ const Data = () => { ? [] : [["", state.data.general.heartbeat_status]], mode: state.data.general.mode, + Stage: state.data.general.stage, }; }); @@ -145,7 +148,7 @@ const Data = () => {

diff --git a/client/src/config.json b/client/src/config.json index 48f8c20..b5efbd3 100644 --- a/client/src/config.json +++ b/client/src/config.json @@ -206,22 +206,22 @@ "safe": [100, 500], "warn": [50, 550], "critical": [0, 600], - "waiting": { + "waiting": { "safe": [100, 500], "warn": [50, 550], "critical": [0, 600] }, - "pressurization": { + "pressurization": { "safe": [100, 500], "warn": [50, 550], "critical": [0, 600] }, - "autosequence": { + "autosequence": { "safe": [100, 500], "warn": [50, 550], "critical": [0, 600] }, - "postburn": { + "postburn": { "safe": [100, 500], "warn": [50, 550], "critical": [0, 600] diff --git a/client/src/lib/getColor.ts b/client/src/lib/getColor.ts index 1f0743b..964ee2a 100644 --- a/client/src/lib/getColor.ts +++ b/client/src/lib/getColor.ts @@ -1,4 +1,6 @@ import caelusLogger from "./caelusLogger"; +import stats from "../store/reducers/stats"; +import config from "../config.json"; const getColor = (status: any) => { if (status.length === 0) { @@ -17,4 +19,18 @@ const getColor = (status: any) => { } }; +const sensorColor = (sensor, stage) => { + var measure = sensor.measured; + var stages = config.sensors.list.pressure.sensor.boundaries.stage; + + if (measure >= stages.safe[0] && measure <= stages.safe[1]) return "green"; + else if (measure >= stages.warn[0] && measure <= stages.warn[1]) return "orange"; + else if (measure >= stages.critical[0] && measure <= stages.critical[1]) return "red"; + + //go into state and find the sensor + //based on stage, check if value is in safe, warn, or critical + +}; + export default getColor; +export default sensorColor;