gv_fsm 0.3.0 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/templates.rb +46 -43
  3. data/lib/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 104db8b7dc7c75c3680cea00e87170c3a3ab7a34c907b6022ecfe73cf7312b22
4
- data.tar.gz: 2d59ec8faae9088a97d2dc8075adf426940b4ee51ee98ba8c42a150dca7a32b4
3
+ metadata.gz: f34dd73aaf8611ca0a8b68cc0aee0865882d7c1076042cc4c5c2c08467cee438
4
+ data.tar.gz: bd19a372f3b1203517a4df93ec180c71497aea2191c771a79113a166cda0c249
5
5
  SHA512:
6
- metadata.gz: 83ca0f6bebc31be22faa513940825133f78a3e4206eaf9457fd4ae9632b2987b8bf70efd9b752b3df894db78f4afd230b53b06ff8755c74fdf0d168f54e4c815
7
- data.tar.gz: 952087a81fc23d362e05a275234c05a7917beb42f5c08323e1df2cf47168bceec52ae181f6ed51abba2d84e4a4ec9b0ec14bceeae413f37ba5f404d9dfe5813d
6
+ metadata.gz: d5fc2326e49e95d653bf643e7aae2ae240947def1a67738eade81bb202840e59d3e6f0fdb5dd4d056f5b987b23f565fdff9c40da62feecfe719adafc0aba59c5
7
+ data.tar.gz: 2a21bd10846daee821d0c43ef1244f0b4a982f0e89c182459711c542e20e1c1ae576bfc595b84ce4724a27378ce1152bce51599721468d1b9b772b460f7a3ffa
data/lib/templates.rb CHANGED
@@ -49,7 +49,7 @@ module GV_FSM
49
49
  } <%= @prefix %>state_t;
50
50
 
51
51
  // State human-readable names
52
- extern const char *state_names[];
52
+ extern const char *<%= @prefix %>state_names[];
53
53
 
54
54
  <% if transition_functions_list.count > 0 then %>
55
55
  // State function and state transition prototypes
@@ -115,9 +115,11 @@ module GV_FSM
115
115
  #include <signal.h>
116
116
  static int _exit_request = 0;
117
117
  static void signal_handler(int signal) {
118
- if (signal == SIGINT)
119
- syslog(LOG_WARNING, "[FSM] SIGINT transition to <%= sigint %>");
120
- _exit_request = 1;
118
+ if (signal == SIGINT) {
119
+ _exit_request = 1;<% if log == :syslog then %>
120
+ syslog(LOG_WARNING, "[FSM] SIGINT transition to <%= sigint %>");<% elsif log == :ino then %>
121
+ Serial.println("[FSM] SIGINT transition to <%= sigint %>");<% end %>
122
+ }
121
123
  }
122
124
 
123
125
  <% end %>
@@ -126,7 +128,7 @@ module GV_FSM
126
128
 
127
129
  // GLOBALS
128
130
  // State human-readable names
129
- const char *state_names[] = {<%= states_list.map {|sn| '"'+sn+'"'}.join(", ") %>};
131
+ const char *<%= @prefix %>state_names[] = {<%= states_list.map {|sn| '"'+sn+'"'}.join(", ") %>};
130
132
 
131
133
  // List of state functions
132
134
  <% fw = state_functions_list.max {|a, b| a.length <=> b.length}.length %>
@@ -151,18 +153,18 @@ module GV_FSM
151
153
  // No transition functions
152
154
  <% end %>
153
155
 
154
- // ____ _ _
155
- // / ___|| |_ __ _| |_ ___
156
- // \\___ \\| __/ _` | __/ _ \\
157
- // ___) | || (_| | || __/
158
- // |____/ \\__\\__,_|\\__\\___|
159
- //
160
- // __ _ _
161
- // / _|_ _ _ __ ___| |_(_) ___ _ __ ___
162
- // | |_| | | | '_ \\ / __| __| |/ _ \\| '_ \\/ __|
163
- // | _| |_| | | | | (__| |_| | (_) | | | \\__ \\
164
- // |_| \\__,_|_| |_|\\___|\\__|_|\\___/|_| |_|___/
165
- //
156
+ /* ____ _ _
157
+ * / ___|| |_ __ _| |_ ___
158
+ * \\___ \\| __/ _` | __/ _ \\
159
+ * ___) | || (_| | || __/
160
+ * |____/ \\__\\__,_|\\__\\___|
161
+ *
162
+ * __ _ _
163
+ * / _|_ _ _ __ ___| |_(_) ___ _ __ ___
164
+ * | |_| | | | '_ \\ / __| __| |/ _ \\| '_ \\/ __|
165
+ * | _| |_| | | | | (__| |_| | (_) | | | \\__ \\
166
+ * |_| \\__,_|_| |_|\\___|\\__|_|\\___/|_| |_|___/
167
+ */
166
168
  <% dest = destinations.dup %>
167
169
  <% topo = self.topology %>
168
170
  <% @states.each do |s| %>
@@ -194,10 +196,10 @@ module GV_FSM
194
196
  break;
195
197
  default:
196
198
  <% if log == :syslog then %>
197
- syslog(LOG_WARNING, "[FSM] Cannot pass from <%= s[:id] %> to %s, remaining in this state", state_names[next_state]);
199
+ syslog(LOG_WARNING, "[FSM] Cannot pass from <%= s[:id] %> to %s, remaining in this state", <%= @prefix %>state_names[next_state]);
198
200
  <% elsif log == :ino then %>
199
201
  Serial.print("[FSM] Cannot pass from <%= s[:id] %> to ");
200
- Serial.print(state_names[next_state]);
202
+ Serial.print(<%= @prefix %>state_names[next_state]);
201
203
  Serial.println(", remaining in this state");
202
204
  <% end %>
203
205
  next_state = <%= @prefix.upcase %>NO_CHANGE;
@@ -212,18 +214,18 @@ module GV_FSM
212
214
  <% end %>
213
215
 
214
216
  <% if transition_functions_list.count > 0 then %>
215
- // _____ _ _ _
216
- // |_ _| __ __ _ _ __ ___(_) |_(_) ___ _ __
217
- // | || '__/ _` | '_ \\/ __| | __| |/ _ \\| '_ \\
218
- // | || | | (_| | | | \\__ \\ | |_| | (_) | | | |
219
- // |_||_| \\__,_|_| |_|___/_|\\__|_|\\___/|_| |_|
220
- //
221
- // __ _ _
222
- // / _|_ _ _ __ ___| |_(_) ___ _ __ ___
223
- // | |_| | | | '_ \\ / __| __| |/ _ \\| '_ \\/ __|
224
- // | _| |_| | | | | (__| |_| | (_) | | | \\__ \\
225
- // |_| \\__,_|_| |_|\\___|\\__|_|\\___/|_| |_|___/
226
- //
217
+ /* _____ _ _ _
218
+ * |_ _| __ __ _ _ __ ___(_) |_(_) ___ _ __
219
+ * | || '__/ _` | '_ \\/ __| | __| |/ _ \\| '_ \\
220
+ * | || | | (_| | | | \\__ \\ | |_| | (_) | | | |
221
+ * |_||_| \\__,_|_| |_|___/_|\\__|_|\\___/|_| |_|
222
+ *
223
+ * __ _ _
224
+ * / _|_ _ _ __ ___| |_(_) ___ _ __ ___
225
+ * | |_| | | | '_ \\ / __| __| |/ _ \\| '_ \\/ __|
226
+ * | _| |_| | | | | (__| |_| | (_) | | | \\__ \\
227
+ * |_| \\__,_|_| |_|\\___|\\__|_|\\___/|_| |_|___/
228
+ */
227
229
 
228
230
  <% transition_functions_list.each do |t| %>
229
231
  <% next if t == "NULL" %>
@@ -244,18 +246,19 @@ module GV_FSM
244
246
  <% end %>
245
247
  <% end %>
246
248
 
247
- // ____ _ _
248
- // / ___|| |_ __ _| |_ ___
249
- // \\___ \\| __/ _` | __/ _ \\
250
- // ___) | || (_| | || __/
251
- // |____/ \\__\\__,_|\\__\\___|
252
- //
253
- //
254
- // _ __ ___ __ _ _ __ __ _ __ _ ___ _ __
255
- // | '_ ` _ \\ / _` | '_ \\ / _` |/ _` |/ _ \\ '__|
256
- // | | | | | | (_| | | | | (_| | (_| | __/ |
257
- // |_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_|
258
- // |___/
249
+ /* ____ _ _
250
+ * / ___|| |_ __ _| |_ ___
251
+ * \\___ \\| __/ _` | __/ _ \\
252
+ * ___) | || (_| | || __/
253
+ * |____/ \\__\\__,_|\\__\\___|
254
+ *
255
+ *
256
+ * _ __ ___ __ _ _ __ __ _ __ _ ___ _ __
257
+ * | '_ ` _ \\ / _` | '_ \\ / _` |/ _` |/ _ \\ '__|
258
+ * | | | | | | (_| | | | | (_| | (_| | __/ |
259
+ * |_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_|
260
+ * |___/
261
+ */
259
262
 
260
263
  <%= @prefix %>state_t <%= @prefix %>run_state(<%= @prefix %>state_t cur_state, <%= @prefix %>state_data_t *data) {
261
264
  <%= @prefix %>state_t new_state = <%= @prefix %>state_table[cur_state](data);
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GV_FSM
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gv_fsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paolo Bosetti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-05 00:00:00.000000000 Z
11
+ date: 2022-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-graphviz