Skip to content

Commit

Permalink
web: fix VAC calculation when lost grid because of vact too high
Browse files Browse the repository at this point in the history
  • Loading branch information
hoang-rio committed Jan 24, 2025
1 parent 658e597 commit acefbb9
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 18 deletions.
18 changes: 12 additions & 6 deletions web_viewer/fe_src/src/components/Grid.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import { useMemo } from "react";
import { ICProps } from "../Intefaces";
import GeneralValue from "./GeneralValue";

export default function Grid({ inverterData, isSocketConnected }: ICProps) {
const vac = useMemo(() => {
if (isSocketConnected) {
const vac = (inverterData.vacr || inverterData.vacs || inverterData.vact) / 10;
if (vac > 300) {
return 0;
}
return vac;
}
return 0;
}, [inverterData.vacr, inverterData.vacs, inverterData.vact, isSocketConnected]);
return (
<div className="grid flex-1 row align-center justify-flex-end">
<div className="row arrows">
Expand Down Expand Up @@ -57,12 +68,7 @@ export default function Grid({ inverterData, isSocketConnected }: ICProps) {
unit=" W"
/>
<GeneralValue
value={
isSocketConnected
? (inverterData.vacr || inverterData.vacs || inverterData.vact) /
10
: 0
}
value={vac}
unit=" Vac"
/>
<GeneralValue
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
import{j as e}from"./index-DM8DYVFa.js";function l({value:r,unit:s,className:n}){return e.jsxs("div",{className:`${n||""} general-value`,children:[e.jsx("strong",{children:r}),s]})}export{l as G};
import{j as e}from"./index-DtDjYLyN.js";function l({value:r,unit:s,className:n}){return e.jsxs("div",{className:`${n||""} general-value`,children:[e.jsx("strong",{children:r}),s]})}export{l as G};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit acefbb9

Please sign in to comment.