MCPcopy Create free account
hub / github.com/digint/tinyfsm / react

Method react

examples/elevator/elevator.cpp:44–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42: public Elevator
43{
44 void react(FloorSensor const & e) override {
45 int floor_expected = current_floor + Motor::getDirection();
46 if(floor_expected != e.floor)
47 {
48 std::cout << "Floor sensor defect (expected " << floor_expected << ", got " << e.floor << ")" << std::endl;
49 transit<Panic>(CallMaintenance);
50 }
51 else
52 {
53 std::cout << "Reached floor " << e.floor << std::endl;
54 current_floor = e.floor;
55 if(e.floor == dest_floor)
56 transit<Idle>();
57 }
58 };
59};
60
61

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected