Add factory reset button

This commit is contained in:
Douile 2022-08-23 11:13:47 +01:00
parent 2a74d4fa69
commit 7adf3cd0f5
No known key found for this signature in database
GPG key ID: DC9D70626CEF33D0
4 changed files with 39 additions and 0 deletions

View file

@ -349,6 +349,17 @@ class UIViewModel @Inject constructor(
meshService?.requestReboot(DataPacket.ID_LOCAL)
}
fun requestFactoryReset() {
val config = _localConfig.value
if (config != null) {
val builder = config.device.toBuilder()
builder.factoryReset = true
val newConfig = ConfigProtos.Config.newBuilder()
newConfig.device = builder.build()
setDeviceConfig(newConfig.build())
}
}
/**
* Write the persisted packet data out to a CSV file in the specified location.
*/