Emanuel Kuflik
/
smat_controller
541 smart traffic controller
Diff: simulator.cpp
- Revision:
- 7:fd8e0604faaa
- Parent:
- 5:e0d8e5e922f1
--- a/simulator.cpp Wed Dec 11 20:12:21 2019 +0000 +++ b/simulator.cpp Thu Dec 12 17:25:27 2019 +0000 @@ -11,7 +11,7 @@ #define MAGIC_NUMBER 2 -#define SIM_DEBUG +//#define SIM_DEBUG #define SIM_TAG "[SIM] " Serial pc(USBTX, USBRX); @@ -74,7 +74,7 @@ { AccCar* car = road->get_car(i); assert(car != NULL); - pc.printf(SIM_TAG "Car %d Road %d position %d : speed %d cycles: %d car_cycles %d "DELIM, i,road->get_road_id(), car->position,car->speed, road->get_road_clock(), car->get_cycles()); + pc.printf(SIM_TAG "Car %d Road %d position %d speed %d target %d cycles %d car_cycles %d "DELIM, i,road->get_road_id(), car->position,car->speed,car->get_target_speed(),road->get_road_clock(), car->get_cycles()); } //#ifdef SIM_DEBUG pc.printf(SIM_TAG " -------------- "DELIM); @@ -95,7 +95,7 @@ // ------------------------------------------------------------------------------ // seed rand number generator - srand(mqtt_singleton->mqtt_id); + //srand(mqtt_singleton->mqtt_id); // make new road based off of ID Road* road = new Road(mqtt_singleton->mqtt_id, mqtt_singleton); @@ -107,8 +107,8 @@ stopwatch.reset(); - bool other_simulating=false; - bool simulating = true; + int other_simulating; + int simulating; // //road->synchronize(simulating); @@ -164,7 +164,7 @@ // ---------------------------------------------------------------------- road->DESTROY_ALL_CARS(); - delete road->msg; + road->free_msg(); delete road; return 0; }