Skip to content

Commit 06bae41

Browse files
committed
bugfix: fix incorrect SPM value and improve formulas
1 parent 1f07c00 commit 06bae41

File tree

7 files changed

+13
-54
lines changed

7 files changed

+13
-54
lines changed

.DS_Store

0 Bytes
Binary file not shown.

InfiniLink.xcodeproj/project.pbxproj

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
E04396172D2A410100A13B90 /* DFUUpdaterCustom.swift in Sources */ = {isa = PBXBuildFile; fileRef = E04396162D2A410100A13B90 /* DFUUpdaterCustom.swift */; };
2424
E05046892D136F1E00FE4BCD /* DebugLogsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E05046882D136F1D00FE4BCD /* DebugLogsView.swift */; };
2525
E05999992CB25C5600D64E0B /* SleepView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E05999982CB25C5600D64E0B /* SleepView.swift */; };
26-
E059999C2CB2E56300D64E0B /* AlarmView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E059999B2CB2E56300D64E0B /* AlarmView.swift */; };
2726
E05999AC2CB2ED7100D64E0B /* repetitionscrolling.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E05999A92CB2ED7100D64E0B /* repetitionscrolling.ttf */; };
2827
E05999AD2CB2ED7100D64E0B /* open_sans_light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E05999A82CB2ED7100D64E0B /* open_sans_light.ttf */; };
2928
E05999AE2CB2ED7100D64E0B /* JetBrainsMono-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E05999A42CB2ED7100D64E0B /* JetBrainsMono-Light.ttf */; };
@@ -152,7 +151,6 @@
152151
E04396162D2A410100A13B90 /* DFUUpdaterCustom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DFUUpdaterCustom.swift; sourceTree = "<group>"; };
153152
E05046882D136F1D00FE4BCD /* DebugLogsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugLogsView.swift; sourceTree = "<group>"; };
154153
E05999982CB25C5600D64E0B /* SleepView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SleepView.swift; sourceTree = "<group>"; };
155-
E059999B2CB2E56300D64E0B /* AlarmView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlarmView.swift; sourceTree = "<group>"; };
156154
E05999A02CB2ED7100D64E0B /* 7-Segment.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "7-Segment.ttf"; sourceTree = "<group>"; };
157155
E05999A12CB2ED7100D64E0B /* BebasNeue-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BebasNeue-Regular.ttf"; sourceTree = "<group>"; };
158156
E05999A22CB2ED7100D64E0B /* JetBrainsMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "JetBrainsMono-Bold.ttf"; sourceTree = "<group>"; };
@@ -367,14 +365,6 @@
367365
path = Developer;
368366
sourceTree = "<group>";
369367
};
370-
E059999A2CB2E55500D64E0B /* Apps */ = {
371-
isa = PBXGroup;
372-
children = (
373-
E059999B2CB2E56300D64E0B /* AlarmView.swift */,
374-
);
375-
path = Apps;
376-
sourceTree = "<group>";
377-
};
378368
E059999F2CB2ED5D00D64E0B /* Fonts */ = {
379369
isa = PBXGroup;
380370
children = (
@@ -581,7 +571,6 @@
581571
isa = PBXGroup;
582572
children = (
583573
E0A7C09F2CB245F70042A12D /* Components */,
584-
E059999A2CB2E55500D64E0B /* Apps */,
585574
E0A7C0742CB0ECD10042A12D /* Settings */,
586575
E0B85D172CB6241000D85122 /* Exercise */,
587576
E0CD94CD2CC4A20F00DA53A2 /* Connect */,
@@ -842,7 +831,6 @@
842831
E0B85D5E2CB628E200D85122 /* ExerciseDetailView.swift in Sources */,
843832
E0A7C07D2CB1AD370042A12D /* MusicController.swift in Sources */,
844833
E05046892D136F1E00FE4BCD /* DebugLogsView.swift in Sources */,
845-
E059999C2CB2E56300D64E0B /* AlarmView.swift in Sources */,
846834
E09990982D77685A00B0FCAF /* StepMonthlyChartView.swift in Sources */,
847835
E0A7C06B2CB0DE4C0042A12D /* Weather.swift in Sources */,
848836
E0B85D6F2CB8CDC700D85122 /* Date+Extension.swift in Sources */,

InfiniLink/Core/Apps/AlarmView.swift

Lines changed: 0 additions & 18 deletions
This file was deleted.

InfiniLink/Core/DeviceView.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,6 @@ struct DeviceView: View {
199199
ListRowView(title: "Music", icon: "music.note", iconColor: .red)
200200
}
201201
}
202-
Section {
203-
/*
204-
NavigationLink {
205-
AlarmView()
206-
} label: {
207-
ListRowView(title: "Alarms", icon: "alarm.fill")
208-
}
209-
*/
210-
}
211202
if enableDeveloperMode {
212203
Section {
213204
NavigationLink {

InfiniLink/Core/StepsView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct StepsView: View {
3636
LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible())]) {
3737
let units = personalizationController.units == .imperial ? "mi" : "km"
3838
let distance = exerciseCalculator.calculateDistance(steps: steps())
39-
let stepsPerUnit = exerciseCalculator.stepsPerUnit()
39+
let stepsPerMinute = exerciseCalculator.stepsPerMinute(steps: steps())
4040

4141
DetailHeaderSubItemView(title: "Distance",
4242
value: String(format: "%.2f", distance),
@@ -49,7 +49,7 @@ struct StepsView: View {
4949
value: exerciseCalculator.secondsFormatted(seconds: exerciseCalculator.secondsForDistance(distance: distance)),
5050
icon: ("stopwatch", Color.primary))
5151
DetailHeaderSubItemView(title: "SPM",
52-
value: String(stepsPerUnit),
52+
value: String(stepsPerMinute),
5353
icon: ("shoeprints.fill", Color.blue)) {
5454
showInfoAlert = true
5555
}

InfiniLink/Localizable.xcstrings

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,6 @@
484484
},
485485
"Hello" : {
486486

487-
},
488-
"Hello, World!" : {
489-
490487
},
491488
"Hourly Chimes" : {
492489

InfiniLink/Utils/FitnessCalculator.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ enum Pace: Int {
4545

4646
var kmPerHour: Double {
4747
switch self {
48-
case .verySlowWalk: return 1.61
49-
case .slowWalk: return 3.22
50-
case .avgWalk: return 3.22
51-
case .briskWalk: return 6.44
52-
case .jog: return 8.047
53-
case .run: return 9.66
54-
case .fastRun: return 12.07
55-
case .veryFastRun: return 16.093
48+
case .verySlowWalk: return 1.6
49+
case .slowWalk: return 3.0
50+
case .avgWalk: return 5.0
51+
case .briskWalk: return 6.5
52+
case .jog: return 8.0
53+
case .run: return 9.5
54+
case .fastRun: return 12.0
55+
case .veryFastRun: return 16.0
5656
}
5757
}
5858
}
@@ -99,8 +99,9 @@ class FitnessCalculator {
9999

100100
func stepsPerMinute(steps: Int, pace: Pace = .avgWalk) -> Int {
101101
let distance = calculateDistance(steps: steps, pace: pace)
102-
let timeMinutes = (distance / (personalizationController.units == .metric ? pace.kmPerHour : pace.milesPerHour)) * 60.0
103-
102+
let speed = personalizationController.units == .metric ? pace.kmPerHour : pace.milesPerHour
103+
let timeMinutes = (distance / speed) * 60.0
104+
104105
guard steps > 0, timeMinutes > 0 else { return 0 }
105106

106107
let spm = Double(steps) / timeMinutes

0 commit comments

Comments
 (0)