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:
- 36:f55ce07292c9
- Parent:
- 35:7ee45f6d6484
- Child:
- 37:8fc7845ae95b
diff -r 7ee45f6d6484 -r f55ce07292c9 source/TargetManager.cpp --- a/source/TargetManager.cpp Thu Mar 30 15:06:01 2017 -0400 +++ b/source/TargetManager.cpp Wed Apr 05 22:24:50 2017 +0000 @@ -29,12 +29,12 @@ nerfus_ticker.start(target_info.timeout_ms); } -void TargetManager::execute(const std::vector<uint8_t>& target_info_bytes) +void TargetManager::execute(std::vector<uint8_t>& target_info_bytes, int *address) { - const int id = target_info_bytes[1]; - const TargetType type = (target_info_bytes[2] == 0) ? TARGET_TYPE_ALLY : TARGET_TYPE_ENEMY; - const int timeout_msb = target_info_bytes[3]; - const int timeout_lsb = target_info_bytes[4]; + const int id = target_info_bytes[0]; + const TargetType type = (target_info_bytes[1] == 0) ? TARGET_TYPE_ALLY : TARGET_TYPE_ENEMY; + const int timeout_msb = target_info_bytes[2]; + const int timeout_lsb = target_info_bytes[3]; const int timeout = (timeout_msb << 8) + timeout_lsb; const TargetInfo target_info = make_TargetInfo(id, type, timeout); execute(target_info);