Back to main index

Tracing and debugging

Generino has an integrated tracing feature that allows events and states to be printed on the Arduino serial port.

Tracing generation is activated by appending ENABLE TRACE to the FILE declaration:

FILE "test1/test1.ino" ENABLE TRACE

Once activated, this option generates code that traces the execution of the state machines on the usual serial port.

The produced log will look like this:

0ms OBJECT displ SET TIMER sensorPoll TO EXPIRE IN 1800ms
1800ms OBJECT displ IN STATE ready RECEIVED TIMER TIMER sensorPoll
1800ms OBJECT displ SET TIMER sensorPoll TO EXPIRE IN 1800ms
3600ms OBJECT displ IN STATE ready RECEIVED TIMER TIMER sensorPoll
3600ms OBJECT displ SET TIMER sensorPoll TO EXPIRE IN 1800ms
3703ms OBJECT rot CHANGED STATE FROM waitingForClear TO waitingForGuard
3810ms OBJECT rot CHANGED STATE FROM waitingForGuard TO waitingForRotation
3915ms OBJECT rot SEND EVENT trigger_cw VIA action TO rotary@displ
3915ms OBJECT rot CHANGED STATE FROM waitingForRotation TO waitingForClear
3995ms OBJECT displ IN STATE ready RECEIVED EVENT trigger_cw FROM PORT rotary
4172ms OBJECT rot CHANGED STATE FROM waitingForClear TO waitingForGuard
5400ms OBJECT displ IN STATE ready RECEIVED TIMER TIMER sensorPoll
5400ms OBJECT displ SET TIMER sensorPoll TO EXPIRE IN 1800ms
6719ms OBJECT btn1 SEND EVENT trigger VIA action TO inCommand1@logic
6719ms OBJECT btn1 SET TIMER antiBounce TO EXPIRE IN 50ms
6719ms OBJECT btn1 CHANGED STATE FROM depressed TO pressedDeaf
6719ms OBJECT logic IN STATE bothOff RECEIVED EVENT trigger FROM PORT inCommand1
6719ms OBJECT logic SEND EVENT on VIA out1 TO commands@led1
6719ms OBJECT logic SEND EVENT off VIA out2 TO commands@led2
6719ms OBJECT logic CHANGED STATE FROM bothOff TO firstOn
7120ms OBJECT btn1 IN STATE pressedDeaf RECEIVED TIMER TIMER antiBounce
7120ms OBJECT btn1 SET TIMER antiBounce TO EXPIRE IN 50ms
7120ms OBJECT btn1 SEND EVENT released VIA action TO inCommand1@logic
7120ms OBJECT btn1 CHANGED STATE FROM pressedDeaf TO depressedDeaf
7120ms OBJECT led1 IN STATE disabled RECEIVED EVENT on FROM PORT commands
7120ms OBJECT led1 SET TIMER blink TO EXPIRE IN 1000ms
7120ms OBJECT led1 CHANGED STATE FROM disabled TO enabled_on