Hi everyone.
I am currently doing some sphinx documentation and I am using dot to document our state machine.
For the simple state machine, it seems pretty good, but as things get more complex, I have some difficulties to have a proper render
I would really much enjoy some tips and tricks to improve the readibility if it is possible.
Thank you !
Here the rendered state machine:
And here the code:
digraph G {
# Init
init-> stopped [color=aquamarine4,style=bold,label=<<B>INIT</B><br/> <I>init(0)</I>>, fontcolor=aquamarine4];
# stopped
stopped -> Con_start [color=aquamarine4, style=bold,label=bold, label=<<B>START</B><br/> <I>cmd_start(1)</I>>,fontcolor=aquamarine4];
stopped -> Con_start [color=aquamarine4, style=bold,label=bold, label=<<B>STOP</B><br/> <I>cmd_stop(0)</I>>,fontcolor=aquamarine4];
stopped -> Con_start [color=aquamarine4, style=bold,label=bold, label=<<B>REQ_GET_STATUS</B><br/> <I>get_status(0)</I>>,fontcolor=aquamarine4];
stopped -> Con_start [color=aquamarine4, style=bold,label=bold, label=<<B>REQ_GET_STATS</B><br/> <I>get_stats(0)</I>>,fontcolor=aquamarine4];
stopped -> Con_start [color=aquamarine4, style=bold,label=bold, label=<<B>REQ_GET_COUNTERS</B><br/> <I>get_counters(0)</I>>,fontcolor=aquamarine4];
stopped -> Con_start [color=aquamarine4, style=bold,label=bold, label=<<B>REQ_CLEAR_COUNTERS</B><br/> <I>clear_counters(0)</I>>,fontcolor=aquamarine4];
Con_start -> stopped [color=deeppink4,style=bold];
Con_start -> w_ptp_time[color = crimson, style=bold,label=<<B>CND_START</B><br/> <I>start(0)</I>>, fontcolor=crimson];
# w_ptp_time
w_ptp_time-> stopped [color=aquamarine4,style=bold,label=<<B>STOP</B><br/> <I>cmd_stop(0)</I>>, fontcolor=aquamarine4];
w_ptp_time-> running [color=aquamarine4,style=bold,label=<<B>PTP_TIME_GOT</B><br/> <I>start_alarm(0)</I>>, fontcolor=aquamarine4];
w_ptp_time-> w_ptp_time [color=aquamarine4,style=bold,label=<<B>REQ_SET_SOURCE</B><br/> <I>set_source(0)</I>>, fontcolor=aquamarine4];
w_ptp_time-> w_ptp_time [color=aquamarine4,style=bold,label=<<B>REQ_GET_STATUS</B><br/> <I>get_status(0)</I>>, fontcolor=aquamarine4];
w_ptp_time-> w_ptp_time [color=aquamarine4,style=bold,label=<<B>REQ_GET_STATS</B><br/> <I>get_stats(0)</I>>, fontcolor=aquamarine4];
w_ptp_time-> w_ptp_time [color=aquamarine4,style=bold,label=<<B>REQ_GET_COUNTERS</B><br/> <I>get_counters(0)</I>>, fontcolor=aquamarine4];
# Running
running -> Con_stop [color=aquamarine4, style=bold,label=bold, label=<<B>STOP</B><br/> <I>cmd_stop(1)</I>>,fontcolor=aquamarine4];
running -> Con_stop [color=aquamarine4, style=bold,label=bold, label=<<B>REQ_SET_SOURCE</B><br/> <I>cmd_set_source(0)</I>>,fontcolor=aquamarine4];
running -> Con_stop [color=aquamarine4, style=bold,label=bold, label=<<B>REQ_PTP_ALARM</B><br/> <I>alarm(0)</I>>,fontcolor=aquamarine4];
running -> Con_stop [color=aquamarine4, style=bold,label=bold, label=<<B>REQ_GET_STATUS</B><br/> <I>get_status(0)</I>>,fontcolor=aquamarine4];
running -> Con_stop [color=aquamarine4, style=bold,label=bold, label=<<B>REQ_GET_STATS</B><br/> <I>get_stats(0)</I>>,fontcolor=aquamarine4];
running -> Con_stop [color=aquamarine4, style=bold,label=bold, label=<<B>REQ_GET_COUNTERS</B><br/> <I>get_counters(0)</I>>,fontcolor=aquamarine4];
running -> restarting [color=aquamarine4, style=bold,label=bold, label=<<B>TMR_ALARM</B><br/> <I>stop(0)</I>>,fontcolor=aquamarine4];
Con_stop -> stopping[color = crimson, style=bold,label=<<B>CND_STOP</B><br/> <I>stop(0)</I>>, fontcolor=crimson];
Con_stop -> running [color=deeppink4,style=bold];
# STOPPING
stopping-> restarting [color=aquamarine4,style=bold,label=<<B>START</B><br/> <I>cmd_start(0)</I>>, fontcolor=aquamarine4];
stopping-> stopped [color=aquamarine4,style=bold,label=<<B>CLEAR_ALARM</B><br/> <I>rt_nothing(0)</I>>, fontcolor=aquamarine4];
stopping-> stopping [color=aquamarine4,style=bold,label=<<B>REQ_GET_STATUS</B><br/> <I>get_status(0)</I>>, fontcolor=aquamarine4];
stopping-> stopping [color=aquamarine4,style=bold,label=<<B>REQ_GET_STATS</B><br/> <I>get_stats(0)</I>>, fontcolor=aquamarine4];
stopping-> stopping [color=aquamarine4,style=bold,label=<<B>REQ_GET_COUNTERS</B><br/> <I>get_counters(0)</I>>, fontcolor=aquamarine4];
# restarting
restarting-> stopping [color=aquamarine4,style=bold,label=<<B>STOP</B><br/> <I>cmd_stop(0)</I>>, fontcolor=aquamarine4];
restarting-> w_ptp_time [color=aquamarine4,style=bold,label=<<B>EVT_CLEAR_ALARM</B><br/> <I>start(0)</I>>, fontcolor=aquamarine4];
restarting-> restarting [color=aquamarine4,style=bold,label=<<B>REQ_SET_SOURCE</B><br/> <I>set_source(0)</I>>, fontcolor=aquamarine4];
restarting-> restarting [color=aquamarine4,style=bold,label=<<B>REQ_GET_STATUS</B><br/> <I>get_status(0)</I>>, fontcolor=aquamarine4];
restarting-> restarting [color=aquamarine4,style=bold,label=<<B>REQ_GET_STATS</B><br/> <I>get_stats(0)</I>>, fontcolor=aquamarine4];
restarting-> restarting [color=aquamarine4,style=bold,label=<<B>REQ_GET_COUNTERS</B><br/> <I>get_counters(0)</I>>, fontcolor=aquamarine4];
# Declare state
init [shape=polygon,sides=5, color=lightblue,style=filled, label="Init"];
w_ptp_time [color=lightblue,style=filled, label="W PTPtime"];
running [color=lightblue,style=filled, label="Running"];
stopped [color=lightblue,style=filled, label="Stopped"];
stopping [color=lightblue,style=filled, label="Stopping"];
restarting [color=lightblue,style=filled, label="Restarting"];
Con_start [style=filled, shape=point, color=deeppink4];
Con_stop [style=filled, shape=point, color=deeppink4];
}