Skip to content

Commit

Permalink
#172 - minor changes to comments and comp inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bracyw committed Sep 19, 2024
1 parent e9cccc7 commit fae1612
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
<current-display style="width: 80%; height: 122px" />
<pack-temp style="width: 80%; height: 122px" />
<cell-temp-display style="width: 80%; height: 210px" />
<info-background style="width: 80%">
<cell-temp-graph></cell-temp-graph>
</info-background>
<high-low-cell-display style="width: 80%; height: 200px" />
<info-background style="width: 80%">
<high-low-cell-graph></high-low-cell-graph>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ export default class ActiveStatus {

ngOnInit() {
this.storage.get(IdentifierDataType.BMS_MODE).subscribe((value) => {
const statusStateValue = floatPipe(value.values[0]);
if (this.isActive) {
if (!(floatPipe(value.values[0]) === 2)) {
if (!(statusStateValue === 2)) {
this.isActive = false;
this.stopTimer();
this.resetCurrentSecs();
}
} else if (floatPipe(value.values[0]) === 2) {
} else if (statusStateValue === 2) {
this.isActive = true;
this.startTimer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ export default class BalancingStatus {

ngOnInit() {
this.storage.get(IdentifierDataType.STATUS_BALANCING).subscribe((value) => {
const statusBalancingValue = floatPipe(value.values[0]);
if (this.isBalancing) {
if (!(floatPipe(value.values[0]) === 1)) {
if (!(statusBalancingValue === 1)) {
this.isBalancing = false;
this.stopTimer();
this.resetCurrentSecs();
}
} else if (floatPipe(value.values[0]) === 1) {
} else if (statusBalancingValue === 1) {
this.isBalancing = true;
this.startTimer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<!--TODO: (temp fix: padding-bottom) temp fix for voltage graph being centered (and not all the way on bottom of comp)-->
<!--if it is not desktop, we want to show graph seperately... TODO: need to figure out best logic for enforcing that this is done...
or just don't enforce -->
<cell-temp-graph style="width: 85%; padding-bottom: 30px" [resetGraph]="resetGraph" *ngIf="isDesktop"></cell-temp-graph>
<cell-temp-graph
style="width: 85%; padding-bottom: 30px"
[maxCellTempData]="cellTempData"
*ngIf="isDesktop"
></cell-temp-graph>
</hstack>
</info-background>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, HostListener } from '@angular/core';
import Storage from 'src/services/storage.service';
import { IdentifierDataType } from 'src/utils/enumerations/identifier-data-type';
import { floatPipe } from 'src/utils/pipes.utils';
import { GraphData } from 'src/utils/types.utils';

@Component({
selector: 'cell-temp-display',
Expand All @@ -14,10 +15,11 @@ export default class CellTempDisplay {
resetGraph: boolean = false;
resetGraphButton = {
onClick: () => {
this.resetGraph = true;
this.cellTempData = [];
},
icon: 'restart_alt'
};
cellTempData: GraphData[] = [];
mobileThreshold = 1200;
isDesktop = window.innerWidth > this.mobileThreshold;

Expand All @@ -30,8 +32,8 @@ export default class CellTempDisplay {

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.cellTempData.push({ x: new Date().getTime(), y: this.maxTemp });
});
this.storage.get(IdentifierDataType.CELL_TEMP_AVG).subscribe((value) => {
this.resetGraph = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
<graph-component [data]="cellTempData" graphContainerId="cellTempGraph" icon="speed" title="Max Cell Temp" color="#ffffff">
</graph-component>
<graph-component
[data]="maxCellTempData"
graphContainerId="cellTempGraph"
icon="speed"
title="Max Cell Temp"
color="#ffffff"
></graph-component>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
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';

@Component({
Expand All @@ -9,17 +8,7 @@ import { GraphData } from 'src/utils/types.utils';
styleUrls: ['./cell-temp-graph.component.css']
})
export default class CellTempGraph implements OnInit {
cellTempData: GraphData[] = [];
@Input() resetGraph: boolean = false;
maxDataPoints = 100;

@Input() maxCellTempData: GraphData[] = [];
constructor(private storage: Storage) {}
ngOnInit() {
this.storage.get(IdentifierDataType.CELL_TEMP_HIGH).subscribe((value) => {
if (this.resetGraph) {
this.cellTempData = [];
}
this.cellTempData.push({ x: new Date().getTime(), y: parseInt(value.values[0]) });
});
}
ngOnInit() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ export default class ChargingStatusComponent {

ngOnInit() {
this.storage.get(IdentifierDataType.CHARGING).subscribe((value) => {
const chargingControlValue = floatPipe(value.values[0]);
if (this.isCharging) {
if (floatPipe(value.values[0]) === 1) {
if (chargingControlValue === 1) {
this.isCharging = false;
this.stopTimer();
this.resetCurrentSecs();
}
} else if (floatPipe(value.values[0]) === 0) {
} else if (chargingControlValue === 0) {
this.isCharging = true;
this.startTimer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ export default class FaultDisplay {
if (faultType === FaultType.BMS) {
faultName = this.getBMSFaultName(parseInt(faultValue));
}
// current implementation doesn't need a specified case for charger faults
// (they have indiv binary id's)
if (this.faults.length >= 50) {
this.faults.pop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ export default class FaultedStatus {

ngOnInit() {
this.storage.get(IdentifierDataType.BMS_MODE).subscribe((value) => {
const statusStateValue = floatPipe(value.values[0]);
if (this.isFaulted) {
if (!(floatPipe(value.values[0]) === 3)) {
if (!(statusStateValue === 3)) {
this.isFaulted = false;
this.stopTimer();
this.resetCurrentSecs();
}
} else if (floatPipe(value.values[0]) === 3) {
} else if (statusStateValue === 3) {
this.isFaulted = true;
this.startTimer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
<typography variant="info-subtitle" content="High Cell" additionalStyles="fontSize:15px" />
</vstack>

<!--On desktop view we don't want the graph component to be in a horizontal stack-->
<high-low-cell-graph style="width: 75%; padding-bottom: 35px" [resetGraph]="resetGraph" *ngIf="isDesktop">
</high-low-cell-graph>
</hstack>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, HostListener } 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';
Expand Down
2 changes: 1 addition & 1 deletion scylla-server/src/socket/mock-proxy-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export default class MockProxyClient implements ProxyClient {
index = this.getRandomIndex(this.mockData.length);
numericalData = this.mockData[index];

// IF MORE THAN ONE VALUE IS GIVEN in the numerical data, it is assumed that only those values should be choosen from.
// if more than one value is given in the numerical data, it is assumed that only those values should be choosen from.
if (numericalData.vals.length > 1) {
numericalData.vals[0] = numericalData.vals[this.getRandomIndex(numericalData.vals.length)];
} else {
Expand Down

0 comments on commit fae1612

Please sign in to comment.