Skip to content

Commit

Permalink
add customDurationInSecondsToCompleteOneRevolution to web ui
Browse files Browse the repository at this point in the history
  • Loading branch information
mwood77 committed Dec 29, 2024
1 parent cecccec commit c99d56e
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 9 deletions.
3 changes: 2 additions & 1 deletion data/assets/i18n/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"INTERNAL_CLOCK": "Interne Uhr",
"INTERNAL_CLOCK_BLURB": "Winderoo verfügt über eine interne Uhr (RTC), die beim Booten automatisch eingestellt wird.",
"INTERNAL_CLOCK_BLURB_2": "Wenn dies falsch ist, aktualisieren Sie bitte die Uhr unten.",
"LOADING": "Laden, bitte warten..."
"LOADING": "Laden, bitte warten...",
"SINGLE_ROTATION_TIMING": "Zeit für eine einzelne Umdrehung"
}
}
3 changes: 2 additions & 1 deletion data/assets/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"INTERNAL_CLOCK": "Internal Clock",
"INTERNAL_CLOCK_BLURB": "Winderoo has an internal clock (RTC), which is automatically set during boot.",
"INTERNAL_CLOCK_BLURB_2": "If this is incorrect, please update the clock beneath.",
"LOADING": "Loading, please wait..."
"LOADING": "Loading, please wait...",
"SINGLE_ROTATION_TIMING": "Time to complete a single rotation"
}
}
3 changes: 2 additions & 1 deletion data/assets/i18n/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"INTERNAL_CLOCK": "Reloj Interno",
"INTERNAL_CLOCK_BLURB": "Winderoo tiene un reloj interno (RTC), que se ajusta automáticamente durante el inicio.",
"INTERNAL_CLOCK_BLURB_2": "Si esto es incorrecto, por favor actualice el reloj a continuación.",
"LOADING": "Cargando, por favor espere..."
"LOADING": "Cargando, por favor espere...",
"SINGLE_ROTATION_TIMING": "Es hora de completar una sola rotación."
}
}
3 changes: 2 additions & 1 deletion data/assets/i18n/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"INTERNAL_CLOCK": "Horloge Interne",
"INTERNAL_CLOCK_BLURB": "Winderoo dispose d'une horloge interne (RTC), qui est automatiquement réglée au démarrage.",
"INTERNAL_CLOCK_BLURB_2": "Si cela est incorrect, veuillez mettre à jour l'horloge ci-dessous.",
"LOADING": "Chargement, veuillez patienter..."
"LOADING": "Chargement, veuillez patienter...",
"SINGLE_ROTATION_TIMING": "Temps nécessaire pour effectuer une seule rotation"
}
}
3 changes: 2 additions & 1 deletion data/assets/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"INTERNAL_CLOCK": "Relógio Interno",
"INTERNAL_CLOCK_BLURB": "Winderoo possui um relógio interno (RTC), que é ajustado automaticamente durante a inicialização.",
"INTERNAL_CLOCK_BLURB_2": "Se isso estiver incorreto, por favor, atualize o relógio abaixo.",
"LOADING": "Carregando, por favor aguarde..."
"LOADING": "Carregando, por favor aguarde...",
"SINGLE_ROTATION_TIMING": "Hora de completar uma única rotação"
}
}
3 changes: 2 additions & 1 deletion src/angular/osww-frontend/src/app/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface Update {
screenSleep: boolean;
customWindDuration: number;
customWindPauseDuration: number;
customDurationInSecondsToCompleteOneRevolution: number;
rtcSelectedHour: number;
rtcSelectedMinutes: number;
}
Expand All @@ -26,7 +27,6 @@ export interface Status {
direction: string;
hour: string;
minutes: string;
durationInSecondsToCompleteOneRevolution: number;
startTimeEpoch: number,
currentTimeEpoch: number;
estimatedRoutineFinishEpoch: number;
Expand All @@ -36,6 +36,7 @@ export interface Status {
screenEquipped: boolean;
customWindDuration: number;
customWindPauseDuration: number;
customDurationInSecondsToCompleteOneRevolution: number;
}

export interface WorldTimeAPI {
Expand Down
12 changes: 12 additions & 0 deletions src/angular/osww-frontend/src/app/settings/settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@
<input matSliderThumb [(ngModel)]="this.upload.customWindPauseDuration">
</mat-slider>
</div>

<div class="individual-setting">
<div class="">
{{ "SETTINGS.SINGLE_ROTATION_TIMING" | translate }}
</div>
<div class="individual-status-text">
{{ this.upload.customDurationInSecondsToCompleteOneRevolution }} {{ "SETTINGS.SECONDS" | translate }}
</div>
<mat-slider value="{{ this.upload.customDurationInSecondsToCompleteOneRevolution }}" min="1" max="16" step="1" discrete (input)="setcustomDurationInSecondsToCompleteOneRevolution($event)">
<input matSliderThumb [(ngModel)]="this.upload.customDurationInSecondsToCompleteOneRevolution">
</mat-slider>
</div>

<div class="individual-setting">
<div>
Expand Down
12 changes: 9 additions & 3 deletions src/angular/osww-frontend/src/app/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ export class SettingsComponent implements OnInit, AfterViewChecked {
rpd: 0,
hour: '00',
minutes: '00',
durationInSecondsToCompleteOneRevolution: 0,
startTimeEpoch: 0,
estimatedRoutineFinishEpoch: 0,
isTimerEnabledNum: 0,
screenSleep: false,
customWindDuration: 0,
customWindPauseDuration: 0,
customDurationInSecondsToCompleteOneRevolution: 0,
}

selectedHour: any;
Expand Down Expand Up @@ -137,13 +137,13 @@ export class SettingsComponent implements OnInit, AfterViewChecked {
this.upload.hour = data.hour;
this.upload.minutes = data.minutes;
this.wifiSignalIcon = this.getWifiSignalStrengthIcon(data.db *= -1);
this.upload.durationInSecondsToCompleteOneRevolution = data.durationInSecondsToCompleteOneRevolution;
this.upload.startTimeEpoch = data.startTimeEpoch;
this.upload.estimatedRoutineFinishEpoch = data.estimatedRoutineFinishEpoch;
this.upload.isTimerEnabledNum = data.timerEnabled;
this.upload.screenSleep = data.screenSleep;
this.screenEquipped = data.screenEquipped;
this.winderooInternalRTC = data.currentTimeEpoch;
this.upload.customDurationInSecondsToCompleteOneRevolution = data.customDurationInSecondsToCompleteOneRevolution;

if (data.customWindDuration) {
this.upload.customWindDuration = data.customWindDuration;
Expand Down Expand Up @@ -194,6 +194,11 @@ export class SettingsComponent implements OnInit, AfterViewChecked {
this.estimateDuration(this.upload.rpd);
}

setcustomDurationInSecondsToCompleteOneRevolution(event: any): void {
const customSingleRotationTime = event.value;
this.upload.customDurationInSecondsToCompleteOneRevolution = customSingleRotationTime;
}

convertSecondsToHumanReadable(seconds: number): { minutes: number, seconds: number } {
const minutes = Math.floor(seconds / 60);
const remainingSeconds = seconds % 60;
Expand Down Expand Up @@ -286,6 +291,7 @@ export class SettingsComponent implements OnInit, AfterViewChecked {
screenSleep: this.upload.screenSleep,
customWindDuration: this.upload.customWindDuration,
customWindPauseDuration: this.upload.customWindPauseDuration,
customDurationInSecondsToCompleteOneRevolution: this.upload.customDurationInSecondsToCompleteOneRevolution,
rtcSelectedHour: this.rtcSelectedHour,
rtcSelectedMinutes: this.rtcSelectedMinutes,
}
Expand Down Expand Up @@ -317,7 +323,7 @@ export class SettingsComponent implements OnInit, AfterViewChecked {
}

estimateDuration(rpd: number): void {
const totalSecondsSpentTurning = rpd * this.upload.durationInSecondsToCompleteOneRevolution;
const totalSecondsSpentTurning = rpd * this.upload.customDurationInSecondsToCompleteOneRevolution;
const totalNumberOfRestingPeriods = totalSecondsSpentTurning / this.upload.customWindDuration;
const totalRestDuration = totalNumberOfRestingPeriods * this.upload.customWindPauseDuration;

Expand Down

0 comments on commit c99d56e

Please sign in to comment.