Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions WunderLINQ.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
D87629122A7EDEB90021E7A7 /* standard-dashboard-portrait.svg in Resources */ = {isa = PBXBuildFile; fileRef = D87629112A7EDEB90021E7A7 /* standard-dashboard-portrait.svg */; };
D880B6022C6BFED900B4252B /* wav in Resources */ = {isa = PBXBuildFile; fileRef = D880B6012C6BFED900B4252B /* wav */; };
D8854C3E2CFE6D91003888B8 /* RateOfClimbCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8854C3D2CFE6D8E003888B8 /* RateOfClimbCalculator.swift */; };
D89A22E22DEC08BF0038F4CF /* WLQ_U.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89A22E12DEC08BF0038F4CF /* WLQ_U.swift */; };
D8A9C0D82D8F3D67001E0DF7 /* SpotifyiOS.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8A9C0D72D8F3D67001E0DF7 /* SpotifyiOS.xcframework */; };
D8A9C0D92D8F3D67001E0DF7 /* SpotifyiOS.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D8A9C0D72D8F3D67001E0DF7 /* SpotifyiOS.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D8CEAEB52CF7D99C00AF5813 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8CEAEB42CF7D99100AF5813 /* UIImage+Extensions.swift */; };
Expand Down Expand Up @@ -291,6 +292,7 @@
D87629112A7EDEB90021E7A7 /* standard-dashboard-portrait.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "standard-dashboard-portrait.svg"; sourceTree = "<group>"; };
D880B6012C6BFED900B4252B /* wav */ = {isa = PBXFileReference; lastKnownFileType = folder; path = wav; sourceTree = "<group>"; };
D8854C3D2CFE6D8E003888B8 /* RateOfClimbCalculator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RateOfClimbCalculator.swift; sourceTree = "<group>"; };
D89A22E12DEC08BF0038F4CF /* WLQ_U.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WLQ_U.swift; sourceTree = "<group>"; };
D8A9C0D72D8F3D67001E0DF7 /* SpotifyiOS.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:2FNC3A47ZF:Spotify"; lastKnownFileType = wrapper.xcframework; name = SpotifyiOS.xcframework; path = "../../../Library/Developer/Xcode/DerivedData/WunderLINQ-aagipipvhxcztketvqvfkgxbhazm/SourcePackages/checkouts/ios-sdk/SpotifyiOS.xcframework"; sourceTree = "<group>"; };
D8CEAEB42CF7D99100AF5813 /* UIImage+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Extensions.swift"; sourceTree = "<group>"; };
D8FA72F72CC1B65300C41674 /* adv-dashboard-portrait.svg */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "adv-dashboard-portrait.svg"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -530,6 +532,7 @@
7E9DDA9A278DE8A2006C6D12 /* WLQ.swift */,
7E9DDA9E278DFFD4006C6D12 /* WLQ_N.swift */,
7E9DDAA0278E2403006C6D12 /* WLQ_S.swift */,
D89A22E12DEC08BF0038F4CF /* WLQ_U.swift */,
D834BC3E2CB4C154002884B7 /* WLQ_X.swift */,
);
path = WLQ;
Expand Down Expand Up @@ -806,6 +809,7 @@
7E4669F72518647C00E7E291 /* NavAppHelper.swift in Sources */,
7E6E0A6824FC022200149387 /* ColorPickerViewController.swift in Sources */,
7E8AD3D926141BA10089F590 /* ADVDashboard.swift in Sources */,
D89A22E22DEC08BF0038F4CF /* WLQ_U.swift in Sources */,
D80365FE2B377FCD00F48637 /* SoundManager.swift in Sources */,
7E7DE00928986B1B0009663C /* ZoomAndSnapFlowLayout.swift in Sources */,
7E9DDAA1278E2403006C6D12 /* WLQ_S.swift in Sources */,
Expand Down
21 changes: 21 additions & 0 deletions WunderLINQ/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@
"fx1_long_label" = "FX1 Long Press";
"fx2_label" = "FX2";
"fx2_long_label" = "FX2 Long Press";
"pdm_label" = "Power Controller";
"pdm_channel1_label" = "PDM Channel 1";
"pdm_channel2_label" = "PDM Channel 2";
"pdm_channel3_label" = "PDM Channel 3";
"pdm_channel4_label" = "PDM Channel 4";

//HWCustomizeViewController
"usb_threshold_label" = "USB Port Control";
Expand All @@ -160,6 +165,22 @@
"hwreset_alert_body" = "The current WunderLINQ Custom settings will be reset to the factory defaults.";
"hwsave_alert_btn_ok" = "Continue";
"hwsave_alert_btn_cancel" = "Cancel";
"pdm_channel_mode_toggle" = "Toggle";
"pdm_channel_mode_momentary" = "Momentary";
"pdm_channel_mode_ignition" = "Ignition";
"pdm_channel_mode_highbeam" = "High Beam";
"pdm_channel_mode_brakes" = "Brakes";
"pdm_channel_mode_ambient_light" = "Ambient Light";
"pdm_channel_mode_ambient_temp" = "Ambient Temperature";
"pdm_channel_mode_heated_grips" = "Heated Grip Level";
"pdm_channel_mode_disabled" = "Disabled";

"orientation_label" = "Orientation";
"orientation_default_label" = "Default";
"orientation_90_label" = "90";
"orientation_180_label" = "180";
"orientation_270_label" = "270";

//AboutViewController
"about_title" = "About";
"version_label" = "Version:";
Expand Down
117 changes: 80 additions & 37 deletions WunderLINQ/HWSettingsActionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,55 @@ class HWSettingsActionViewController: UIViewController, UIPickerViewDataSource,

var modePickerData = [NSLocalizedString("hid_0x00_label", comment: ""),
NSLocalizedString("hid_keyboard_label", comment: ""),
NSLocalizedString("hid_consumer_label", comment: "")]
NSLocalizedString("hid_consumer_label", comment: "")
]

var modePickerDataHW1 = [NSLocalizedString("hid_0x00_label", comment: ""),
NSLocalizedString("hid_keyboard_label", comment: "")]
NSLocalizedString("hid_keyboard_label", comment: "")
]

var keymodesPickerData = [NSLocalizedString("keymode_default_label", comment: ""),
NSLocalizedString("keymode_custom_label", comment: ""),
NSLocalizedString("keymode_media_label", comment: ""),
NSLocalizedString("keymode_dmd2_label", comment: "")]
NSLocalizedString("keymode_dmd2_label", comment: "")
]

var usbPickerData = [NSLocalizedString("usbcontrol_on_label", comment: ""),
NSLocalizedString("usbcontrol_engine_label", comment: ""),
NSLocalizedString("usbcontrol_off_label", comment: "")]
NSLocalizedString("usbcontrol_off_label", comment: "")
]

var pdmPickerData = [NSLocalizedString("pdm_channel_mode_toggle", comment: ""),
NSLocalizedString("pdm_channel_mode_momentary", comment: ""),
NSLocalizedString("pdm_channel_mode_ignition", comment: ""),
NSLocalizedString("pdm_channel_mode_highbeam", comment: ""),
NSLocalizedString("pdm_channel_mode_brakes", comment: ""),
NSLocalizedString("pdm_channel_mode_ambient_light", comment: ""),
NSLocalizedString("pdm_channel_mode_ambient_temp", comment: ""),
NSLocalizedString("pdm_channel_mode_heated_grips", comment: ""),
NSLocalizedString("pdm_channel_mode_disabled", comment: "")
]


