Skip to content

Commit

Permalink
Merge pull request #20 from bricklife/release/1.8.4
Browse files Browse the repository at this point in the history
Release/1.8.4
  • Loading branch information
Shinichiro Oba authored Jul 8, 2019
2 parents f04c386 + fb5566b commit bd1d91d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
20 changes: 19 additions & 1 deletion BoostRemote/ControllerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,30 @@ class ControllerViewController: UIViewController {
}
}

private var timers: [BoostBLEKit.Port: Timer] = [:]
private var waitingCommands: [BoostBLEKit.Port: Command] = [:]

private func sendCommand(port: BoostBLEKit.Port, power: Int8) {
if let command = connectedHub?.motorPowerCommand(port: port, power: power) {
guard let command = connectedHub?.motorStartPowerCommand(port: port, power: power) else { return }

if timers[port] != nil {
waitingCommands[port] = command
} else {
ActionCenter.send(command: command)
timers[port] = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(sendWaitingCommand), userInfo: port, repeats: false)
}
}

@objc private func sendWaitingCommand(_ timer: Timer) {
guard let port = timer.userInfo as? BoostBLEKit.Port else { return }
timers[port] = nil

guard let command = waitingCommands[port] else { return }
waitingCommands[port] = nil

ActionCenter.send(command: command)
}

private func alert(message: String) {
let alert = UIAlertController(title: NSLocalizedString("CAUTION", comment: "CAUTION"), message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
Expand Down
4 changes: 2 additions & 2 deletions BoostRemote/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.8.3</string>
<string>1.8.4</string>
<key>CFBundleVersion</key>
<string>24</string>
<string>25</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSBluetoothPeripheralUsageDescription</key>
Expand Down
1 change: 0 additions & 1 deletion BoostRemote/MoveHubManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class MoveHubManager: NSObject {

func disconnect() {
write(data: Data([0x04, 0x00, 0x02, 0x01])) // Switch Off Hub
reset()
}

func reset() {
Expand Down
2 changes: 1 addition & 1 deletion BoostRemote/Settings.bundle/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<key>Type</key>
<string>PSTitleValueSpecifier</string>
<key>DefaultValue</key>
<string>1.8.3</string>
<string>1.8.4</string>
<key>Title</key>
<string>Version</string>
<key>Key</key>
Expand Down
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "ReSwift/ReSwift" "4.1.1"
github "ReSwift/ReSwift" "5.0.0"
github "ReactiveCocoa/ReactiveSwift" "6.1.0"
github "bricklife/BoostBLEKit" "2.2.0"
github "bricklife/BoostBLEKit" "3.0.0"

0 comments on commit bd1d91d

Please sign in to comment.