mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
25 lines
668 B
Swift
25 lines
668 B
Swift
import SwiftData
|
|
import MeshtasticProtobufs
|
|
|
|
extension SerialConfigEntity {
|
|
convenience init(config: ModuleConfig.SerialConfig) {
|
|
self.init()
|
|
self.enabled = config.enabled
|
|
self.echo = config.echo
|
|
self.rxd = Int32(config.rxd)
|
|
self.txd = Int32(config.txd)
|
|
self.baudRate = Int32(config.baud.rawValue)
|
|
self.timeout = Int32(config.timeout)
|
|
self.mode = Int32(config.mode.rawValue)
|
|
}
|
|
|
|
func update(with config: ModuleConfig.SerialConfig) {
|
|
enabled = config.enabled
|
|
echo = config.echo
|
|
rxd = Int32(config.rxd)
|
|
txd = Int32(config.txd)
|
|
baudRate = Int32(config.baud.rawValue)
|
|
timeout = Int32(config.timeout)
|
|
mode = Int32(config.mode.rawValue)
|
|
}
|
|
}
|