From 594eb2e61208e900766ddaa0b401d3848b3f73de Mon Sep 17 00:00:00 2001 From: wyattb Date: Fri, 2 Aug 2024 16:04:33 -0400 Subject: [PATCH] #172 added fault fix, battery page graphs now show all data, added reset button for graphs, cell voltage comp has decimal padding for whole numbers --- .../cell-temp-display.component.html | 4 +-- .../cell-temp-display.component.ts | 17 +++++----- .../cell-temp-graph.component.ts | 9 +++--- .../fault-display/fault-display.component.css | 2 +- .../fault-display.component.html | 4 +-- .../fault-display/fault-display.component.ts | 32 +++++++++---------- .../high-low-cell-display.component.html | 11 ++++--- .../high-low-cell-display.component.ts | 13 ++++++++ .../high-low-cell-graph.component.ts | 20 ++++++++---- .../pack-voltage-display.component.html | 4 +-- .../pack-voltage-display.component.ts | 9 ++++++ .../pack-voltage-graph.component.ts | 9 +++--- 12 files changed, 83 insertions(+), 51 deletions(-) diff --git a/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.html b/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.html index 2a6da959..56e39524 100644 --- a/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.html +++ b/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.html @@ -1,4 +1,4 @@ - + @@ -19,6 +19,6 @@ - + diff --git a/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.ts b/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.ts index 98144964..5a74b602 100644 --- a/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.ts +++ b/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-display/cell-temp-display.component.ts @@ -11,22 +11,23 @@ import { floatPipe } from 'src/utils/pipes.utils'; export default class CellTempDisplay { avgTemp: number = 0; maxTemp: number = 0; - - // -------- Commented out for now, until mobile view is implemented -----// - // mobileThreshold = 1000; - // isDesktop = window.innerWidth > this.mobileThreshold; - // @HostListener('window:resize', ['$event']) - // onResize() { - // this.isDesktop = window.innerWidth >= this.mobileThreshold; - // } + resetGraph: boolean = false; + resetGraphButton = { + onClick: () => { + this.resetGraph = true; + }, + icon: 'restart_alt' + }; constructor(private storage: Storage) {} ngOnInit() { this.storage.get(IdentifierDataType.CELL_TEMP_HIGH).subscribe((value) => { + this.resetGraph = false; //!!!! FOR REVIEW !!!!: is there a better way to do this reseting of the graph boolean? this.maxTemp = floatPipe(value.values[0]); }); this.storage.get(IdentifierDataType.CELL_TEMP_AVG).subscribe((value) => { + this.resetGraph = false; this.avgTemp = floatPipe(value.values[0]); }); } diff --git a/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-graph/cell-temp-graph.component.ts b/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-graph/cell-temp-graph.component.ts index 8d0e8725..4504ad62 100644 --- a/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-graph/cell-temp-graph.component.ts +++ b/angular-client/src/pages/charging-page/components/cell-temp/cell-temp-graph/cell-temp-graph.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import Storage from 'src/services/storage.service'; import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; import { GraphData } from 'src/utils/types.utils'; @@ -10,15 +10,16 @@ import { GraphData } from 'src/utils/types.utils'; }) export default class CellTempGraph implements OnInit { cellTempData: GraphData[] = []; + @Input() resetGraph: boolean = false; maxDataPoints = 100; constructor(private storage: Storage) {} ngOnInit() { this.storage.get(IdentifierDataType.CELL_TEMP_HIGH).subscribe((value) => { - this.cellTempData.push({ x: new Date().getTime(), y: parseInt(value.values[0]) }); - if (this.cellTempData.length >= 100) { - this.cellTempData.shift(); + if (this.resetGraph) { + this.cellTempData = []; } + this.cellTempData.push({ x: new Date().getTime(), y: parseInt(value.values[0]) }); }); } } diff --git a/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.css b/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.css index 9f6053ff..d7e78752 100644 --- a/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.css +++ b/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.css @@ -4,5 +4,5 @@ align-items: left; justify-content: left; padding-left: 10%; - overflow: hidden; + overflow-y: auto; } diff --git a/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.html b/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.html index 7db109f4..d8c61566 100644 --- a/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.html +++ b/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.html @@ -1,8 +1,8 @@ - +
- +
+ - + @@ -11,7 +11,7 @@ - + @@ -20,13 +20,14 @@ - + + - + diff --git a/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-display.component.ts b/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-display.component.ts index e1d2786f..baf907f0 100644 --- a/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-display.component.ts +++ b/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-display/high-low-cell-display.component.ts @@ -14,6 +14,13 @@ export default class HighLowCellDisplay { highCellVoltage: number = 0; mobileThreshold = 1000; isDesktop = window.innerWidth > this.mobileThreshold; + resetGraph: boolean = false; + resetGraphButton = { + onClick: () => { + this.resetGraph = true; + }, + icon: 'restart_alt' + }; constructor(private storage: Storage) {} @@ -24,10 +31,16 @@ export default class HighLowCellDisplay { ngOnInit() { this.storage.get(IdentifierDataType.VOLTS_LOW).subscribe((value) => { + if (this.resetGraph) { + this.resetGraph = false; + } this.lowCellVoltage = decimalPipe(value.values[0], 3); this.delta = decimalPipe((this.highCellVoltage - this.lowCellVoltage).toFixed(3), 3); }); this.storage.get(IdentifierDataType.VOLTS_HIGH).subscribe((value) => { + if (this.resetGraph) { + this.resetGraph = false; + } this.highCellVoltage = decimalPipe(value.values[0], 3); this.delta = decimalPipe((this.highCellVoltage - this.lowCellVoltage).toFixed(3), 3); }); diff --git a/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-graph/high-low-cell-graph.component.ts b/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-graph/high-low-cell-graph.component.ts index 44356ed6..2ca780ad 100644 --- a/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-graph/high-low-cell-graph.component.ts +++ b/angular-client/src/pages/charging-page/components/high-low-cell/high-low-cell-graph/high-low-cell-graph.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import Storage from 'src/services/storage.service'; import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; import { decimalPipe } from 'src/utils/pipes.utils'; @@ -13,20 +13,26 @@ export default class HighLowCellGraph implements OnInit { highVoltsData: GraphData[] = []; lowVoltsData: GraphData[] = []; maxDataPoints = 100; + @Input() resetGraph: boolean = false; constructor(private storage: Storage) {} ngOnInit() { this.storage.get(IdentifierDataType.VOLTS_HIGH).subscribe((value) => { - this.highVoltsData.push({ x: new Date().getTime(), y: decimalPipe(value.values[0]) }); - if (this.highVoltsData.length >= 100) { - this.highVoltsData.shift(); + if (this.resetGraph) { + this.resetData(); } + this.highVoltsData.push({ x: new Date().getTime(), y: decimalPipe(value.values[0]) }); }); this.storage.get(IdentifierDataType.VOLTS_LOW).subscribe((value) => { - this.lowVoltsData.push({ x: new Date().getTime(), y: decimalPipe(value.values[0]) }); - if (this.lowVoltsData.length >= 100) { - this.lowVoltsData.shift(); + if (this.resetGraph) { + this.resetData(); } + this.lowVoltsData.push({ x: new Date().getTime(), y: decimalPipe(value.values[0]) }); }); } + + resetData() { + this.lowVoltsData = []; + this.highVoltsData = []; + } } diff --git a/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.html b/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.html index e2c07785..c3bec610 100644 --- a/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.html +++ b/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.html @@ -1,8 +1,8 @@ - + - + diff --git a/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.ts b/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.ts index 617c0233..b627ed7f 100644 --- a/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.ts +++ b/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-display/pack-voltage-display.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { waitForDebugger } from 'inspector'; import Storage from 'src/services/storage.service'; import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; import { floatPipe } from 'src/utils/pipes.utils'; @@ -10,11 +11,19 @@ import { floatPipe } from 'src/utils/pipes.utils'; }) export default class PackVoltageDisplay { voltage: number = 0; + resetGraph: boolean = false; + resetGraphButton = { + onClick: () => { + this.resetGraph = true; + }, + icon: 'restart_alt' + }; constructor(private storage: Storage) {} ngOnInit() { this.storage.get(IdentifierDataType.PACK_VOLTAGE).subscribe((value) => { + this.resetGraph = false; this.voltage = floatPipe(value.values[0]); }); } diff --git a/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-graph/pack-voltage-graph.component.ts b/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-graph/pack-voltage-graph.component.ts index 93503753..b5dc1ede 100644 --- a/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-graph/pack-voltage-graph.component.ts +++ b/angular-client/src/pages/charging-page/components/pack-voltage/pack-voltage-graph/pack-voltage-graph.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import Storage from 'src/services/storage.service'; import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type'; import { GraphData } from 'src/utils/types.utils'; @@ -10,15 +10,16 @@ import { GraphData } from 'src/utils/types.utils'; }) export default class PackVoltageGraph implements OnInit { packVoltData: GraphData[] = []; + @Input() resetGraph: boolean = false; maxDataPoints = 100; constructor(private storage: Storage) {} ngOnInit() { this.storage.get(IdentifierDataType.PACK_VOLTAGE).subscribe((value) => { - this.packVoltData.push({ x: new Date().getTime(), y: parseInt(value.values[0]) }); - if (this.packVoltData.length >= 100) { - this.packVoltData.shift(); + if (this.resetGraph) { + this.packVoltData = []; } + this.packVoltData.push({ x: new Date().getTime(), y: parseInt(value.values[0]) }); }); } }