tag hasWifi to MyNodeInfo

master
andrekir 2022-08-28 07:54:47 -03:00
rodzic 27ee6a847a
commit e1ad213a01
3 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -17,6 +17,7 @@ data class MyNodeInfo(
val messageTimeoutMsec: Int,
val minAppVersion: Int,
val maxChannels: Int,
val hasWifi: Boolean,
val channelUtilization: Float,
val airUtilTx: Float
) : Parcelable {
@ -34,6 +35,7 @@ data class MyNodeInfo(
parcel.readInt(),
parcel.readInt(),
parcel.readInt(),
parcel.readByte() != 0.toByte(),
parcel.readFloat(),
parcel.readFloat()
)
@ -49,6 +51,7 @@ data class MyNodeInfo(
parcel.writeInt(messageTimeoutMsec)
parcel.writeInt(minAppVersion)
parcel.writeInt(maxChannels)
parcel.writeByte(if (hasWifi) 1 else 0)
parcel.writeFloat(channelUtilization)
parcel.writeFloat(airUtilTx)
}

Wyświetl plik

@ -223,12 +223,8 @@ class UIViewModel @Inject constructor(
private val defaultPositionBroadcastSecs = if (isRouter) 12 * 60 * 60 else 15 * 60
private val defaultLsSecs = if (isRouter) 24 * 60 * 60 else 5 * 60
// val isESP32: Boolean = _localConfig.value?.hasWifi() == true (not working)
fun isESP32(): Boolean {
// mesh.proto 'HardwareModel' enums for ESP32 devices
val hwModelESP32 = listOf(1, 2, 3, 4, 5, 6, 8, 10, 11, 32, 35, 39, 40, 41, 43, 44)
return hwModelESP32.contains(nodeDB.ourNodeInfo?.user?.hwModel?.number)
}
// We consider hasWifi = ESP32
fun isESP32() = myNodeInfo.value?.hasWifi == true
fun hasAXP(): Boolean {
val hasAXP = listOf(4, 7, 9) // mesh.proto 'HardwareModel' enums with AXP192 chip

Wyświetl plik

@ -1230,6 +1230,7 @@ class MeshService : Service(), Logging {
if (messageTimeoutMsec == 0) 5 * 60 * 1000 else messageTimeoutMsec, // constants from current device code
minAppVersion,
maxChannels,
hasWifi,
channelUtilization,
airUtilTx
)