Add module reset and fix factory reset return
Previously, it returned a String but was documented to return bytes; it now returns bytes.
This commit is contained in:
parent
12cce7213b
commit
fa31aab5cf
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Added
|
### Added
|
||||||
- `Rn2903::system_version_bytes()`
|
- `Rn2903::system_version_bytes()`
|
||||||
- `Rn2903::system_factory_reset()`
|
- `Rn2903::system_factory_reset()`
|
||||||
|
- `Rn2903::system_module_reset()`
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
14
src/lib.rs
14
src/lib.rs
|
@ -294,11 +294,19 @@ impl Rn2903 {
|
||||||
self.transact(b"sys get ver")
|
self.transact(b"sys get ver")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Resets the CPU on the connected module. State in memory is lost and the MAC
|
||||||
|
/// starts up upon reboot, automatically loading default LoRaWAN settings.
|
||||||
|
///
|
||||||
|
/// Returns the system version, like `::system_version_bytes()`.
|
||||||
|
pub fn system_module_reset(&mut self) -> Result<Vec<u8>> {
|
||||||
|
self.transact(b"sys reset")
|
||||||
|
}
|
||||||
|
|
||||||
/// Performs a factory reset on the connected module. All EEPROM values are
|
/// 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.
|
/// restored to factory defaults. All LoRaWAN settings set by the user are lost.
|
||||||
|
///
|
||||||
/// Returns the system version, like `::system_version_bytes()`.
|
/// Returns the system version, like `::system_version_bytes()`.
|
||||||
pub fn system_factory_reset(&mut self) -> Result<String> {
|
pub fn system_factory_reset(&mut self) -> Result<Vec<u8>> {
|
||||||
let bytes = self.transact(b"sys factoryRESET")?;
|
self.transact(b"sys factoryRESET")
|
||||||
Ok(bytes_to_string(&bytes))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue