diff --git a/app/src/main/java/com/geeksville/mesh/MainActivity.kt b/app/src/main/java/com/geeksville/mesh/MainActivity.kt
index 3ebf362c2..3a96b0908 100644
--- a/app/src/main/java/com/geeksville/mesh/MainActivity.kt
+++ b/app/src/main/java/com/geeksville/mesh/MainActivity.kt
@@ -207,10 +207,10 @@ class MainActivity :
return resultPendingIntent!!
}
- private val createDocumentLauncher =
+ private val createRangetestLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
if (it.resultCode == RESULT_OK) {
- it.data?.data?.let { file_uri -> model.saveMessagesCSV(file_uri) }
+ it.data?.data?.let { file_uri -> model.saveRangetestCSV(file_uri) }
}
}
@@ -264,14 +264,14 @@ class MainActivity :
getVersionInfo()
}
- MainMenuAction.EXPORT_MESSAGES -> {
+ MainMenuAction.EXPORT_RANGETEST -> {
val intent =
Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "application/csv"
putExtra(Intent.EXTRA_TITLE, "rangetest.csv")
}
- createDocumentLauncher.launch(intent)
+ createRangetestLauncher.launch(intent)
}
MainMenuAction.THEME -> {
diff --git a/app/src/main/java/com/geeksville/mesh/model/UIState.kt b/app/src/main/java/com/geeksville/mesh/model/UIState.kt
index 0747d446f..b5a04a42a 100644
--- a/app/src/main/java/com/geeksville/mesh/model/UIState.kt
+++ b/app/src/main/java/com/geeksville/mesh/model/UIState.kt
@@ -879,7 +879,8 @@ constructor(
}
/** Write the persisted packet data out to a CSV file in the specified location. */
- fun saveMessagesCSV(uri: Uri) {
+ @Suppress("detekt:CyclomaticComplexMethod", "detekt:LongMethod")
+ fun saveRangetestCSV(uri: Uri) {
viewModelScope.launch(Dispatchers.Main) {
// Extract distances to this device from position messages and put (node,SNR,distance)
// in
@@ -917,9 +918,10 @@ constructor(
}
}
- // Filter out of our results any packet that doesn't report SNR. This
- // is primarily ADMIN_APP.
- if (proto.rxSnr != 0.0f) {
+ // Only look at range test messages, with SNR reported.
+ if (
+ proto.decoded.portnumValue == Portnums.PortNum.RANGE_TEST_APP_VALUE && proto.rxSnr != 0.0f
+ ) {
val rxDateTime = dateFormat.format(packet.received_date)
val rxFrom = proto.from.toUInt()
val senderName = nodes[proto.from]?.user?.longName ?: ""
diff --git a/app/src/main/java/com/geeksville/mesh/ui/Main.kt b/app/src/main/java/com/geeksville/mesh/ui/Main.kt
index f7b17ea0f..b5a758443 100644
--- a/app/src/main/java/com/geeksville/mesh/ui/Main.kt
+++ b/app/src/main/java/com/geeksville/mesh/ui/Main.kt
@@ -371,7 +371,7 @@ private fun VersionChecks(viewModel: UIViewModel) {
enum class MainMenuAction(@StringRes val stringRes: Int) {
DEBUG(R.string.debug_panel),
RADIO_CONFIG(R.string.radio_configuration),
- EXPORT_MESSAGES(R.string.save_messages),
+ EXPORT_RANGETEST(R.string.save_rangetest),
THEME(R.string.theme),
LANGUAGE(R.string.preferences_language),
SHOW_INTRO(R.string.intro_show),
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fa1453ca3..a7cd6b4cd 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -156,7 +156,7 @@
OK
You must set a region!
Couldn\'t change channel, because radio is not yet connected. Please try again.
- Export rangetest.csv
+ Export rangetest.csv
Reset
Scan
Are you sure you want to change to the default channel?