mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
chore: fix regressions in the release (#4398)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
6eb42cc180
commit
221e774471
9 changed files with 71 additions and 32 deletions
|
|
@ -65,7 +65,6 @@
|
|||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
|
||||
<!-- Needed to open our bluetooth connection to our paired device (after reboot) -->
|
||||
|
|
@ -125,7 +124,7 @@
|
|||
<service
|
||||
android:name="com.geeksville.mesh.service.MeshService"
|
||||
android:enabled="true"
|
||||
android:foregroundServiceType="connectedDevice|location|dataSync"
|
||||
android:foregroundServiceType="connectedDevice|location"
|
||||
android:exported="true" tools:ignore="ExportedActivity">
|
||||
<intent-filter>
|
||||
<action android:name="com.geeksville.mesh.Service" />
|
||||
|
|
|
|||
|
|
@ -113,13 +113,18 @@ constructor(
|
|||
|
||||
private fun fromRadioPacketFlow(): Flow<ByteArray> = channelFlow {
|
||||
while (isActive) {
|
||||
// Use safe call and Elvis operator for cleaner loop termination if read fails or returns empty
|
||||
val packet =
|
||||
fromRadioCharacteristic?.read()?.takeIf { it.isNotEmpty() }
|
||||
?: run {
|
||||
Logger.d { "[$address] fromRadio queue drain complete (read empty/null)" }
|
||||
break
|
||||
}
|
||||
try {
|
||||
fromRadioCharacteristic?.read()?.takeIf { it.isNotEmpty() }
|
||||
} catch (e: Exception) {
|
||||
Logger.w(e) { "[$address] Error reading fromRadioCharacteristic (likely disconnected)" }
|
||||
null
|
||||
}
|
||||
|
||||
if (packet == null) {
|
||||
Logger.d { "[$address] fromRadio queue drain complete or error reading characteristic" }
|
||||
break
|
||||
}
|
||||
send(packet)
|
||||
}
|
||||
}
|
||||
|
|
@ -221,6 +226,11 @@ constructor(
|
|||
.onEach { state ->
|
||||
Logger.i { "[$address] BLE connection state changed to $state" }
|
||||
if (state is ConnectionState.Disconnected) {
|
||||
toRadioCharacteristic = null
|
||||
fromNumCharacteristic = null
|
||||
fromRadioCharacteristic = null
|
||||
logRadioCharacteristic = null
|
||||
|
||||
val uptime =
|
||||
if (connectionStartTime > 0) {
|
||||
System.currentTimeMillis() - connectionStartTime
|
||||
|
|
|
|||
|
|
@ -140,9 +140,7 @@ class MeshService : Service() {
|
|||
SERVICE_NOTIFY_ID,
|
||||
notification,
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
var types =
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE or
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
|
||||
var types = ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
|
||||
if (hasLocationPermission()) {
|
||||
types = types or ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,12 @@ pluginManagement {
|
|||
gradlePluginPortal()
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
content {
|
||||
includeGroupByRegex("com\\.github\\..*")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +44,12 @@ dependencyResolutionManagement {
|
|||
}
|
||||
}
|
||||
mavenCentral()
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
content {
|
||||
includeGroupByRegex("com\\.github\\..*")
|
||||
}
|
||||
}
|
||||
}
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
|
|
|
|||
|
|
@ -236,11 +236,16 @@ private fun DeviceMetricsChart(
|
|||
/* Series for Left Axis (0-100%) */
|
||||
lineSeries {
|
||||
series(x = telemetries.map { it.time }, y = telemetries.map { it.deviceMetrics.batteryLevel })
|
||||
series(x = telemetries.map { it.time }, y = telemetries.map { it.deviceMetrics.channelUtilization })
|
||||
series(x = telemetries.map { it.time }, y = telemetries.map { it.deviceMetrics.airUtilTx })
|
||||
val chUtilData = telemetries.filter { !it.deviceMetrics.channelUtilization.isNaN() }
|
||||
series(x = chUtilData.map { it.time }, y = chUtilData.map { it.deviceMetrics.channelUtilization })
|
||||
val airUtilData = telemetries.filter { !it.deviceMetrics.airUtilTx.isNaN() }
|
||||
series(x = airUtilData.map { it.time }, y = airUtilData.map { it.deviceMetrics.airUtilTx })
|
||||
}
|
||||
/* Series for Right Axis (Voltage) */
|
||||
lineSeries { series(x = telemetries.map { it.time }, y = telemetries.map { it.deviceMetrics.voltage }) }
|
||||
lineSeries {
|
||||
val voltageData = telemetries.filter { !it.deviceMetrics.voltage.isNaN() }
|
||||
series(x = voltageData.map { it.time }, y = voltageData.map { it.deviceMetrics.voltage })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,12 +134,14 @@ fun EnvironmentMetricsChart(
|
|||
/* Pressure on its own layer/axis */
|
||||
if (shouldPlot[Environment.BAROMETRIC_PRESSURE.ordinal]) {
|
||||
lineSeries {
|
||||
val pressureData =
|
||||
telemetries.filter {
|
||||
val v = Environment.BAROMETRIC_PRESSURE.getValue(it)
|
||||
v != null && !v.isNaN()
|
||||
}
|
||||
series(
|
||||
x =
|
||||
telemetries.mapNotNull { t ->
|
||||
Environment.BAROMETRIC_PRESSURE.getValue(t)?.let { t.time }
|
||||
},
|
||||
y = telemetries.mapNotNull { t -> Environment.BAROMETRIC_PRESSURE.getValue(t) },
|
||||
x = pressureData.map { it.time },
|
||||
y = pressureData.map { Environment.BAROMETRIC_PRESSURE.getValue(it)!! },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -147,10 +149,12 @@ fun EnvironmentMetricsChart(
|
|||
Environment.entries.forEach { metric ->
|
||||
if (metric != Environment.BAROMETRIC_PRESSURE && shouldPlot[metric.ordinal]) {
|
||||
lineSeries {
|
||||
series(
|
||||
x = telemetries.mapNotNull { t -> metric.getValue(t)?.let { t.time } },
|
||||
y = telemetries.mapNotNull { t -> metric.getValue(t) },
|
||||
)
|
||||
val metricData =
|
||||
telemetries.filter {
|
||||
val v = metric.getValue(it)
|
||||
v != null && !v.isNaN()
|
||||
}
|
||||
series(x = metricData.map { it.time }, y = metricData.map { metric.getValue(it)!! })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,15 +253,17 @@ private fun PowerMetricsChart(
|
|||
LaunchedEffect(telemetries, selectedChannel) {
|
||||
modelProducer.runTransaction {
|
||||
lineSeries {
|
||||
val currentData = telemetries.filter { !retrieveCurrent(selectedChannel, it).isNaN() }
|
||||
series(
|
||||
x = telemetries.map { it.time },
|
||||
y = telemetries.map { retrieveCurrent(selectedChannel, it) },
|
||||
x = currentData.map { it.time },
|
||||
y = currentData.map { retrieveCurrent(selectedChannel, it) },
|
||||
)
|
||||
}
|
||||
lineSeries {
|
||||
val voltageData = telemetries.filter { !retrieveVoltage(selectedChannel, it).isNaN() }
|
||||
series(
|
||||
x = telemetries.map { it.time },
|
||||
y = telemetries.map { retrieveVoltage(selectedChannel, it) },
|
||||
x = voltageData.map { it.time },
|
||||
y = voltageData.map { retrieveVoltage(selectedChannel, it) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,8 +139,14 @@ private fun SignalMetricsChart(
|
|||
LaunchedEffect(meshPackets) {
|
||||
modelProducer.runTransaction {
|
||||
/* Use separate lineSeries calls to associate them with different vertical axes */
|
||||
lineSeries { series(x = meshPackets.map { it.rxTime }, y = meshPackets.map { it.rxRssi }) }
|
||||
lineSeries { series(x = meshPackets.map { it.rxTime }, y = meshPackets.map { it.rxSnr }) }
|
||||
lineSeries {
|
||||
val rssiData = meshPackets.filter { it.rxRssi != 0 && !it.rxRssi.toFloat().isNaN() }
|
||||
series(x = rssiData.map { it.rxTime }, y = rssiData.map { it.rxRssi })
|
||||
}
|
||||
lineSeries {
|
||||
val snrData = meshPackets.filter { !it.rxSnr.isNaN() }
|
||||
series(x = snrData.map { it.rxTime }, y = snrData.map { it.rxSnr })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,12 @@ dependencyResolutionManagement {
|
|||
mavenLocal()
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
content {
|
||||
includeGroupByRegex("com\\.github\\..*")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue