NerfUS mobile node that manages a target for the Nerf gun firing range
Dependencies: LedController mbed-rtos mbed NerfUSXbee Servomotor TargetManager
Fork of NerfUS by
Diff: source/TargetManager.cpp
- Revision:
- 34:85994e0501fb
- Parent:
- 32:50b777bab5a4
- Child:
- 35:7ee45f6d6484
diff -r 860ed7757673 -r 85994e0501fb source/TargetManager.cpp --- a/source/TargetManager.cpp Thu Mar 30 14:11:35 2017 -0400 +++ b/source/TargetManager.cpp Thu Mar 30 14:38:38 2017 -0400 @@ -11,26 +11,22 @@ } } -void TargetManager::execute(const std::vector<TargetInfo> sequence) +void TargetManager::execute(const TargetInfo& target_info) { - for(int i=0; i<sequence.size(); i++) - { - const TargetInfo& target_info = sequence[i]; - TargetInterface& target = *(targets[target_info.id]); + TargetInterface& target = *(targets[target_info.id]); - if(target_info.type == TARGET_TYPE_ALLY) - { - target.ally_command(); - } - else - { - target.enemy_command(); - } + if(target_info.type == TARGET_TYPE_ALLY) + { + target.ally_command(); + } + else + { + target.enemy_command(); + } - is_active_target[target_info.id] = true; + is_active_target[target_info.id] = true; - nerfus_ticker.start(target_info.timeout_ms); - } + nerfus_ticker.start(target_info.timeout_ms); } void TargetManager::target_hit(int target_number)