Subversion Repositories programming

Rev

Rev 321 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 321 Rev 328
Line 17... Line 17...
17
    vector<Elevator> elevators (5, Elevator (10));
17
    vector<Elevator> elevators (5, Elevator (10));
18
 
18
 
19
    // start t1
19
    // start t1
20
    boost::thread t1 (boost::bind (e1.thread_entry, &e1));
20
    boost::thread t1 (boost::bind (e1.thread_entry, &e1));
21
 
21
 
22
#if 0
-
 
23
    // TEST MOVEMENT
-
 
24
 
-
 
25
    sleep (2);
-
 
26
    e1.set_direction (MOVE_UP);
-
 
27
    sleep (5);
-
 
28
    e1.thread_pause ();
-
 
29
    e1.set_direction (MOVE_DOWN);
-
 
30
    sleep (6);
-
 
31
    e1.thread_unpause ();
-
 
32
    e1.set_direction (IDLE);
-
 
33
    sleep (2);
-
 
34
#endif
-
 
35
 
-
 
36
#if 0
-
 
37
    // TEST floors_{above,below}_current() FUNCTIONS
-
 
38
    e1.push_button (3);
-
 
39
    printf ("AT POSITION 0\n");
-
 
40
    printf ("floors_above_current: %d\n", e1.floors_above_current());
-
 
41
    printf ("floors_below_current: %d\n\n", e1.floors_below_current());
-
 
42
 
-
 
43
    e1.goto_floor (2.9);
-
 
44
    printf ("AT POSITION 2.9\n");
-
 
45
    printf ("floors_above_current: %d\n", e1.floors_above_current());
-
 
46
    printf ("floors_below_current: %d\n\n", e1.floors_below_current());
-
 
47
 
-
 
48
    e1.goto_floor (3.1);
-
 
49
    printf ("AT POSITION 3.1\n");
-
 
50
    printf ("floors_above_current: %d\n", e1.floors_above_current());
-
 
51
    printf ("floors_below_current: %d\n\n", e1.floors_below_current());
-
 
52
 
-
 
53
    e1.goto_floor (3.0);
-
 
54
    printf ("AT POSITION 3.0\n");
-
 
55
    printf ("floors_above_current: %d\n", e1.floors_above_current());
-
 
56
    printf ("floors_below_current: %d\n\n", e1.floors_below_current());
-
 
57
#endif
-
 
58
 
-
 
59
#if 1
-
 
60
    // TEST MOVEMENT AGAIN
22
    // do some useful stuff here
61
    e1.push_button (2);
-
 
62
    sleep (10);
-
 
63
    e1.push_button (1);
-
 
64
    e1.push_button (3);
-
 
65
    sleep (10);
-
 
66
#endif
-
 
67
 
23
 
68
    // notify t1 that it needs to stop
24
    // notify t1 that it needs to stop
69
    e1.thread_exit ();
25
    e1.thread_exit ();
70
 
26
 
71
    // wait for t1 to stop
27
    // wait for t1 to stop