diff --git a/ios/Info.plist b/ios/Info.plist index 08bc55ff6..cc3cf9be6 100644 --- a/ios/Info.plist +++ b/ios/Info.plist @@ -2,108 +2,107 @@ - CFBundleDisplayName - $(Vesc Tool) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleGetInfoString - Created by Qt/QMake - CFBundleIdentifier - com.vesc-project.vesc-tool - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - Debug-iphoneos - CFBundleSignature - ???? - CFBundleVersion - 1.4 - ITSAppUsesNonExemptEncryption - - LSApplicationCategoryType - - LSFileQuarantineEnabled - - LSRequiresIPhoneOS - - LSSupportsOpeningDocumentsInPlace - - NOTE - This file was generated by Qt/QMake. - NSBluetoothAlwaysUsageDescription - Need access to connect to VESC - NSBluetoothPeripheralUsageDescription - $(PRODUCT_NAME) searches Bluetooth LE Devices (WaiterLock, Barcode Scanner, eGK) - NSDocumentsFolderUsageDescription - Saves log files here - NSLocationAlwaysAndWhenInUseUsageDescription - Used for Ride Tracking - NSLocationAlwaysUsageDescription - Used for Ride Tracking - NSLocationWhenInUseUsageDescription - Used for Ride Tracking - NSPhotoLibraryUsageDescription - $(PRODUCT_NAME) uses photos - NSSupportsAutomaticGraphicsSwitching - - UIBackgroundModes - - location - external-accessory - bluetooth-central - - UIFileSharingEnabled - - UILaunchImages - - - UILaunchImageMinimumOSVersion - 7.0 - UILaunchImageName - LaunchImage - UILaunchImageOrientation - Portrait - UILaunchImageSize - {375, 667} - - - UILaunchImageMinimumOSVersion - 7.0 - UILaunchImageName - LaunchImage - UILaunchImageOrientation - Portrait - UILaunchImageSize - {320, 568} - - - UILaunchImageMinimumOSVersion - 7.0 - UILaunchImageName - LaunchImage - UILaunchImageOrientation - Portrait - UILaunchImageSize - {360, 640} - - - UILaunchStoryboardName - MyLaunchScreen - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIRequiresFullScreen - - UISupportsDocumentBrowser - - UIViewEdgeAntialiasing - + CFBundleDisplayName + $(Vesc Tool) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleGetInfoString + Created by Qt/QMake + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + ITSAppUsesNonExemptEncryption + + LSApplicationCategoryType + + LSFileQuarantineEnabled + + LSRequiresIPhoneOS + + LSSupportsOpeningDocumentsInPlace + + NOTE + This file was generated by Qt/QMake. + NSBluetoothAlwaysUsageDescription + Need access to connect to VESC + NSBluetoothPeripheralUsageDescription + $(PRODUCT_NAME) searches Bluetooth LE Devices (WaiterLock, Barcode Scanner, eGK) + NSDocumentsFolderUsageDescription + Saves log files here + NSLocationAlwaysAndWhenInUseUsageDescription + Used for Ride Tracking + NSLocationAlwaysUsageDescription + Used for Ride Tracking + NSLocationWhenInUseUsageDescription + Used for Ride Tracking + NSPhotoLibraryUsageDescription + $(PRODUCT_NAME) uses photos + NSSupportsAutomaticGraphicsSwitching + + UIBackgroundModes + + location + bluetooth-central + + UIFileSharingEnabled + + UILaunchImages + + + UILaunchImageMinimumOSVersion + 7.0 + UILaunchImageName + LaunchImage + UILaunchImageOrientation + Portrait + UILaunchImageSize + {375, 667} + + + UILaunchImageMinimumOSVersion + 7.0 + UILaunchImageName + LaunchImage + UILaunchImageOrientation + Portrait + UILaunchImageSize + {320, 568} + + + UILaunchImageMinimumOSVersion + 7.0 + UILaunchImageName + LaunchImage + UILaunchImageOrientation + Portrait + UILaunchImageSize + {360, 640} + + + UILaunchStoryboardName + MyLaunchScreen + UIRequiresFullScreen + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportsDocumentBrowser + + UIViewEdgeAntialiasing + diff --git a/mobile/ConnectScreen.qml b/mobile/ConnectScreen.qml index 5e8375b5c..94033d838 100644 --- a/mobile/ConnectScreen.qml +++ b/mobile/ConnectScreen.qml @@ -286,7 +286,8 @@ Item { preferredDialog.open() } else { disableDialog() - VescIf.connectBle(bleAddr) + preferredDialog.bleAddr = bleAddr + workaroundTimerConnectPref.start() } } } @@ -510,12 +511,21 @@ Item { bleModel.clear() mBle.emitScanDone() disableDialog() - VescIf.connectBle(bleAddr) + workaroundTimerConnectPref.start() } onRejected: { disableDialog() - VescIf.connectBle(bleAddr) + workaroundTimerConnectPref.start() + } + Timer { + id: workaroundTimerConnectPref + interval: 0 + repeat: false + running: false + onTriggered: { + VescIf.connectBle(preferredDialog.bleAddr) + } } } diff --git a/mobile/DirectionSetup.qml b/mobile/DirectionSetup.qml index 174aed9b9..8884b4c5e 100644 --- a/mobile/DirectionSetup.qml +++ b/mobile/DirectionSetup.qml @@ -38,7 +38,16 @@ Item { function scanCan() { disableDialog() - setCanDevs(Utility.scanCanVescOnly(VescIf)) + workaroundTimerCanScan.start() + } + Timer { + id: workaroundTimerCanScan + interval: 0 + repeat: false + running: false + onTriggered: { + setCanDevs(Utility.scanCanVescOnly(VescIf)) + } } function setCanDevs(canDevs) { @@ -142,13 +151,23 @@ Item { } Switch { + id: invertSwitch Layout.alignment: Qt.AlignHCenter | Qt.AlignTop enabled: true checked: isInv onToggled: { disableDialog() - Utility.setInvertDirection(VescIf, isCan ? canId : -1, checked) - enableDialog() + workaroundTimerInvertSwitch.start() + } + Timer { + id: workaroundTimerInvertSwitch + interval: 0 + repeat: false + running: false + onTriggered: { + Utility.setInvertDirection(VescIf, isCan ? canId : -1, invertSwitch.checked) + enableDialog() + } } } } @@ -165,8 +184,17 @@ Item { onClicked: { disableDialog() - Utility.testDirection(VescIf, isCan ? canId : -1, 0.1, 2000) - enableDialog() + workaroundTimerFWD.start() + } + Timer { + id: workaroundTimerFWD + interval: 0 + repeat: false + running: false + onTriggered: { + Utility.testDirection(VescIf, isCan ? canId : -1, 0.1, 2000) + enableDialog() + } } } @@ -178,8 +206,17 @@ Item { onClicked: { disableDialog() - Utility.testDirection(VescIf, isCan ? canId : -1, -0.1, 2000) - enableDialog() + workaroundTimerBWD.start() + } + Timer { + id: workaroundTimerBWD + interval: 0 + repeat: false + running: false + onTriggered: { + Utility.testDirection(VescIf, isCan ? canId : -1, -0.1, 2000) + enableDialog() + } } } } diff --git a/mobile/MultiSettings.qml b/mobile/MultiSettings.qml index 269f8926b..934cb4c5c 100644 --- a/mobile/MultiSettings.qml +++ b/mobile/MultiSettings.qml @@ -46,12 +46,20 @@ Item { "CAN-forwarding must be disabled for multi setup to work.", false, false) return } - - dialog.open() - - disableDialog("Scanning CAN-bus...") - canDevs = Utility.scanCanVescOnly(VescIf) - enableDialog() + workaroundTimerOpenDialog.start() + } + Timer { + id: workaroundTimerOpenDialog + interval: 0 + repeat: false + running: false + onTriggered: { + dialog.open() + + disableDialog("Scanning CAN-bus...") + canDevs = Utility.scanCanVescOnly(VescIf) + enableDialog() + } } Dialog { @@ -180,8 +188,17 @@ Item { onClicked: { disableDialog("Writing Parameters...") - Utility.setMcParamsFromCurrentConfigAllCan(VescIf, canDevs, paramListGeneral.getParamNames()) - enableDialog() + workaroundTimerWriteGeneralAll.start() + } + Timer { + id: workaroundTimerWriteGeneralAll + interval: 0 + repeat: false + running: false + onTriggered: { + Utility.setMcParamsFromCurrentConfigAllCan(VescIf, canDevs, paramListGeneral.getParamNames()) + enableDialog() + } } } Button { @@ -218,11 +235,19 @@ Item { Button { Layout.fillWidth: true text: "Write Limits to All VESCs" - onClicked: { disableDialog("Writing Parameters...") - Utility.setMcParamsFromCurrentConfigAllCan(VescIf, canDevs, paramListLimits.getParamNames()) - enableDialog() + workaroundTimerWriteLimitsAll.start() + } + Timer { + id: workaroundTimerWriteLimitsAll + interval: 0 + repeat: false + running: false + onTriggered: { + Utility.setMcParamsFromCurrentConfigAllCan(VescIf, canDevs, paramListLimits.getParamNames()) + enableDialog() + } } } Button { @@ -295,8 +320,17 @@ Item { onClicked: { disableDialog("Writing Parameters...") - Utility.setMcParamsFromCurrentConfigAllCan(VescIf, canDevs, paramListFoc.getParamNames()) - enableDialog() + workaroundTimerWriteFOCAll.start() + } + Timer { + id: workaroundTimerWriteFOCAll + interval: 0 + repeat: false + running: false + onTriggered: { + Utility.setMcParamsFromCurrentConfigAllCan(VescIf, canDevs, paramListFoc.getParamNames()) + enableDialog() + } } } Button { @@ -336,8 +370,17 @@ Item { onClicked: { disableDialog("Writing Parameters...") - Utility.setMcParamsFromCurrentConfigAllCan(VescIf, canDevs, paramListBms.getParamNames()) - enableDialog() + workaroundTimerWriteBMSAll.start() + } + Timer { + id: workaroundTimerWriteBMSAll + interval: 0 + repeat: false + running: false + onTriggered: { + Utility.setMcParamsFromCurrentConfigAllCan(VescIf, canDevs, paramListBms.getParamNames()) + enableDialog() + } } } Button { diff --git a/mobile/SetupWizardFoc.qml b/mobile/SetupWizardFoc.qml index b6271f3bb..f9218cb39 100755 --- a/mobile/SetupWizardFoc.qml +++ b/mobile/SetupWizardFoc.qml @@ -724,8 +724,17 @@ Item { onAccepted: { disableDialog() - Utility.restoreConfAll(VescIf, true, true, true) - enableDialog() + workaroundTimerLoadDefaultDialog.start() + } + Timer { + id: workaroundTimerLoadDefaultDialog + interval: 0 + repeat: false + running: false + onTriggered: { + Utility.restoreConfAll(VescIf, true, true, true) + enableDialog() + } } } @@ -765,13 +774,21 @@ Item { // have damaged their battery by forgetting to set this number properly and overdischarge // their battery. disableDialog() - var val = Utility.getMcValuesBlocking(VescIf) - enableDialog() - - if (val.v_in > 39.0 && val.v_in < 51.0) { - mMcConf.updateParamInt("si_battery_cells", 12) - } else { - mMcConf.updateParamInt("si_battery_cells", 3) + workaroundTimerStartWarningDialog.start() + } + Timer { + id: workaroundTimerStartWarningDialog + interval: 0 + repeat: false + running: false + onTriggered: { + var val = Utility.getMcValuesBlocking(VescIf) + enableDialog() + if (val.v_in > 39.0 && val.v_in < 51.0) { + mMcConf.updateParamInt("si_battery_cells", 12) + } else { + mMcConf.updateParamInt("si_battery_cells", 3) + } } } } @@ -852,68 +869,76 @@ Item { mMcConf.updateParamDouble("si_gear_ratio", directDriveBox.checked ? 1 : (wheelPulleyBox.value / motorPulleyBox.value), null) - mCommands.setMcconf(false) - Utility.waitSignal(mCommands, "2ackReceived(QString)", 4000) + workaroundTimerDetectDialog.start() + } + Timer { + id: workaroundTimerDetectDialog + interval: 0 + repeat: false + running: false + + onTriggered: { + Utility.waitSignal(mCommands, "2ackReceived(QString)", 4000) + + if (detectCanBox.checked) { + detectDialog.canDevs = Utility.scanCanVescOnly(VescIf) + } else { + detectDialog.canDevs = [] + } - if (detectCanBox.checked) { - canDevs = Utility.scanCanVescOnly(VescIf) - } else { - canDevs: [] - } + if (!Utility.setBatteryCutCan(VescIf, detectDialog.canDevs, 6.0, 6.0)) { + enableDialog() + return + } - if (!Utility.setBatteryCutCan(VescIf, canDevs, 6.0, 6.0)) { - enableDialog() - return - } + var res = Utility.detectAllFoc(VescIf, detectCanBox.checked, + maxPowerLossBox.realValue, + currentInMinBox.realValue, + currentInMaxBox.realValue, + openloopErpmBox.realValue, + sensorlessBox.realValue) - var res = Utility.detectAllFoc(VescIf, detectCanBox.checked, - maxPowerLossBox.realValue, - currentInMinBox.realValue, - currentInMaxBox.realValue, - openloopErpmBox.realValue, - sensorlessBox.realValue) + var resDetect = false + if (res.startsWith("Success!")) { + resDetect = true - var resDetect = false - if (res.startsWith("Success!")) { - resDetect = true + Utility.setBatteryCutCanFromCurrentConfig(VescIf, detectDialog.canDevs) - Utility.setBatteryCutCanFromCurrentConfig(VescIf, canDevs) + var updateAllParams = ["l_duty_start"] - var updateAllParams = ["l_duty_start"] + // Temperature compensation means that the motor can be tracked at lower + // speed across a broader temperature range. Therefore openloop_erpm + // can be decreased. + if (mMcConf.getParamBool("foc_temp_comp")) { + var openloopErpm = mMcConf.getParamDouble("foc_openloop_rpm") + mMcConf.updateParamDouble("foc_openloop_rpm", openloopErpm / 2.0, null) + updateAllParams.push("foc_openloop_rpm") + } - // Temperature compensation means that the motor can be tracked at lower - // speed across a broader temperature range. Therefore openloop_erpm - // can be decreased. - if (mMcConf.getParamBool("foc_temp_comp")) { - var openloopErpm = mMcConf.getParamDouble("foc_openloop_rpm") - mMcConf.updateParamDouble("foc_openloop_rpm", openloopErpm / 2.0, null) - updateAllParams.push("foc_openloop_rpm") - } + // Set sensor mode to HFI start if the motor is sensorless, the firmware supports it + // and the motor and application suggest it. + if (mMcConf.getParamEnumNames("foc_sensor_mode").length >= 5 && + mMcConf.getParamEnum("foc_sensor_mode") === 0 && + usageList.currentItem.modelData.hfi_start && + motorList.currentItem.modelData.hfi_start) { + mMcConf.updateParamEnum("foc_sensor_mode", 4, null) + updateAllParams.push("foc_sensor_mode") + } - // Set sensor mode to HFI start if the motor is sensorless, the firmware supports it - // and the motor and application suggest it. - if (mMcConf.getParamEnumNames("foc_sensor_mode").length >= 5 && - mMcConf.getParamEnum("foc_sensor_mode") === 0 && - usageList.currentItem.modelData.hfi_start && - motorList.currentItem.modelData.hfi_start) { - mMcConf.updateParamEnum("foc_sensor_mode", 4, null) - updateAllParams.push("foc_sensor_mode") + Utility.setMcParamsFromCurrentConfigAllCan(VescIf, detectDialog.canDevs, updateAllParams) } + enableDialog() - Utility.setMcParamsFromCurrentConfigAllCan(VescIf, canDevs, updateAllParams) - } - - enableDialog() + if (resDetect) { + stackLayout.currentIndex++ + updateButtonText() + } - if (resDetect) { - stackLayout.currentIndex++ - updateButtonText() + resultDialog.title = "Detection Result" + resultLabel.text = res + resultDialog.open() } - - resultDialog.title = "Detection Result" - resultLabel.text = res - resultDialog.open() } } diff --git a/mobile/SetupWizardInput.qml b/mobile/SetupWizardInput.qml index 4bc0ade92..48d603d0e 100644 --- a/mobile/SetupWizardInput.qml +++ b/mobile/SetupWizardInput.qml @@ -35,34 +35,42 @@ Item { property bool isHorizontal: width > height function openDialog() { - canIdModel.clear() - stackLayout.currentIndex = 0 - updateButtonText() - - mSendCanAtStart = mCommands.getSendCan() - mCanIdAtStart = mCommands.getCanSendId() - - if (mCommands.getSendCan()) { - canIdModel.append({"name": "This VESC (CAN FWD)", - "canId": mAppConf.getParamInt("controller_id"), - "isCan": true}) - dialog.open() - canScanBar.value = 100 - } else { - canIdModel.append({"name": "This VESC", - "canId": mAppConf.getParamInt("controller_id"), - "isCan": false}) - dialog.open() - disableDialog() - var canDevs = Utility.scanCanVescOnly(VescIf) + workaroundTimerOpen.start() + } + Timer { + id: workaroundTimerOpen + interval: 0 + repeat: false + running: false + onTriggered: { + canIdModel.clear() + stackLayout.currentIndex = 0 + updateButtonText() + + mSendCanAtStart = mCommands.getSendCan() + mCanIdAtStart = mCommands.getCanSendId() - for (var i = 0;i < canDevs.length;i++) { - canIdModel.append({"name": "VESC on CAN-bus", - "canId": canDevs[i], + if (mCommands.getSendCan()) { + canIdModel.append({"name": "This VESC (CAN FWD)", + "canId": mAppConf.getParamInt("controller_id"), "isCan": true}) + dialog.open() + canScanBar.value = 100 + } else { + canIdModel.append({"name": "This VESC", + "canId": mAppConf.getParamInt("controller_id"), + "isCan": false}) + dialog.open() + disableDialog() + var canDevs = Utility.scanCanVescOnly(VescIf) + + for (var i = 0;i < canDevs.length;i++) { + canIdModel.append({"name": "VESC on CAN-bus", + "canId": canDevs[i], + "isCan": true}) + } + enableDialog() } - - enableDialog() } } @@ -474,132 +482,141 @@ Item { flat: true onClicked: { - if (stackLayout.currentIndex < (stackLayout.count - 1)) { - var apptype = inputList.currentItem.modelData.apptype - var ppmMap_wasVisible = ppmMap.visible - - stackLayout.currentIndex++ - - if (stackLayout.currentIndex == 1) { - // Type page - mCommands.setSendCan(canIdList.currentItem.modelData.isCan, - canIdList.currentItem.modelData.canId) - - disableDialog() - var res = Utility.resetInputCan(VescIf, VescIf.getCanDevsLast()) - enableDialog() - - if (!res) { - closeWizard(false) - } - } else if (stackLayout.currentIndex == 2) { - // Map page - adcMap.visible = false - ppmMap.visible = false - nrfPairBox.visible = false - paramsMap.clear() - - mAppConf.updateParamEnum("app_ppm_conf.ctrl_type", 0, null) - mAppConf.updateParamEnum("app_adc_conf.ctrl_type", 0, null) - mAppConf.updateParamEnum("app_to_use", apptype, null) - mAppConf.updateParamBool("app_ppm_conf.multi_esc", true, null) - mAppConf.updateParamBool("app_adc_conf.multi_esc", true, null) - mAppConf.updateParamBool("app_chuk_conf.multi_esc", true, null) - mCommands.setAppConf() + workaroundTimerNext.start() + } + Timer { + id: workaroundTimerNext + interval: 0 + repeat: false + running: false + onTriggered: { + if (stackLayout.currentIndex < (stackLayout.count - 1)) { + var apptype = inputList.currentItem.modelData.apptype + var ppmMap_wasVisible = ppmMap.visible + + stackLayout.currentIndex++ + + if (stackLayout.currentIndex == 1) { + // Type page + mCommands.setSendCan(canIdList.currentItem.modelData.isCan, + canIdList.currentItem.modelData.canId) + + disableDialog() + var res = Utility.resetInputCan(VescIf, VescIf.getCanDevsLast()) + enableDialog() + + if (!res) { + closeWizard(false) + } + } else if (stackLayout.currentIndex == 2) { + // Map page + adcMap.visible = false + ppmMap.visible = false + nrfPairBox.visible = false + paramsMap.clear() + + mAppConf.updateParamEnum("app_ppm_conf.ctrl_type", 0, null) + mAppConf.updateParamEnum("app_adc_conf.ctrl_type", 0, null) + mAppConf.updateParamEnum("app_to_use", apptype, null) + mAppConf.updateParamBool("app_ppm_conf.multi_esc", true, null) + mAppConf.updateParamBool("app_adc_conf.multi_esc", true, null) + mAppConf.updateParamBool("app_chuk_conf.multi_esc", true, null) + mCommands.setAppConf() + + if (apptype === 4) { + // PPM and UART + ppmMap.visible = true + } else if (apptype === 3) { + // UART only (for NRF nunchuk) + nrfPairBox.visible = true + nextButton.clicked() + nrfPairStartDialog.open() + return + } else if (apptype === 5) { + // ADC and UART + adcMap.visible = true + paramsMap.addEditorApp("app_adc_conf.voltage_inverted") + paramsMap.addEditorApp("app_adc_conf.voltage2_inverted") + paramsMap.addSpacer() + } else if (apptype === 6) { + // Nyko Kama + nextButton.clicked() + return + } - if (apptype === 4) { - // PPM and UART - ppmMap.visible = true - } else if (apptype === 3) { - // UART only (for NRF nunchuk) - nrfPairBox.visible = true - nextButton.clicked() - nrfPairStartDialog.open() - return - } else if (apptype === 5) { - // ADC and UART - adcMap.visible = true - paramsMap.addEditorApp("app_adc_conf.voltage_inverted") - paramsMap.addEditorApp("app_adc_conf.voltage2_inverted") - paramsMap.addSpacer() - } else if (apptype === 6) { - // Nyko Kama - nextButton.clicked() - return - } + mapResetTimer.restart() + } else if (stackLayout.currentIndex == 3) { + // Config page + disableDialog() - mapResetTimer.restart() - } else if (stackLayout.currentIndex == 3) { - // Config page - disableDialog() + if (ppmMap_wasVisible) { + if (ppmMap.isValid()) { + ppmMap.applyMapping() + Utility.waitSignal(mCommands, "2ackReceived(QString)", 2000) + } + } - if (ppmMap_wasVisible) { - if (ppmMap.isValid()) { - ppmMap.applyMapping() - Utility.waitSignal(mCommands, "2ackReceived(QString)", 2000) + // Setup page + paramsConf.clear() + mAppConf.updateParamEnum("app_ppm_conf.ctrl_type", 3, null) + mAppConf.updateParamEnum("app_adc_conf.ctrl_type", 1, null) + mCommands.setAppConf() + Utility.waitSignal(mCommands, "2ackReceived(QString)", 2000) + + enableDialog() + + if (apptype === 4) { + // PPM and UART + paramsConf.addSeparator("General") + paramsConf.addEditorApp("app_ppm_conf.ctrl_type") + paramsConf.addEditorApp("app_ppm_conf.median_filter") + paramsConf.addEditorApp("app_ppm_conf.safe_start") + paramsConf.addEditorApp("app_ppm_conf.ramp_time_pos") + paramsConf.addEditorApp("app_ppm_conf.ramp_time_neg") + paramsConf.addEditorApp("app_ppm_conf.pid_max_erpm") + paramsConf.addEditorApp("app_ppm_conf.max_erpm_for_dir") + paramsConf.addEditorApp("app_ppm_conf.smart_rev_max_duty") + paramsConf.addEditorApp("app_ppm_conf.smart_rev_ramp_time") + paramsConf.addSeparator("Multiple VESCs over CAN-bus") + paramsConf.addEditorApp("app_ppm_conf.tc") + paramsConf.addEditorApp("app_ppm_conf.tc_max_diff") + } else if (apptype === 3 || apptype === 6) { + // NRF nunchuk or nyko kama + paramsConf.addSeparator("General") + paramsConf.addEditorApp("app_chuk_conf.ctrl_type") + paramsConf.addEditorApp("app_chuk_conf.ramp_time_pos") + paramsConf.addEditorApp("app_chuk_conf.ramp_time_neg") + paramsConf.addEditorApp("app_chuk_conf.stick_erpm_per_s_in_cc") + paramsConf.addEditorApp("app_chuk_conf.hyst") + paramsConf.addEditorApp("app_chuk_conf.use_smart_rev") + paramsConf.addEditorApp("app_chuk_conf.smart_rev_max_duty") + paramsConf.addEditorApp("app_chuk_conf.smart_rev_ramp_time") + paramsConf.addSeparator("Multiple VESCs over CAN-bus") + paramsConf.addEditorApp("app_chuk_conf.tc") + paramsConf.addEditorApp("app_chuk_conf.tc_max_diff") + } else if (apptype === 5) { + // ADC and UART + paramsConf.addSeparator("General") + paramsConf.addEditorApp("app_adc_conf.ctrl_type") + paramsConf.addEditorApp("app_adc_conf.use_filter") + paramsConf.addEditorApp("app_adc_conf.safe_start") + paramsConf.addEditorApp("app_adc_conf.cc_button_inverted") + paramsConf.addEditorApp("app_adc_conf.rev_button_inverted") + paramsConf.addEditorApp("app_adc_conf.ramp_time_pos") + paramsConf.addEditorApp("app_adc_conf.ramp_time_neg") + paramsConf.addSeparator("Multiple VESCs over CAN-bus") + paramsConf.addEditorApp("app_adc_conf.tc") + paramsConf.addEditorApp("app_adc_conf.tc_max_diff") } - } - // Setup page - paramsConf.clear() - mAppConf.updateParamEnum("app_ppm_conf.ctrl_type", 3, null) - mAppConf.updateParamEnum("app_adc_conf.ctrl_type", 1, null) - mCommands.setAppConf() - Utility.waitSignal(mCommands, "2ackReceived(QString)", 2000) - - enableDialog() - - if (apptype === 4) { - // PPM and UART - paramsConf.addSeparator("General") - paramsConf.addEditorApp("app_ppm_conf.ctrl_type") - paramsConf.addEditorApp("app_ppm_conf.median_filter") - paramsConf.addEditorApp("app_ppm_conf.safe_start") - paramsConf.addEditorApp("app_ppm_conf.ramp_time_pos") - paramsConf.addEditorApp("app_ppm_conf.ramp_time_neg") - paramsConf.addEditorApp("app_ppm_conf.pid_max_erpm") - paramsConf.addEditorApp("app_ppm_conf.max_erpm_for_dir") - paramsConf.addEditorApp("app_ppm_conf.smart_rev_max_duty") - paramsConf.addEditorApp("app_ppm_conf.smart_rev_ramp_time") - paramsConf.addSeparator("Multiple VESCs over CAN-bus") - paramsConf.addEditorApp("app_ppm_conf.tc") - paramsConf.addEditorApp("app_ppm_conf.tc_max_diff") - } else if (apptype === 3 || apptype === 6) { - // NRF nunchuk or nyko kama - paramsConf.addSeparator("General") - paramsConf.addEditorApp("app_chuk_conf.ctrl_type") - paramsConf.addEditorApp("app_chuk_conf.ramp_time_pos") - paramsConf.addEditorApp("app_chuk_conf.ramp_time_neg") - paramsConf.addEditorApp("app_chuk_conf.stick_erpm_per_s_in_cc") - paramsConf.addEditorApp("app_chuk_conf.hyst") - paramsConf.addEditorApp("app_chuk_conf.use_smart_rev") - paramsConf.addEditorApp("app_chuk_conf.smart_rev_max_duty") - paramsConf.addEditorApp("app_chuk_conf.smart_rev_ramp_time") - paramsConf.addSeparator("Multiple VESCs over CAN-bus") - paramsConf.addEditorApp("app_chuk_conf.tc") - paramsConf.addEditorApp("app_chuk_conf.tc_max_diff") - } else if (apptype === 5) { - // ADC and UART - paramsConf.addSeparator("General") - paramsConf.addEditorApp("app_adc_conf.ctrl_type") - paramsConf.addEditorApp("app_adc_conf.use_filter") - paramsConf.addEditorApp("app_adc_conf.safe_start") - paramsConf.addEditorApp("app_adc_conf.cc_button_inverted") - paramsConf.addEditorApp("app_adc_conf.rev_button_inverted") - paramsConf.addEditorApp("app_adc_conf.ramp_time_pos") - paramsConf.addEditorApp("app_adc_conf.ramp_time_neg") - paramsConf.addSeparator("Multiple VESCs over CAN-bus") - paramsConf.addEditorApp("app_adc_conf.tc") - paramsConf.addEditorApp("app_adc_conf.tc_max_diff") + paramsConf.addSpacer() } - - paramsConf.addSpacer() + } else { + closeWizard(true) } - } else { - closeWizard(true) - } - updateButtonText() + updateButtonText() + } } } } @@ -671,13 +688,21 @@ Item { function closeWizard(finished) { if (finished) { + workaroundTimerClose.start() + } + mCommands.setSendCan(mSendCanAtStart, mCanIdAtStart) + dialog.close() + } + Timer { + id: workaroundTimerClose + interval: 0 + repeat: false + running: false + onTriggered: { disableDialog() mCommands.setAppConf() Utility.waitSignal(mCommands, "2ackReceived(QString)", 2000) enableDialog() } - - mCommands.setSendCan(mSendCanAtStart, mCanIdAtStart) - dialog.close() } } diff --git a/mobile/StartPage.qml b/mobile/StartPage.qml index e99ae09c7..2cc5408a8 100644 --- a/mobile/StartPage.qml +++ b/mobile/StartPage.qml @@ -434,8 +434,17 @@ Item { onAccepted: { progDialog.open() - VescIf.confStoreBackup(true, "") - progDialog.close() + workaroundTimerBackup.start() + } + Timer { + id: workaroundTimerBackup + interval: 0 + repeat: false + running: false + onTriggered: { + VescIf.confStoreBackup(true, "") + progDialog.close() + } } } @@ -469,8 +478,17 @@ Item { onAccepted: { progDialog.open() - VescIf.confRestoreBackup(true) - progDialog.close() + workaroundTimerRestore.start() + } + Timer { + id: workaroundTimerRestore + interval: 0 + repeat: false + running: false + onTriggered: { + VescIf.confRestoreBackup(true) + progDialog.close() + } } }