Skip to content

Commit

Permalink
Merge branch 'master' into excluded_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekir authored Dec 15, 2024
2 parents 244c49a + 066e44a commit 109fc3d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 43 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ android {
applicationId "com.geeksville.mesh"
minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works)
targetSdk 34
versionCode 30513 // format is Mmmss (where M is 1+the numeric major number
versionName "2.5.13"
versionCode 30514 // format is Mmmss (where M is 1+the numeric major number
versionName "2.5.14"
testInstrumentationRunner "com.geeksville.mesh.TestRunner"

// per https://developer.android.com/studio/write/vector-asset-studio
Expand Down Expand Up @@ -184,12 +184,12 @@ dependencies {
kspAndroidTest "com.google.dagger:hilt-compiler:$hilt_version"

// Navigation
def nav_version = "2.8.4"
def nav_version = "2.8.5"
implementation "androidx.navigation:navigation-compose:$nav_version"
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"

// Compose
def composeBom = platform('androidx.compose:compose-bom:2024.11.00')
def composeBom = platform('androidx.compose:compose-bom:2024.12.01')
implementation composeBom
androidTestImplementation composeBom

Expand Down Expand Up @@ -239,7 +239,7 @@ dependencies {
implementation 'com.github.mik3y:usb-serial-for-android:3.8.1'

// For Firebase Crashlytics & Analytics
googleImplementation platform('com.google.firebase:firebase-bom:33.5.1')
googleImplementation platform('com.google.firebase:firebase-bom:33.7.0')
googleImplementation 'com.google.firebase:firebase-crashlytics'
googleImplementation 'com.google.firebase:firebase-analytics'

Expand Down
72 changes: 37 additions & 35 deletions app/src/main/java/com/geeksville/mesh/model/DeviceHardware.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package com.geeksville.mesh.model

import androidx.annotation.DrawableRes
import com.geeksville.mesh.MeshProtos.HardwareModel
import com.geeksville.mesh.R
import kotlinx.serialization.Serializable
Expand All @@ -29,7 +30,7 @@ data class DeviceHardware(
val supportLevel: Int? = null,
val displayName: String,
val tags: List<String>? = listOf(),
val image: Int,
@DrawableRes val image: Int,
val requiresDfu: Boolean? = null,
)

Expand All @@ -54,44 +55,45 @@ data class DeviceHardwareDto(
supportLevel = supportLevel,
displayName = displayName,
tags = tags,
image = HardwareModel.forNumber(hwModel).getDeviceVectorImage(),
image = getDrawableFrom(hwModel),
requiresDfu = requiresDfu
)
}

@Suppress("CyclomaticComplexMethod")
private fun HardwareModel.getDeviceVectorImage(): Int = when (this) {
HardwareModel.DIY_V1 -> R.drawable.hw_diy
HardwareModel.HELTEC_HT62 -> R.drawable.hw_heltec_ht62_esp32c3_sx1262
HardwareModel.HELTEC_MESH_NODE_T114 -> R.drawable.hw_heltec_mesh_node_t114
HardwareModel.HELTEC_V3 -> R.drawable.hw_heltec_v3
HardwareModel.HELTEC_VISION_MASTER_E213 -> R.drawable.hw_heltec_vision_master_e213
HardwareModel.HELTEC_VISION_MASTER_E290 -> R.drawable.hw_heltec_vision_master_e290
HardwareModel.HELTEC_VISION_MASTER_T190 -> R.drawable.hw_heltec_vision_master_t190
HardwareModel.HELTEC_WIRELESS_PAPER -> R.drawable.hw_heltec_wireless_paper
HardwareModel.HELTEC_WIRELESS_TRACKER -> R.drawable.hw_heltec_wireless_tracker
HardwareModel.HELTEC_WIRELESS_TRACKER_V1_0 -> R.drawable.hw_heltec_wireless_tracker_v1_0
HardwareModel.HELTEC_WSL_V3 -> R.drawable.hw_heltec_wsl_v3
HardwareModel.NANO_G2_ULTRA -> R.drawable.hw_nano_g2_ultra
HardwareModel.RPI_PICO -> R.drawable.hw_pico
HardwareModel.NRF52_PROMICRO_DIY -> R.drawable.hw_promicro
HardwareModel.RAK11310 -> R.drawable.hw_rak11310
HardwareModel.RAK4631 -> R.drawable.hw_rak4631
HardwareModel.RPI_PICO2 -> R.drawable.hw_rpipicow
HardwareModel.SENSECAP_INDICATOR -> R.drawable.hw_seeed_sensecap_indicator
HardwareModel.SEEED_XIAO_S3 -> R.drawable.hw_seeed_xiao_s3
HardwareModel.STATION_G2 -> R.drawable.hw_station_g2
HardwareModel.T_DECK -> R.drawable.hw_t_deck
HardwareModel.T_ECHO -> R.drawable.hw_t_echo
HardwareModel.T_WATCH_S3 -> R.drawable.hw_t_watch_s3
HardwareModel.TBEAM -> R.drawable.hw_tbeam
HardwareModel.LILYGO_TBEAM_S3_CORE -> R.drawable.hw_tbeam_s3_core
HardwareModel.TLORA_C6 -> R.drawable.hw_tlora_c6
HardwareModel.TLORA_T3_S3 -> R.drawable.hw_tlora_t3s3_v1
HardwareModel.TLORA_V2_1_1P6 -> R.drawable.hw_tlora_v2_1_1_6
HardwareModel.TLORA_V2_1_1P8 -> R.drawable.hw_tlora_v2_1_1_8
HardwareModel.TRACKER_T1000_E -> R.drawable.hw_tracker_t1000_e
HardwareModel.WIO_WM1110 -> R.drawable.hw_wio_tracker_wm1110
HardwareModel.WISMESH_TAP -> R.drawable.hw_rak_wismeshtap
@DrawableRes
private fun getDrawableFrom(hwModel: Int): Int = when (hwModel) {
HardwareModel.DIY_V1_VALUE -> R.drawable.hw_diy
HardwareModel.HELTEC_HT62_VALUE -> R.drawable.hw_heltec_ht62_esp32c3_sx1262
HardwareModel.HELTEC_MESH_NODE_T114_VALUE -> R.drawable.hw_heltec_mesh_node_t114
HardwareModel.HELTEC_V3_VALUE -> R.drawable.hw_heltec_v3
HardwareModel.HELTEC_VISION_MASTER_E213_VALUE -> R.drawable.hw_heltec_vision_master_e213
HardwareModel.HELTEC_VISION_MASTER_E290_VALUE -> R.drawable.hw_heltec_vision_master_e290
HardwareModel.HELTEC_VISION_MASTER_T190_VALUE -> R.drawable.hw_heltec_vision_master_t190
HardwareModel.HELTEC_WIRELESS_PAPER_VALUE -> R.drawable.hw_heltec_wireless_paper
HardwareModel.HELTEC_WIRELESS_TRACKER_VALUE -> R.drawable.hw_heltec_wireless_tracker
HardwareModel.HELTEC_WIRELESS_TRACKER_V1_0_VALUE -> R.drawable.hw_heltec_wireless_tracker_v1_0
HardwareModel.HELTEC_WSL_V3_VALUE -> R.drawable.hw_heltec_wsl_v3
HardwareModel.NANO_G2_ULTRA_VALUE -> R.drawable.hw_nano_g2_ultra
HardwareModel.RPI_PICO_VALUE -> R.drawable.hw_pico
HardwareModel.NRF52_PROMICRO_DIY_VALUE -> R.drawable.hw_promicro
HardwareModel.RAK11310_VALUE -> R.drawable.hw_rak11310
HardwareModel.RAK4631_VALUE -> R.drawable.hw_rak4631
HardwareModel.RPI_PICO2_VALUE -> R.drawable.hw_rpipicow
HardwareModel.SENSECAP_INDICATOR_VALUE -> R.drawable.hw_seeed_sensecap_indicator
HardwareModel.SEEED_XIAO_S3_VALUE -> R.drawable.hw_seeed_xiao_s3
HardwareModel.STATION_G2_VALUE -> R.drawable.hw_station_g2
HardwareModel.T_DECK_VALUE -> R.drawable.hw_t_deck
HardwareModel.T_ECHO_VALUE -> R.drawable.hw_t_echo
HardwareModel.T_WATCH_S3_VALUE -> R.drawable.hw_t_watch_s3
HardwareModel.TBEAM_VALUE -> R.drawable.hw_tbeam
HardwareModel.LILYGO_TBEAM_S3_CORE_VALUE -> R.drawable.hw_tbeam_s3_core
HardwareModel.TLORA_C6_VALUE -> R.drawable.hw_tlora_c6
HardwareModel.TLORA_T3_S3_VALUE -> R.drawable.hw_tlora_t3s3_v1
HardwareModel.TLORA_V2_1_1P6_VALUE -> R.drawable.hw_tlora_v2_1_1_6
HardwareModel.TLORA_V2_1_1P8_VALUE -> R.drawable.hw_tlora_v2_1_1_8
HardwareModel.TRACKER_T1000_E_VALUE -> R.drawable.hw_tracker_t1000_e
HardwareModel.WIO_WM1110_VALUE -> R.drawable.hw_wio_tracker_wm1110
HardwareModel.WISMESH_TAP_VALUE -> R.drawable.hw_rak_wismeshtap
else -> R.drawable.hw_unknown
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.core.content.edit
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.coroutineScope
import com.geeksville.mesh.CoroutineDispatchers
import com.geeksville.mesh.MeshProtos
import com.geeksville.mesh.android.BinaryLogFile
import com.geeksville.mesh.android.BuildUtils
import com.geeksville.mesh.android.GeeksvilleApplication
Expand Down Expand Up @@ -110,8 +111,20 @@ class RadioInterfaceService @Inject constructor(
}.launchIn(processLifecycle.coroutineScope)
}

companion object : Logging {
companion object {
const val DEVADDR_KEY = "devAddr2" // the new name for devaddr
private const val HEARTBEAT_INTERVAL_MILLIS = 5 * 60 * 1000L
}

private var lastHeartbeatMillis = 0L
private fun keepAlive(now: Long) {
if (now - lastHeartbeatMillis > HEARTBEAT_INTERVAL_MILLIS) {
info("Sending ToRadio heartbeat")
val heartbeat = MeshProtos.ToRadio.newBuilder()
.setHeartbeat(MeshProtos.Heartbeat.getDefaultInstance()).build()
handleSendToRadio(heartbeat.toByteArray())
lastHeartbeatMillis = now
}
}

/**
Expand Down Expand Up @@ -184,6 +197,10 @@ class RadioInterfaceService @Inject constructor(
receivedPacketsLog.flush()
}

if (radioIf is SerialInterface) {
keepAlive(System.currentTimeMillis())
}

// ignoreException { debug("FromRadio: ${MeshProtos.FromRadio.parseFrom(p)}") }

processLifecycle.coroutineScope.launch(dispatchers.io) {
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
ext {
useCrashlytics = false
kotlin_version = '2.0.21'
hilt_version = '2.52'
protobuf_version = '4.28.3'
hilt_version = '2.53.1'
protobuf_version = '4.29.1'
}

repositories {
Expand Down

0 comments on commit 109fc3d

Please sign in to comment.