@IBAction func savePressed(_ sender: Any) {
if(actionID == WLQ_N_DEFINES.KEYMODE || actionID == WLQ_X_DEFINES.KEYMODE || actionID == WLQ_S_DEFINES.KEYMODE){ // Mode
if(actionID == WLQ_DEFINES.KEYMODE){ // Mode
if (wlqData.getKeyMode() != self.typePicker.selectedRow(inComponent: 0)){
setHWMode(mode: UInt8(self.typePicker.selectedRow(inComponent: 0)))
}
} else if(actionID == WLQ_N_DEFINES.USB){ // USB
if ((self.typePicker.selectedRow(inComponent: 0) == 0) && (wlqData.getVINThreshold() != 0x0000)){
wlqData.setVINThreshold(value: [0x00,0x00])
} else if ((self.typePicker.selectedRow(inComponent: 0) == 1) && (wlqData.getVINThreshold() != 0x02BC)){
wlqData.setVINThreshold(value: [0x02,0xBC])
} else if ((self.typePicker.selectedRow(inComponent: 0) == 2) && (wlqData.getVINThreshold() != 0xFFFF)){
wlqData.setVINThreshold(value: [0xFF,0xFF])
}
} else if(actionID == WLQ_N_DEFINES.RTKDoublePressSensitivity || actionID == WLQ_X_DEFINES.RTKDoublePressSensitivity){ // RTK Sensititvity
wlqData.setDoublePressSensitivity(value: (UInt8)(self.typePicker.selectedRow(inComponent: 0) + 1))
} else if(actionID == WLQ_N_DEFINES.fullLongPressSensitivity || actionID == WLQ_X_DEFINES.fullLongPressSensitivity || actionID == WLQ_S_DEFINES.fullLongPressSensitivity){ // Full Sensititvity
wlqData.setLongPressSensitivity(value: (UInt8)(self.typePicker.selectedRow(inComponent: 0) + 1))
} else if(actionID == WLQ_DEFINES.USB){ // USB
wlqData.setActionValue(action: actionID!, value: UInt8(self.typePicker.selectedRow(inComponent: 0)))
} else if(actionID == WLQ_DEFINES.doublePressSensitivity){ // RTK Sensititvity
wlqData.setActionValue(action: actionID!, value: UInt8(self.typePicker.selectedRow(inComponent: 0)))
} else if(actionID == WLQ_DEFINES.longPressSensitivity){ // Full Sensititvity
wlqData.setActionValue(action: actionID!, value: UInt8(self.typePicker.selectedRow(inComponent: 0)))
} else if(actionID == WLQ_DEFINES.pdmChannel1){
wlqData.setActionValue(action: actionID!, value: UInt8(self.typePicker.selectedRow(inComponent: 0)))
} else if(actionID == WLQ_DEFINES.pdmChannel2){
wlqData.setActionValue(action: actionID!, value: UInt8(self.typePicker.selectedRow(inComponent: 0)))
} else if(actionID == WLQ_DEFINES.pdmChannel3){
wlqData.setActionValue(action: actionID!, value: UInt8(self.typePicker.selectedRow(inComponent: 0)))
} else if(actionID == WLQ_DEFINES.pdmChannel4){
wlqData.setActionValue(action: actionID!, value: UInt8(self.typePicker.selectedRow(inComponent: 0)))
} else { // Key
let keyType:UInt8 = (UInt8)(self.typePicker.selectedRow(inComponent: 0))
var key:UInt8 = 0x00
Expand Down Expand Up @@ -141,11 +158,11 @@ class HWSettingsActionViewController: UIViewController, UIPickerViewDataSource,
keyPicker.delegate = self
keyPicker.dataSource = self

if(actionID == WLQ_N_DEFINES.KEYMODE || actionID == WLQ_X_DEFINES.KEYMODE || actionID == WLQ_S_DEFINES.KEYMODE){ // KEYMODE
if(actionID == WLQ_DEFINES.KEYMODE){ // KEYMODE
typePicker.selectRow(Int(wlqData.getKeyMode()), inComponent: 0, animated: true)
keyPicker.isHidden = true
modifierMultiPicker.isHidden = true
} else if(actionID == WLQ_N_DEFINES.USB){ // USB
} else if(actionID == WLQ_DEFINES.USB){ // USB
if (wlqData.getVINThreshold() == 0x0000){
typePicker.selectRow(0, inComponent: 0, animated: true)
} else if (wlqData.getVINThreshold() == 0xFFFF){
Expand All @@ -155,12 +172,28 @@ class HWSettingsActionViewController: UIViewController, UIPickerViewDataSource,
}
keyPicker.isHidden = true
modifierMultiPicker.isHidden = true
} else if(actionID == WLQ_N_DEFINES.RTKDoublePressSensitivity || actionID == WLQ_X_DEFINES.RTKDoublePressSensitivity){ // RTK Sensititvity
typePicker.selectRow((Int)(wlqData.getDoublePressSensitivity()) - 1, inComponent: 0, animated: true)
} else if(actionID == WLQ_DEFINES.doublePressSensitivity){ // RTK Sensititvity
typePicker.selectRow((Int)(wlqData.getActionValueRaw(action: actionID!)!) - 1, inComponent: 0, animated: true)
keyPicker.isHidden = true
modifierMultiPicker.isHidden = true
} else if(actionID == WLQ_DEFINES.longPressSensitivity){ // Full Sensititvity
typePicker.selectRow((Int)(wlqData.getActionValueRaw(action: actionID!)!) - 1, inComponent: 0, animated: true)
keyPicker.isHidden = true
modifierMultiPicker.isHidden = true
} else if(actionID == WLQ_DEFINES.pdmChannel1){
typePicker.selectRow((Int)(wlqData.getActionValueRaw(action: actionID!)!), inComponent: 0, animated: true)
keyPicker.isHidden = true
modifierMultiPicker.isHidden = true
} else if(actionID == WLQ_DEFINES.pdmChannel2){
typePicker.selectRow((Int)(wlqData.getActionValueRaw(action: actionID!)!), inComponent: 0, animated: true)
keyPicker.isHidden = true
modifierMultiPicker.isHidden = true
} else if(actionID == WLQ_DEFINES.pdmChannel3){
typePicker.selectRow((Int)(wlqData.getActionValueRaw(action: actionID!)!), inComponent: 0, animated: true)
keyPicker.isHidden = true
modifierMultiPicker.isHidden = true
} else if(actionID == WLQ_N_DEFINES.fullLongPressSensitivity || actionID == WLQ_X_DEFINES.fullLongPressSensitivity || actionID == WLQ_S_DEFINES.fullLongPressSensitivity){ // Full Sensititvity
typePicker.selectRow((Int)(wlqData.getLongPressSensitivity()) - 1, inComponent: 0, animated: true)
} else if(actionID == WLQ_DEFINES.pdmChannel4){
typePicker.selectRow((Int)(wlqData.getActionValueRaw(action: actionID!)!), inComponent: 0, animated: true)
keyPicker.isHidden = true
modifierMultiPicker.isHidden = true
} else { // Key Action
Expand Down Expand Up @@ -226,14 +259,16 @@ class HWSettingsActionViewController: UIViewController, UIPickerViewDataSource,

func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
if pickerView == typePicker {
if(actionID == WLQ_N_DEFINES.KEYMODE || actionID == WLQ_X_DEFINES.KEYMODE || actionID == WLQ_S_DEFINES.KEYMODE){ // KEYMODE
if(actionID == WLQ_DEFINES.KEYMODE ){ // KEYMODE
return keymodesPickerData.count
} else if(actionID == WLQ_N_DEFINES.USB){ // USB
} else if(actionID == WLQ_DEFINES.USB){ // USB
return usbPickerData.count
} else if(actionID == WLQ_N_DEFINES.RTKDoublePressSensitivity || actionID == WLQ_X_DEFINES.RTKDoublePressSensitivity){ // RTK Sensititvity
} else if(actionID == WLQ_DEFINES.doublePressSensitivity){ // RTK Sensititvity
return 20
} else if(actionID == WLQ_N_DEFINES.fullLongPressSensitivity || actionID == WLQ_X_DEFINES.fullLongPressSensitivity || actionID == WLQ_S_DEFINES.fullLongPressSensitivity){ // Full Sensititvity
} else if(actionID == WLQ_DEFINES.longPressSensitivity){ // Full Sensititvity
return 30
} else if(actionID == WLQ_DEFINES.pdmChannel1 || actionID == WLQ_DEFINES.pdmChannel2 || actionID == WLQ_DEFINES.pdmChannel3 || actionID == WLQ_DEFINES.pdmChannel4){
return pdmPickerData.count
} else {
if (wlqData.gethardwareVersion() == WLQ_N_DEFINES.hardwareVersion1){
return modePickerDataHW1.count
Expand All @@ -255,14 +290,16 @@ class HWSettingsActionViewController: UIViewController, UIPickerViewDataSource,

func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if (pickerView == typePicker) {
if(actionID == WLQ_N_DEFINES.KEYMODE || actionID == WLQ_X_DEFINES.KEYMODE || actionID == WLQ_S_DEFINES.KEYMODE){ // KEYMODE
if(actionID == WLQ_DEFINES.KEYMODE){ // KEYMODE
return keymodesPickerData[row]
} else if(actionID == WLQ_N_DEFINES.USB){ // USB
} else if(actionID == WLQ_DEFINES.USB){ // USB
return usbPickerData[row]
} else if(actionID == WLQ_N_DEFINES.RTKDoublePressSensitivity || actionID == WLQ_X_DEFINES.RTKDoublePressSensitivity){ // RTK Sensititvity
} else if(actionID == WLQ_DEFINES.doublePressSensitivity){ // RTK Sensititvity
return "\((row + 1) * 50)"
} else if(actionID == WLQ_N_DEFINES.fullLongPressSensitivity || actionID == WLQ_X_DEFINES.fullLongPressSensitivity || actionID == WLQ_S_DEFINES.fullLongPressSensitivity){ // Full Sensititvity
} else if(actionID == WLQ_DEFINES.longPressSensitivity){ // Full Sensititvity
return "\((row + 1) * 50)"
} else if(actionID == WLQ_DEFINES.pdmChannel1 || actionID == WLQ_DEFINES.pdmChannel2 || actionID == WLQ_DEFINES.pdmChannel3 || actionID == WLQ_DEFINES.pdmChannel4){
return pdmPickerData[row]
} else {
if (wlqData.gethardwareVersion() == WLQ_N_DEFINES.hardwareVersion1){
return modePickerDataHW1[row]
Expand All @@ -285,13 +322,13 @@ class HWSettingsActionViewController: UIViewController, UIPickerViewDataSource,

func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if pickerView == typePicker {
if (actionID == WLQ_N_DEFINES.KEYMODE || actionID == WLQ_X_DEFINES.KEYMODE || actionID == WLQ_S_DEFINES.KEYMODE){ // KEYMODE
if (actionID == WLQ_DEFINES.KEYMODE){ // KEYMODE
if (wlqData.getKeyMode() != row) {
saveButton.isHidden = false
} else {
saveButton.isHidden = true
}
} else if (actionID == WLQ_N_DEFINES.USB){ // USB
} else if (actionID == WLQ_DEFINES.USB){ // USB
if (wlqData.getVINThreshold() == 0x0000 && row == 0){
saveButton.isHidden = true
} else if (wlqData.getVINThreshold() == 0xFFFF && row == 2){
Expand All @@ -301,14 +338,20 @@ class HWSettingsActionViewController: UIViewController, UIPickerViewDataSource,
} else {
saveButton.isHidden = false
}
} else if (actionID == WLQ_N_DEFINES.RTKDoublePressSensitivity || actionID == WLQ_X_DEFINES.RTKDoublePressSensitivity){ // RTK Sensititvity
if (wlqData.getDoublePressSensitivity() != typePicker.selectedRow(inComponent: 0) + 1){
} else if (actionID == WLQ_DEFINES.doublePressSensitivity){ // RTK Sensititvity
if (wlqData.getActionValueRaw(action: actionID!)! != typePicker.selectedRow(inComponent: 0) + 1){
saveButton.isHidden = false
} else {
saveButton.isHidden = true
}
} else if (actionID == WLQ_DEFINES.longPressSensitivity){ // Full Sensititvity
if (wlqData.getActionValueRaw(action: actionID!)! != typePicker.selectedRow(inComponent: 0) + 1){
saveButton.isHidden = false
} else {
saveButton.isHidden = true
}
} else if (actionID == WLQ_N_DEFINES.fullLongPressSensitivity || actionID == WLQ_X_DEFINES.fullLongPressSensitivity || actionID == WLQ_S_DEFINES.fullLongPressSensitivity){ // Full Sensititvity
if (wlqData.getLongPressSensitivity() != typePicker.selectedRow(inComponent: 0) + 1){
} else if(actionID == WLQ_DEFINES.pdmChannel1 || actionID == WLQ_DEFINES.pdmChannel2 || actionID == WLQ_DEFINES.pdmChannel3 || actionID == WLQ_DEFINES.pdmChannel4){
if (Int(wlqData.getActionValue(action: actionID!)) != typePicker.selectedRow(inComponent: 0)){
saveButton.isHidden = false
} else {
saveButton.isHidden = true
Expand Down
Loading
Loading