Skip to content

Commit

Permalink
Remove local stats from bluetooth connect view as they don't update
Browse files Browse the repository at this point in the history
  • Loading branch information
garthvh committed Sep 22, 2024
1 parent 25143dd commit 2f7b087
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 76 deletions.
33 changes: 0 additions & 33 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,6 @@
},
"%@%%" : {

},
"%@%% %@%%" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "%1$@%% %2$@%%"
}
}
}
},
"%@°F" : {

Expand Down Expand Up @@ -1428,16 +1418,6 @@
},
"Bad" : {

},
"Bad Packets: %d %@%%" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Bad Packets: %1$d %2$@%%"
}
}
}
},
"Bandwidth" : {

Expand Down Expand Up @@ -16085,16 +16065,6 @@
},
"Override automatic OLED screen detection." : {

},
"Packets: Sent: %d Received: %d" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Packets: Sent: %1$d Received: %2$d"
}
}
}
},
"password" : {
"localizations" : {
Expand Down Expand Up @@ -22325,9 +22295,6 @@
}
}
}
},
"Uptime: %@" : {

},
"Use a PWM output (like the RAK Buzzer) for tunes instead of an on/off output. This will ignore the output, output duration and active settings and use the device config buzzer GPIO option instead." : {

Expand Down
43 changes: 0 additions & 43 deletions Meshtastic/Views/Bluetooth/Connect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct Connect: View {
@State var invalidFirmwareVersion = false
@State var liveActivityStarted = false
@State var selectedPeripherialId = ""
@State var localStats: TelemetryEntity?

init () {
let notificationCenter = UNUserNotificationCenter.current()
Expand Down Expand Up @@ -91,45 +90,6 @@ struct Connect: View {
}
}
}
VStack {
if localStats != nil {
Divider()
if localStats?.numTotalNodes ?? 0 >= 100 {
Text("\(String(format: "Connected: %d nodes online", localStats?.numOnlineNodes ?? 0))")
.font(.callout)
.fontWeight(.medium)
.foregroundStyle(.secondary)
.fixedSize()
} else {
Text("\(String(format: "Connected: %d of %d nodes online", localStats?.numOnlineNodes ?? 0, localStats?.numTotalNodes ?? 0))")
.font(.callout)
.fontWeight(.medium)
.foregroundStyle(.secondary)
.fixedSize()
}
Text("\(String(format: "Ch. Util: %.2f", localStats?.channelUtilization ?? 0))% \(String(format: "Airtime: %.2f", localStats?.airUtilTx ?? 0))%")
.font(.caption)
.fontWeight(.medium)
.foregroundStyle(.secondary)
Text("Packets: Sent: \(localStats?.numPacketsTx ?? 0) Received: \(localStats?.numPacketsRx ?? 0)")
.font(.caption)
.fontWeight(.medium)
.foregroundStyle(.secondary)
let errorRate = (Double(localStats?.numPacketsRxBad ?? -1) / Double(localStats?.numPacketsRx ?? -1)) * 100
Text("Bad Packets: \(localStats?.numPacketsRxBad ?? 0) \(String(format: "Error Rate: %.2f", errorRate))%")
.font(.caption)
.fontWeight(.medium)
.foregroundStyle(.secondary)
.fixedSize()
let now = Date.now
let later = now + TimeInterval(Double(localStats?.numPacketsRxBad ?? 0))
let uptime = (now..<later).formatted(.components(style: .narrow))
Text("Uptime: \(uptime)")
.font(.caption)
.fontWeight(.medium)
.foregroundStyle(.secondary)
}
}
}
.font(.caption)
.foregroundColor(Color.gray)
Expand Down Expand Up @@ -350,9 +310,6 @@ struct Connect: View {
.onChange(of: (self.bleManager.invalidVersion)) { _ in
invalidFirmwareVersion = self.bleManager.invalidVersion
}
.onChange(of: [node?.telemetries]) { _ in
localStats = node?.telemetries?.filtered(using: NSPredicate(format: "metricsType == 4")).lastObject as? TelemetryEntity
}
.onChange(of: (self.bleManager.isSubscribed)) { sub in

if UserDefaults.preferredPeripheralId.count > 0 && sub {
Expand Down

0 comments on commit 2f7b087

Please sign in to comment.