Skip to content

Commit

Permalink
WIP - trying new things
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Dec 19, 2023
1 parent 4b7cde6 commit 52699a6
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions Modules/RobotKit/Sources/RobotKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,40 @@ public class RobotKit {
// await action.object.execute()
// log.debug("execute action \(action) ✅")
// }

self.task = Task {
for action in self.actions {
guard self.task?.isCancelled == false else {
log.debug("Task cancelled, stopping robot kit")
// action.object.stop()
// action.object.stop()
return
}

self.currentAction = action
log.debug("execute action \(action)")
await action.object.execute()
// async let currentTask: () = action.object.execute()
// await currentTask
async let _ = action.object.execute()
// async let currentTask: () = action.object.execute()
// await currentTask
log.debug("execute action \(action)")
}
self.stop()
}

// self.task = Task {
// for action in self.actions {
// guard self.task?.isCancelled == false else {
// log.debug("Task cancelled, stopping robot kit")
//// action.object.stop()
// return
// }
// self.currentAction = action
// log.debug("execute action \(action)")
// await action.object.execute()
//// async let currentTask: () = action.object.execute()
//// await currentTask
// log.debug("execute action \(action) ✅")
// }
// self.stop()
// }
}

// public func executeSync() {
Expand Down Expand Up @@ -96,7 +113,7 @@ public class RobotKit {
// self.actions[self.currentActionIndex].object.stop()

self.task?.cancel()
self.currentAction?.object.cancel()
// self.currentAction?.object.cancel()
self.task = nil
self.currentAction = nil

Expand Down

0 comments on commit 52699a6

Please sign in to comment.