mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
commit
b0c09ce944
4 changed files with 27 additions and 72 deletions
|
|
@ -104,7 +104,7 @@ enum OledTypes: Int, CaseIterable, Identifiable {
|
|||
case auto = 0
|
||||
case ssd1306 = 1
|
||||
case sh1106 = 2
|
||||
//case sh1107 = 3
|
||||
case sh1107 = 3
|
||||
|
||||
var id: Int { self.rawValue }
|
||||
var description: String {
|
||||
|
|
@ -116,8 +116,8 @@ enum OledTypes: Int, CaseIterable, Identifiable {
|
|||
return "SSD 1306"
|
||||
case .sh1106:
|
||||
return "SH 1106"
|
||||
//case .sh1107:
|
||||
// return "SH 1107"
|
||||
case .sh1107:
|
||||
return "SH 1107"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -130,8 +130,8 @@ enum OledTypes: Int, CaseIterable, Identifiable {
|
|||
return Config.DisplayConfig.OledType.oledSsd1306
|
||||
case .sh1106:
|
||||
return Config.DisplayConfig.OledType.oledSh1106
|
||||
//case .sh1107:
|
||||
// return Config.DisplayConfig.OledType.oledSh1107
|
||||
case .sh1107:
|
||||
return Config.DisplayConfig.OledType.oledSh1107
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,29 +259,6 @@ struct AdminMessage {
|
|||
set {payloadVariant = .commitEditSettings(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again.
|
||||
/// Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes.
|
||||
/// If you fail to do so, the radio will assume loss of comms and revert your changes.
|
||||
/// These messages are optional when changing the local node.
|
||||
var confirmSetChannel: Bool {
|
||||
get {
|
||||
if case .confirmSetChannel(let v)? = payloadVariant {return v}
|
||||
return false
|
||||
}
|
||||
set {payloadVariant = .confirmSetChannel(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
var confirmSetRadio: Bool {
|
||||
get {
|
||||
if case .confirmSetRadio(let v)? = payloadVariant {return v}
|
||||
return false
|
||||
}
|
||||
set {payloadVariant = .confirmSetRadio(newValue)}
|
||||
}
|
||||
|
||||
///
|
||||
/// Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot)
|
||||
/// Only Implemented for ESP32 Devices. This needs to be issued to send a new main firmware via bluetooth.
|
||||
|
|
@ -422,15 +399,6 @@ struct AdminMessage {
|
|||
/// Commits an open transaction for any edits made to config, module config, owner, and channel settings
|
||||
case commitEditSettings(Bool)
|
||||
///
|
||||
/// Setting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again.
|
||||
/// Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes.
|
||||
/// If you fail to do so, the radio will assume loss of comms and revert your changes.
|
||||
/// These messages are optional when changing the local node.
|
||||
case confirmSetChannel(Bool)
|
||||
///
|
||||
/// TODO: REPLACE
|
||||
case confirmSetRadio(Bool)
|
||||
///
|
||||
/// Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot)
|
||||
/// Only Implemented for ESP32 Devices. This needs to be issued to send a new main firmware via bluetooth.
|
||||
case rebootOtaSeconds(Int32)
|
||||
|
|
@ -545,14 +513,6 @@ struct AdminMessage {
|
|||
guard case .commitEditSettings(let l) = lhs, case .commitEditSettings(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.confirmSetChannel, .confirmSetChannel): return {
|
||||
guard case .confirmSetChannel(let l) = lhs, case .confirmSetChannel(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.confirmSetRadio, .confirmSetRadio): return {
|
||||
guard case .confirmSetRadio(let l) = lhs, case .confirmSetRadio(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.rebootOtaSeconds, .rebootOtaSeconds): return {
|
||||
guard case .rebootOtaSeconds(let l) = lhs, case .rebootOtaSeconds(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
|
|
@ -796,8 +756,6 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
37: .standard(proto: "set_ringtone_message"),
|
||||
64: .standard(proto: "begin_edit_settings"),
|
||||
65: .standard(proto: "commit_edit_settings"),
|
||||
66: .standard(proto: "confirm_set_channel"),
|
||||
67: .standard(proto: "confirm_set_radio"),
|
||||
95: .standard(proto: "reboot_ota_seconds"),
|
||||
96: .standard(proto: "exit_simulator"),
|
||||
97: .standard(proto: "reboot_seconds"),
|
||||
|
|
@ -1033,22 +991,6 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
self.payloadVariant = .commitEditSettings(v)
|
||||
}
|
||||
}()
|
||||
case 66: try {
|
||||
var v: Bool?
|
||||
try decoder.decodeSingularBoolField(value: &v)
|
||||
if let v = v {
|
||||
if self.payloadVariant != nil {try decoder.handleConflictingOneOf()}
|
||||
self.payloadVariant = .confirmSetChannel(v)
|
||||
}
|
||||
}()
|
||||
case 67: try {
|
||||
var v: Bool?
|
||||
try decoder.decodeSingularBoolField(value: &v)
|
||||
if let v = v {
|
||||
if self.payloadVariant != nil {try decoder.handleConflictingOneOf()}
|
||||
self.payloadVariant = .confirmSetRadio(v)
|
||||
}
|
||||
}()
|
||||
case 95: try {
|
||||
var v: Int32?
|
||||
try decoder.decodeSingularInt32Field(value: &v)
|
||||
|
|
@ -1196,14 +1138,6 @@ extension AdminMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
|
|||
guard case .commitEditSettings(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 65)
|
||||
}()
|
||||
case .confirmSetChannel?: try {
|
||||
guard case .confirmSetChannel(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 66)
|
||||
}()
|
||||
case .confirmSetRadio?: try {
|
||||
guard case .confirmSetRadio(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularBoolField(value: v, fieldNumber: 67)
|
||||
}()
|
||||
case .rebootOtaSeconds?: try {
|
||||
guard case .rebootOtaSeconds(let v)? = self.payloadVariant else { preconditionFailure() }
|
||||
try visitor.visitSingularInt32Field(value: v, fieldNumber: 95)
|
||||
|
|
|
|||
|
|
@ -725,6 +725,10 @@ struct Config {
|
|||
///
|
||||
/// Default / Auto
|
||||
case oledSh1106 // = 2
|
||||
|
||||
///
|
||||
/// Can not be auto detected but set by proto. Used for 128x128 screens
|
||||
case oledSh1107 // = 3
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
init() {
|
||||
|
|
@ -736,6 +740,7 @@ struct Config {
|
|||
case 0: self = .oledAuto
|
||||
case 1: self = .oledSsd1306
|
||||
case 2: self = .oledSh1106
|
||||
case 3: self = .oledSh1107
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
|
@ -745,6 +750,7 @@ struct Config {
|
|||
case .oledAuto: return 0
|
||||
case .oledSsd1306: return 1
|
||||
case .oledSh1106: return 2
|
||||
case .oledSh1107: return 3
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
|
@ -879,6 +885,10 @@ struct Config {
|
|||
/// Has no effect if the duty cycle of the used region is 100%.
|
||||
var overrideDutyCycle: Bool = false
|
||||
|
||||
///
|
||||
/// If true, sets RX boosted gain mode on SX126X based radios
|
||||
var sx126XRxBoostedGain: Bool = false
|
||||
|
||||
///
|
||||
/// For testing it is useful sometimes to force a node to never listen to
|
||||
/// particular other nodes (simulating radio out of range). All nodenums listed
|
||||
|
|
@ -1203,6 +1213,7 @@ extension Config.DisplayConfig.OledType: CaseIterable {
|
|||
.oledAuto,
|
||||
.oledSsd1306,
|
||||
.oledSh1106,
|
||||
.oledSh1107,
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -1920,6 +1931,7 @@ extension Config.DisplayConfig.OledType: SwiftProtobuf._ProtoNameProviding {
|
|||
0: .same(proto: "OLED_AUTO"),
|
||||
1: .same(proto: "OLED_SSD1306"),
|
||||
2: .same(proto: "OLED_SH1106"),
|
||||
3: .same(proto: "OLED_SH1107"),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
@ -1947,6 +1959,7 @@ extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem
|
|||
10: .standard(proto: "tx_power"),
|
||||
11: .standard(proto: "channel_num"),
|
||||
12: .standard(proto: "override_duty_cycle"),
|
||||
13: .standard(proto: "sx126x_rx_boosted_gain"),
|
||||
103: .standard(proto: "ignore_incoming"),
|
||||
]
|
||||
|
||||
|
|
@ -1968,6 +1981,7 @@ extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem
|
|||
case 10: try { try decoder.decodeSingularInt32Field(value: &self.txPower) }()
|
||||
case 11: try { try decoder.decodeSingularUInt32Field(value: &self.channelNum) }()
|
||||
case 12: try { try decoder.decodeSingularBoolField(value: &self.overrideDutyCycle) }()
|
||||
case 13: try { try decoder.decodeSingularBoolField(value: &self.sx126XRxBoostedGain) }()
|
||||
case 103: try { try decoder.decodeRepeatedUInt32Field(value: &self.ignoreIncoming) }()
|
||||
default: break
|
||||
}
|
||||
|
|
@ -2011,6 +2025,9 @@ extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem
|
|||
if self.overrideDutyCycle != false {
|
||||
try visitor.visitSingularBoolField(value: self.overrideDutyCycle, fieldNumber: 12)
|
||||
}
|
||||
if self.sx126XRxBoostedGain != false {
|
||||
try visitor.visitSingularBoolField(value: self.sx126XRxBoostedGain, fieldNumber: 13)
|
||||
}
|
||||
if !self.ignoreIncoming.isEmpty {
|
||||
try visitor.visitPackedUInt32Field(value: self.ignoreIncoming, fieldNumber: 103)
|
||||
}
|
||||
|
|
@ -2030,6 +2047,7 @@ extension Config.LoRaConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem
|
|||
if lhs.txPower != rhs.txPower {return false}
|
||||
if lhs.channelNum != rhs.channelNum {return false}
|
||||
if lhs.overrideDutyCycle != rhs.overrideDutyCycle {return false}
|
||||
if lhs.sx126XRxBoostedGain != rhs.sx126XRxBoostedGain {return false}
|
||||
if lhs.ignoreIncoming != rhs.ignoreIncoming {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -103,7 +103,10 @@ struct AppSettings: View {
|
|||
self.bleManager.context = context
|
||||
}
|
||||
.onChange(of: userSettings.provideLocation) { newProvideLocation in
|
||||
self.bleManager.sendWantConfig()
|
||||
|
||||
if bleManager.connectedPeripheral != nil {
|
||||
self.bleManager.sendWantConfig()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue