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 NerfUS

Revision:
50:8cf0be9a61db
Parent:
46:853966aab733
--- a/source/TargetManager.cpp	Tue Apr 11 20:00:27 2017 +0000
+++ b/source/TargetManager.cpp	Wed Apr 12 14:30:01 2017 +0000
@@ -47,10 +47,11 @@
 
 void TargetManager::target_hit(int target_number)
 {
-	if(is_active_target[target_number] && nerfus_tickers[target_number]->get_time_ms() > 750)
+	const int time_ms = nerfus_tickers[target_number]->get_time_ms();
+	if(is_active_target[target_number] && time_ms > 750)
 	{
 		is_active_target[target_number] = false;
-		targets[target_number]->hit(nerfus_tickers[target_number]->get_time_ms());
+		targets[target_number]->hit(time_ms);
 		nerfus_tickers[target_number]->stop();
 	}
 }