@@ -149,7 +149,7 @@ const CompactPowerEnergyCard = ({ onClick }: Props) => {
{/* Source power bar: L1 + L2 consumption + battery charging */}
{(() => {
const batteryCharging = Math.max(0, bat.power ?? 0)
- const barMax = 15000
+ const barMax = 12000
const l1Pct = ((consumption.l1 ?? 0) / barMax) * 100
const l2Pct = ((consumption.l2 ?? 0) / barMax) * 100
const batPct = (batteryCharging / barMax) * 100
@@ -157,9 +157,11 @@ const CompactPowerEnergyCard = ({ onClick }: Props) => {
- Source: {sourceLabel}
+ {sourceLabel}
{sourcePower > 0 && (
- {Math.round(sourcePower / 1000)}kW
+
+ {(sourcePower / 1000).toFixed(1)} kW
+
)}
{isGenerator && genStatus.conditionCode != null && genStatus.conditionCode > 0 && (
@@ -167,12 +169,47 @@ const CompactPowerEnergyCard = ({ onClick }: Props) => {
{genStatus.conditionName}
)}
- {isGenerator && genRunning && genStatus.runtimeFormatted && (
- Run: {genStatus.runtimeFormatted}
- )}
- {isGenerator && !genRunning && genDaily.todayFormatted && (
- Today: {genDaily.todayFormatted}
- )}
+
+ {isGenerator && genRunning && genStatus.runtimeFormatted && (
+
+ Run:
+ {genStatus.runtimeFormatted}
+
+ )}
+ {isGenerator && genRunning && genRamp.currentRunEnergy != null && genRamp.currentRunEnergy > 0 && (
+
+
+ {genRamp.currentRunEnergy.toFixed(1)} kWh
+
+
+ )}
+ {(isGenerator || onBattery) && !genRunning && genStatus.runtimeFormatted && (
+
+
+ {onBattery && !isGenerator ? "Gen Last: " : "Last Run: "}
+
+ {genStatus.runtimeFormatted}
+
+ )}
+ {(isGenerator || onBattery) &&
+ !genRunning &&
+ genRamp.lastRunEnergy != null &&
+ genRamp.lastRunEnergy > 0 && (
+
+
+ {genRamp.lastRunEnergy.toFixed(1)} kWh
+
+
+ )}
+ {(isGenerator || onBattery) && !genRunning && genDaily.todayFormatted && (
+
+
+ {onBattery && !isGenerator ? "Gen Today: " : "Today: "}
+
+ {genDaily.todayFormatted}
+
+ )}
+
{isGenerator && genStatus.timerFormatted && (
Timer: {genStatus.timerFormatted}
)}
@@ -200,43 +237,28 @@ const CompactPowerEnergyCard = ({ onClick }: Props) => {
title={`Battery: ${Math.round(batteryCharging)}W`}
/>
-
-
-
-
- L1 {Math.round(consumption.l1 ?? 0)}W
-
-
-
- L2 {Math.round(consumption.l2 ?? 0)}W
-
- {batteryCharging > 0 && (
-
-
- Bat {Math.round(batteryCharging)}W
-
- )}
-
- Total:{" "}
-
- {(consumption.total ?? 0) > 0 ? `${Math.round((consumption.total ?? 0) / 1000)}kW` : "--"}
-
-
-
-
-
- 15kW
-
+
+
+
+ L1 {Math.round(consumption.l1 ?? 0)}W
+
+
+ L2 {Math.round(consumption.l2 ?? 0)}W
+
+
+ Total:{" "}
+
+ {(consumption.total ?? 0) > 0 ? `${((consumption.total ?? 0) / 1000).toFixed(1)}kW` : "--"}
+
+
+ {batteryCharging > 0 && (
+
+
+ {"Battery: "}
+ {(batteryCharging / 1000).toFixed(1)}kW
+
+ )}
)
@@ -264,11 +286,6 @@ const CompactPowerEnergyCard = ({ onClick }: Props) => {
{(genRamp.overloadCount ?? 0) > 0 && (
OL:{genRamp.overloadCount}
)}
- {(consumption.inputTotal ?? 0) > 0 && (
-
- {Math.round((consumption.inputTotal ?? 0) / 1000)}kW
-
- )}
{(genRamp.state === 3 || genRamp.state === 4) && genRamp.rampTimeRemaining != null && (
diff --git a/venus-html5-app/src/app/Marine2/components/views/custom/CompactTideCard.tsx b/venus-html5-app/src/app/Marine2/components/views/custom/CompactTideCard.tsx
index 1d4231e..732197f 100644
--- a/venus-html5-app/src/app/Marine2/components/views/custom/CompactTideCard.tsx
+++ b/venus-html5-app/src/app/Marine2/components/views/custom/CompactTideCard.tsx
@@ -1,5 +1,6 @@
import React, { useMemo, useState, useEffect } from "react"
import { useTideService, useMeteoblueForecast, TidePoint } from "../../../utils/hooks/use-custom-mqtt"
+import { parseSunTimeTs } from "../../../utils/sun-utils"
import { cardBase, cardTitle, cardStatusBadge } from "./cardStyles"
import {
M_TO_FT,
@@ -28,28 +29,6 @@ interface CelestialEvent {
type UnifiedEvent = { kind: "tide"; data: TideEvent } | { kind: "celestial"; data: CelestialEvent }
-function parseSunMoonLocal(dateVal: unknown, timeStr: unknown): number | null {
- if (typeof timeStr !== "string" || !timeStr || timeStr === "---") return null
- let year: number, month: number, day: number
- if (typeof dateVal === "string") {
- const parts = dateVal.split("-")
- if (parts.length < 3) return null
- ;[year, month, day] = parts.map(Number)
- } else if (typeof dateVal === "number") {
- const d = new Date(dateVal > 1e10 ? dateVal : dateVal * 1000)
- year = d.getUTCFullYear()
- month = d.getUTCMonth() + 1
- day = d.getUTCDate()
- } else {
- return null
- }
- if (timeStr === "24:00") return Date.UTC(year, month - 1, day + 1, 0, 0) / 1000
- const tp = timeStr.split(":")
- if (tp.length < 2) return null
- const [h, m] = tp.map(Number)
- return Date.UTC(year, month - 1, day, h, m) / 1000
-}
-
interface CompactTideCardProps {
onClick: () => void
}
@@ -209,15 +188,15 @@ const CompactTideCard: React.FC = ({ onClick }) => {
const events: CelestialEvent[] = []
for (let i = 0; i < sunmoon.time.length; i++) {
const dateVal = sunmoon.time[i]
- const sunrise = parseSunMoonLocal(dateVal, sunmoon.sunrise?.[i])
+ const sunrise = parseSunTimeTs(dateVal, sunmoon.sunrise?.[i])
if (sunrise != null) {
events.push({ type: "sunrise", time: sunrise, isPast: sunrise <= nowTs })
}
- const sunset = parseSunMoonLocal(dateVal, sunmoon.sunset?.[i])
+ const sunset = parseSunTimeTs(dateVal, sunmoon.sunset?.[i])
if (sunset != null) {
events.push({ type: "sunset", time: sunset, isPast: sunset <= nowTs })
}
- const moonrise = parseSunMoonLocal(dateVal, sunmoon.moonrise?.[i])
+ const moonrise = parseSunTimeTs(dateVal, sunmoon.moonrise?.[i])
if (moonrise != null) {
events.push({
type: "moonrise",
@@ -227,7 +206,7 @@ const CompactTideCard: React.FC = ({ onClick }) => {
illumination: sunmoon.moonillumination?.[i],
})
}
- const moonset = parseSunMoonLocal(dateVal, sunmoon.moonset?.[i])
+ const moonset = parseSunTimeTs(dateVal, sunmoon.moonset?.[i])
if (moonset != null) {
events.push({
type: "moonset",
diff --git a/venus-html5-app/src/app/Marine2/components/views/custom/CompactWeatherCard.tsx b/venus-html5-app/src/app/Marine2/components/views/custom/CompactWeatherCard.tsx
index 3b05b4f..96bca7c 100644
--- a/venus-html5-app/src/app/Marine2/components/views/custom/CompactWeatherCard.tsx
+++ b/venus-html5-app/src/app/Marine2/components/views/custom/CompactWeatherCard.tsx
@@ -176,7 +176,7 @@ const CompactWeatherCard: React.FC = ({ onClick }) => {
{meteo.isConnected ? "Online" : "Offline"}
{meteo.isConnected ? (
-