From 12cce7213b1441c06f3903c78aab067d65a52c08 Mon Sep 17 00:00:00 2001 From: Leonora Tindall Date: Sun, 29 Dec 2019 12:59:16 -0800 Subject: [PATCH] Add factory reset functionality --- CHANGELOG.md | 1 + src/lib.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 360f9f0..ba6d043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `Rn2903::system_version_bytes()` +- `Rn2903::system_factory_reset()` ### Changed diff --git a/src/lib.rs b/src/lib.rs index 29393b8..64f1578 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -293,4 +293,12 @@ impl Rn2903 { pub fn system_version_bytes(&mut self) -> Result> { self.transact(b"sys get ver") } + + /// Performs a factory reset on the connected module. All EEPROM values are + /// restored to factory defaults. All LoRaWAN settings set by the user are lost. + /// Returns the system version, like `::system_version_bytes()`. + pub fn system_factory_reset(&mut self) -> Result { + let bytes = self.transact(b"sys factoryRESET")?; + Ok(bytes_to_string(&bytes)) + } }