kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
rodzic
a536410798
commit
73da709bb1
|
@ -201,11 +201,8 @@ class UIViewModel @Inject constructor(
|
|||
meshService?.region = value.number
|
||||
}
|
||||
|
||||
fun isESP32(): Boolean {
|
||||
// List of 'HardwareModel' enum values for ESP32 devices from mesh.proto
|
||||
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
|
||||
var isESP32: Boolean = _localConfig.value?.hasWifi() == true
|
||||
|
||||
/// hardware info about our local device (can be null)
|
||||
private val _myNodeInfo = MutableLiveData<MyNodeInfo?>()
|
||||
|
|
|
@ -43,8 +43,8 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
|||
binding.lsSleepEditText.setText(model.lsSleepSecs.toString())
|
||||
binding.positionBroadcastPeriodView.isEnabled = !model.gpsDisabled
|
||||
binding.positionBroadcastSwitch.isChecked = !model.gpsDisabled
|
||||
binding.lsSleepView.isEnabled = model.isPowerSaving ?: false && model.isESP32()
|
||||
binding.lsSleepSwitch.isChecked = model.isPowerSaving ?: false && model.isESP32()
|
||||
binding.lsSleepView.isEnabled = model.isPowerSaving ?: false && model.isESP32
|
||||
binding.lsSleepSwitch.isChecked = model.isPowerSaving ?: false && model.isESP32
|
||||
}
|
||||
|
||||
model.connectionState.observe(viewLifecycleOwner) { connectionState ->
|
||||
|
@ -52,7 +52,7 @@ class AdvancedSettingsFragment : ScreenFragment("Advanced Settings"), Logging {
|
|||
binding.positionBroadcastPeriodView.isEnabled = connected && !model.gpsDisabled
|
||||
binding.lsSleepView.isEnabled = connected && model.isPowerSaving ?: false
|
||||
binding.positionBroadcastSwitch.isEnabled = connected
|
||||
binding.lsSleepSwitch.isEnabled = connected && model.isESP32()
|
||||
binding.lsSleepSwitch.isEnabled = connected && model.isESP32
|
||||
binding.shutdownButton.isEnabled = connected
|
||||
binding.rebootButton.isEnabled = connected
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue