cosmos 3.6.3 → 3.7.0
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.
- checksums.yaml +4 -4
- data/Manifest.txt +10 -0
- data/data/crc.txt +22 -13
- data/demo/config/data/crc.txt +2 -1
- data/demo/config/targets/INST/screens/limits.txt +51 -0
- data/demo/config/targets/INST/screens/other.txt +0 -5
- data/ext/cosmos/ext/array/array.c +6 -6
- data/ext/cosmos/ext/buffered_file/buffered_file.c +10 -10
- data/ext/cosmos/ext/config_parser/config_parser.c +10 -10
- data/ext/cosmos/ext/cosmos_io/cosmos_io.c +3 -3
- data/ext/cosmos/ext/crc/crc.c +6 -6
- data/ext/cosmos/ext/line_graph/line_graph.c +20 -20
- data/ext/cosmos/ext/low_fragmentation_array/low_fragmentation_array.c +4 -4
- data/ext/cosmos/ext/packet/packet.c +18 -23
- data/ext/cosmos/ext/platform/platform.c +1 -1
- data/ext/cosmos/ext/polynomial_conversion/polynomial_conversion.c +1 -1
- data/ext/cosmos/ext/structure/structure.c +34 -29
- data/ext/cosmos/ext/tabbed_plots_config/tabbed_plots_config.c +1 -1
- data/ext/cosmos/ext/telemetry/telemetry.c +33 -33
- data/lib/cosmos/gui/line_graph/line_graph.rb +25 -1
- data/lib/cosmos/gui/line_graph/line_graph_dialog.rb +2 -2
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +64 -14
- data/lib/cosmos/gui/line_graph/line_graph_popups.rb +2 -1
- data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +9 -3
- data/lib/cosmos/gui/line_graph/line_graph_script.rb +64 -9
- data/lib/cosmos/gui/line_graph/lines.rb +24 -11
- data/lib/cosmos/interfaces/udp_interface.rb +8 -3
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets.rb +8 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +79 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitscolumn_widget.rb +38 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangecolumn_widget.rb +39 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/limits_widget.rb +103 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +77 -147
- data/lib/cosmos/tools/tlm_viewer/widgets/limitscolor_widget.rb +102 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/limitscolumn_widget.rb +108 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/rangecolumn_widget.rb +57 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitscolumn_widget.rb +37 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/valuerangecolumn_widget.rb +37 -0
- data/lib/cosmos/version.rb +5 -5
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +33 -4
- metadata +12 -2
|
@@ -89,7 +89,7 @@ static VALUE my_ary_alloc (VALUE klass)
|
|
|
89
89
|
*/
|
|
90
90
|
static VALUE my_ary_new (VALUE klass, long capa)
|
|
91
91
|
{
|
|
92
|
-
VALUE ary;
|
|
92
|
+
volatile VALUE ary;
|
|
93
93
|
|
|
94
94
|
if (capa < 0)
|
|
95
95
|
{
|
|
@@ -126,8 +126,8 @@ static VALUE initialize (VALUE self, VALUE size)
|
|
|
126
126
|
*/
|
|
127
127
|
static VALUE my_ary_subseq (VALUE ary, long beg, long len)
|
|
128
128
|
{
|
|
129
|
-
VALUE klass = Qnil;
|
|
130
|
-
VALUE ary2 = Qnil;
|
|
129
|
+
volatile VALUE klass = Qnil;
|
|
130
|
+
volatile VALUE ary2 = Qnil;
|
|
131
131
|
|
|
132
132
|
if (beg > RARRAY_LEN(ary))
|
|
133
133
|
{
|
|
@@ -162,7 +162,7 @@ static VALUE my_ary_subseq (VALUE ary, long beg, long len)
|
|
|
162
162
|
*/
|
|
163
163
|
static VALUE ary_aref(int argc, VALUE *argv, VALUE ary)
|
|
164
164
|
{
|
|
165
|
-
VALUE arg;
|
|
165
|
+
volatile VALUE arg;
|
|
166
166
|
long beg, len;
|
|
167
167
|
|
|
168
168
|
if (argc == 2)
|
|
@@ -44,15 +44,13 @@ static ID id_ivar_target_name = 0;
|
|
|
44
44
|
static ID id_ivar_packet_name = 0;
|
|
45
45
|
static ID id_ivar_description = 0;
|
|
46
46
|
|
|
47
|
-
static ID id_const_ASCII_8BIT_STRING = 0;
|
|
48
|
-
|
|
49
47
|
/* Wraps read_item_internal so that it can be called by rb_protect in protected_read_item_internal */
|
|
50
48
|
static VALUE wrap_read_item_internal(VALUE args)
|
|
51
49
|
{
|
|
52
|
-
VALUE *values = (VALUE *)args;
|
|
53
|
-
VALUE self = values[0];
|
|
54
|
-
VALUE item = values[1];
|
|
55
|
-
VALUE buffer = values[2];
|
|
50
|
+
volatile VALUE *values = (VALUE *)args;
|
|
51
|
+
volatile VALUE self = values[0];
|
|
52
|
+
volatile VALUE item = values[1];
|
|
53
|
+
volatile VALUE buffer = values[2];
|
|
56
54
|
return read_item_internal(self, item, buffer);
|
|
57
55
|
}
|
|
58
56
|
|
|
@@ -60,8 +58,8 @@ static VALUE wrap_read_item_internal(VALUE args)
|
|
|
60
58
|
static VALUE protected_read_item_internal(VALUE self, VALUE item, VALUE buffer)
|
|
61
59
|
{
|
|
62
60
|
int error = 0;
|
|
63
|
-
VALUE result = Qnil;
|
|
64
|
-
VALUE args[3];
|
|
61
|
+
volatile VALUE result = Qnil;
|
|
62
|
+
volatile VALUE args[3];
|
|
65
63
|
|
|
66
64
|
args[0] = self;
|
|
67
65
|
args[1] = item;
|
|
@@ -91,10 +89,10 @@ static VALUE protected_read_item_internal(VALUE self, VALUE item, VALUE buffer)
|
|
|
91
89
|
*/
|
|
92
90
|
static VALUE identify(VALUE self, VALUE buffer)
|
|
93
91
|
{
|
|
94
|
-
VALUE id_items = rb_ivar_get(self, id_ivar_id_items);
|
|
95
|
-
VALUE item = Qnil;
|
|
96
|
-
VALUE id_value = Qnil;
|
|
97
|
-
VALUE raw_value = Qnil;
|
|
92
|
+
volatile VALUE id_items = rb_ivar_get(self, id_ivar_id_items);
|
|
93
|
+
volatile VALUE item = Qnil;
|
|
94
|
+
volatile VALUE id_value = Qnil;
|
|
95
|
+
volatile VALUE raw_value = Qnil;
|
|
98
96
|
long id_items_length = 0;
|
|
99
97
|
int index = 0;
|
|
100
98
|
|
|
@@ -205,13 +203,13 @@ static VALUE received_count_equals(VALUE self, VALUE received_count) {
|
|
|
205
203
|
* subclass of PacketItem)
|
|
206
204
|
*/
|
|
207
205
|
static VALUE packet_initialize(int argc, VALUE* argv, VALUE self) {
|
|
208
|
-
VALUE target_name = Qnil;
|
|
209
|
-
VALUE packet_name = Qnil;
|
|
210
|
-
VALUE default_endianness = Qnil;
|
|
211
|
-
VALUE description = Qnil;
|
|
212
|
-
VALUE buffer = Qnil;
|
|
213
|
-
VALUE item_class = Qnil;
|
|
214
|
-
VALUE super_args[3] = {Qnil, Qnil, Qnil};
|
|
206
|
+
volatile VALUE target_name = Qnil;
|
|
207
|
+
volatile VALUE packet_name = Qnil;
|
|
208
|
+
volatile VALUE default_endianness = Qnil;
|
|
209
|
+
volatile VALUE description = Qnil;
|
|
210
|
+
volatile VALUE buffer = Qnil;
|
|
211
|
+
volatile VALUE item_class = Qnil;
|
|
212
|
+
volatile VALUE super_args[3] = {Qnil, Qnil, Qnil};
|
|
215
213
|
|
|
216
214
|
switch (argc)
|
|
217
215
|
{
|
|
@@ -264,7 +262,7 @@ static VALUE packet_initialize(int argc, VALUE* argv, VALUE self) {
|
|
|
264
262
|
super_args[0] = default_endianness;
|
|
265
263
|
super_args[1] = buffer;
|
|
266
264
|
super_args[2] = item_class;
|
|
267
|
-
rb_call_super(3, super_args);
|
|
265
|
+
rb_call_super(3, (VALUE*) super_args);
|
|
268
266
|
target_name_equals(self, target_name);
|
|
269
267
|
packet_name_equals(self, packet_name);
|
|
270
268
|
description_equals(self, description);
|
|
@@ -302,8 +300,6 @@ void Init_packet (void)
|
|
|
302
300
|
id_method_upcase = rb_intern("upcase");
|
|
303
301
|
id_method_clone = rb_intern("clone");
|
|
304
302
|
|
|
305
|
-
id_const_ASCII_8BIT_STRING = rb_intern("ASCII_8BIT_STRING");
|
|
306
|
-
|
|
307
303
|
id_ivar_id_items = rb_intern("@id_items");
|
|
308
304
|
id_ivar_id_value = rb_intern("@id_value");
|
|
309
305
|
id_ivar_received_time = rb_intern("@received_time");
|
|
@@ -326,7 +322,6 @@ void Init_packet (void)
|
|
|
326
322
|
id_ivar_description = rb_intern("@description");
|
|
327
323
|
|
|
328
324
|
cPacket = rb_define_class_under(mCosmos, "Packet", cStructure);
|
|
329
|
-
rb_const_set(cPacket, id_const_ASCII_8BIT_STRING, ASCII_8BIT_STRING);
|
|
330
325
|
rb_define_method(cPacket, "initialize", packet_initialize, -1);
|
|
331
326
|
rb_define_method(cPacket, "identify?", identify, 1);
|
|
332
327
|
rb_define_method(cPacket, "packet_name=", packet_name_equals, 1);
|
|
@@ -69,7 +69,7 @@ static VALUE segfault(VALUE self) {
|
|
|
69
69
|
*/
|
|
70
70
|
void Init_platform (void) {
|
|
71
71
|
#ifdef _WIN32
|
|
72
|
-
VALUE ruby_version = rb_const_get(rb_cObject, rb_intern("RUBY_VERSION"));
|
|
72
|
+
volatile VALUE ruby_version = rb_const_get(rb_cObject, rb_intern("RUBY_VERSION"));
|
|
73
73
|
char* rversion = RSTRING_PTR(ruby_version);
|
|
74
74
|
|
|
75
75
|
#if __x86_64__
|
|
@@ -30,7 +30,7 @@ static ID id_method_to_f = 0;
|
|
|
30
30
|
*/
|
|
31
31
|
static VALUE polynomial_conversion_call(VALUE self, VALUE value, VALUE myself, VALUE buffer)
|
|
32
32
|
{
|
|
33
|
-
VALUE coeffs = Qnil;
|
|
33
|
+
volatile VALUE coeffs = Qnil;
|
|
34
34
|
long coeffs_length = 0;
|
|
35
35
|
int index = 0;
|
|
36
36
|
double double_value = 0.0;
|
|
@@ -65,6 +65,7 @@ static ID id_ivar_fixed_size = 0;
|
|
|
65
65
|
static ID id_ivar_short_buffer_allowed = 0;
|
|
66
66
|
static ID id_ivar_mutex = 0;
|
|
67
67
|
|
|
68
|
+
static ID id_const_ASCII_8BIT_STRING = 0;
|
|
68
69
|
static ID id_const_ZERO_STRING = 0;
|
|
69
70
|
|
|
70
71
|
static VALUE symbol_LITTLE_ENDIAN = Qnil;
|
|
@@ -453,8 +454,8 @@ static VALUE binary_accessor_read(VALUE self, VALUE param_bit_offset, VALUE para
|
|
|
453
454
|
int num_words = 0;
|
|
454
455
|
int upper_bound = 0;
|
|
455
456
|
int lower_bound = 0;
|
|
456
|
-
VALUE temp_value = Qnil;
|
|
457
|
-
VALUE return_value = Qnil;
|
|
457
|
+
volatile VALUE temp_value = Qnil;
|
|
458
|
+
volatile VALUE return_value = Qnil;
|
|
458
459
|
|
|
459
460
|
unsigned char* buffer = NULL;
|
|
460
461
|
long buffer_length = 0;
|
|
@@ -712,9 +713,9 @@ static VALUE binary_accessor_read(VALUE self, VALUE param_bit_offset, VALUE para
|
|
|
712
713
|
|
|
713
714
|
static VALUE check_overflow(VALUE value, int bit_size, VALUE data_type, VALUE overflow)
|
|
714
715
|
{
|
|
715
|
-
VALUE hex_max_value = Qnil;
|
|
716
|
-
VALUE max_value = Qnil;
|
|
717
|
-
VALUE min_value = INT2NUM(0); /* Default for UINT cases */
|
|
716
|
+
volatile VALUE hex_max_value = Qnil;
|
|
717
|
+
volatile VALUE max_value = Qnil;
|
|
718
|
+
volatile VALUE min_value = INT2NUM(0); /* Default for UINT cases */
|
|
718
719
|
|
|
719
720
|
switch (bit_size) {
|
|
720
721
|
case 8:
|
|
@@ -845,9 +846,9 @@ static VALUE binary_accessor_write(VALUE self, VALUE value, VALUE param_bit_offs
|
|
|
845
846
|
unsigned char* buffer = NULL;
|
|
846
847
|
long buffer_length = 0;
|
|
847
848
|
long value_length = 0;
|
|
848
|
-
VALUE temp_shift = Qnil;
|
|
849
|
-
VALUE temp_mask = Qnil;
|
|
850
|
-
VALUE temp_result = Qnil;
|
|
849
|
+
volatile VALUE temp_shift = Qnil;
|
|
850
|
+
volatile VALUE temp_mask = Qnil;
|
|
851
|
+
volatile VALUE temp_result = Qnil;
|
|
851
852
|
|
|
852
853
|
int string_length = 0;
|
|
853
854
|
unsigned char* unsigned_char_array = NULL;
|
|
@@ -1099,7 +1100,7 @@ static VALUE binary_accessor_write(VALUE self, VALUE value, VALUE param_bit_offs
|
|
|
1099
1100
|
*/
|
|
1100
1101
|
static int get_int_length(VALUE self)
|
|
1101
1102
|
{
|
|
1102
|
-
VALUE buffer = rb_ivar_get(self, id_ivar_buffer);
|
|
1103
|
+
volatile VALUE buffer = rb_ivar_get(self, id_ivar_buffer);
|
|
1103
1104
|
if (RTEST(buffer)) {
|
|
1104
1105
|
return (int)RSTRING_LEN(buffer);
|
|
1105
1106
|
} else {
|
|
@@ -1117,11 +1118,11 @@ static VALUE structure_length(VALUE self) {
|
|
|
1117
1118
|
}
|
|
1118
1119
|
|
|
1119
1120
|
static VALUE read_item_internal(VALUE self, VALUE item, VALUE buffer) {
|
|
1120
|
-
VALUE bit_offset = Qnil;
|
|
1121
|
-
VALUE bit_size = Qnil;
|
|
1122
|
-
VALUE data_type = Qnil;
|
|
1123
|
-
VALUE array_size = Qnil;
|
|
1124
|
-
VALUE endianness = Qnil;
|
|
1121
|
+
volatile VALUE bit_offset = Qnil;
|
|
1122
|
+
volatile VALUE bit_size = Qnil;
|
|
1123
|
+
volatile VALUE data_type = Qnil;
|
|
1124
|
+
volatile VALUE array_size = Qnil;
|
|
1125
|
+
volatile VALUE endianness = Qnil;
|
|
1125
1126
|
|
|
1126
1127
|
data_type = rb_ivar_get(item, id_ivar_data_type);
|
|
1127
1128
|
if (data_type == symbol_DERIVED) {
|
|
@@ -1155,8 +1156,8 @@ static VALUE read_item_internal(VALUE self, VALUE item, VALUE buffer) {
|
|
|
1155
1156
|
*/
|
|
1156
1157
|
static VALUE read_item(int argc, VALUE* argv, VALUE self)
|
|
1157
1158
|
{
|
|
1158
|
-
VALUE item = Qnil;
|
|
1159
|
-
VALUE buffer = Qnil;
|
|
1159
|
+
volatile VALUE item = Qnil;
|
|
1160
|
+
volatile VALUE buffer = Qnil;
|
|
1160
1161
|
|
|
1161
1162
|
switch (argc)
|
|
1162
1163
|
{
|
|
@@ -1237,9 +1238,9 @@ static VALUE structure_item_spaceship(VALUE self, VALUE other_item) {
|
|
|
1237
1238
|
* Must be StructureItem or one of its subclasses.
|
|
1238
1239
|
*/
|
|
1239
1240
|
static VALUE structure_initialize(int argc, VALUE* argv, VALUE self) {
|
|
1240
|
-
VALUE default_endianness = Qnil;
|
|
1241
|
-
VALUE buffer = Qnil;
|
|
1242
|
-
VALUE item_class = Qnil;
|
|
1241
|
+
volatile VALUE default_endianness = Qnil;
|
|
1242
|
+
volatile VALUE buffer = Qnil;
|
|
1243
|
+
volatile VALUE item_class = Qnil;
|
|
1243
1244
|
|
|
1244
1245
|
switch (argc)
|
|
1245
1246
|
{
|
|
@@ -1300,9 +1301,9 @@ static VALUE structure_initialize(int argc, VALUE* argv, VALUE self) {
|
|
|
1300
1301
|
*/
|
|
1301
1302
|
static VALUE resize_buffer(VALUE self)
|
|
1302
1303
|
{
|
|
1303
|
-
VALUE buffer = rb_ivar_get(self, id_ivar_buffer);
|
|
1304
|
+
volatile VALUE buffer = rb_ivar_get(self, id_ivar_buffer);
|
|
1304
1305
|
if (RTEST(buffer)) {
|
|
1305
|
-
VALUE value_defined_length = rb_ivar_get(self, id_ivar_defined_length);
|
|
1306
|
+
volatile VALUE value_defined_length = rb_ivar_get(self, id_ivar_defined_length);
|
|
1306
1307
|
long defined_length = FIX2INT(value_defined_length);
|
|
1307
1308
|
long current_length = RSTRING_LEN(buffer);
|
|
1308
1309
|
|
|
@@ -1322,6 +1323,8 @@ static VALUE resize_buffer(VALUE self)
|
|
|
1322
1323
|
void Init_structure (void)
|
|
1323
1324
|
{
|
|
1324
1325
|
int zero = 0;
|
|
1326
|
+
volatile VALUE zero_string = Qnil;
|
|
1327
|
+
volatile VALUE ascii_8bit_string = Qnil;
|
|
1325
1328
|
|
|
1326
1329
|
mCosmos = rb_define_module("Cosmos");
|
|
1327
1330
|
cBinaryAccessor = rb_define_class_under(mCosmos, "BinaryAccessor", rb_cObject);
|
|
@@ -1336,13 +1339,6 @@ void Init_structure (void)
|
|
|
1336
1339
|
id_method_Integer = rb_intern("Integer");
|
|
1337
1340
|
id_method_Float = rb_intern("Float");
|
|
1338
1341
|
|
|
1339
|
-
ASCII_8BIT_STRING = rb_str_new2("ASCII-8BIT");
|
|
1340
|
-
rb_funcall(ASCII_8BIT_STRING, id_method_freeze, 0);
|
|
1341
|
-
|
|
1342
|
-
ZERO_STRING = rb_str_new((char*) &zero, 1);
|
|
1343
|
-
rb_funcall(ZERO_STRING, id_method_freeze, 0);
|
|
1344
|
-
id_const_ZERO_STRING = rb_intern("ZERO_STRING");
|
|
1345
|
-
|
|
1346
1342
|
MIN_INT8 = INT2NUM(-128);
|
|
1347
1343
|
MAX_INT8 = INT2NUM(127);
|
|
1348
1344
|
MAX_UINT8 = INT2NUM(255);
|
|
@@ -1417,7 +1413,16 @@ void Init_structure (void)
|
|
|
1417
1413
|
rb_define_singleton_method(cBinaryAccessor, "write", binary_accessor_write, 7);
|
|
1418
1414
|
|
|
1419
1415
|
cStructure = rb_define_class_under(mCosmos, "Structure", rb_cObject);
|
|
1420
|
-
|
|
1416
|
+
id_const_ZERO_STRING = rb_intern("ZERO_STRING");
|
|
1417
|
+
zero_string = rb_str_new((char*) &zero, 1);
|
|
1418
|
+
rb_funcall(zero_string, id_method_freeze, 0);
|
|
1419
|
+
rb_const_set(cStructure, id_const_ZERO_STRING, zero_string);
|
|
1420
|
+
ZERO_STRING = rb_const_get(cStructure, id_const_ZERO_STRING);
|
|
1421
|
+
id_const_ASCII_8BIT_STRING = rb_intern("ASCII_8BIT_STRING");
|
|
1422
|
+
ascii_8bit_string = rb_str_new2("ASCII-8BIT");
|
|
1423
|
+
rb_funcall(ascii_8bit_string, id_method_freeze, 0);
|
|
1424
|
+
rb_const_set(cStructure, id_const_ASCII_8BIT_STRING, ascii_8bit_string);
|
|
1425
|
+
ASCII_8BIT_STRING = rb_const_get(cStructure, id_const_ASCII_8BIT_STRING);
|
|
1421
1426
|
rb_define_method(cStructure, "initialize", structure_initialize, -1);
|
|
1422
1427
|
rb_define_method(cStructure, "length", structure_length, 0);
|
|
1423
1428
|
rb_define_method(cStructure, "read_item", read_item, -1);
|
|
@@ -35,9 +35,9 @@ static VALUE symbol_CONVERTED = Qnil;
|
|
|
35
35
|
* target name keyed by the packet name
|
|
36
36
|
*/
|
|
37
37
|
static VALUE packets(VALUE self, VALUE target_name) {
|
|
38
|
-
VALUE target_packets = Qnil;
|
|
39
|
-
VALUE upcase_target_name = Qnil;
|
|
40
|
-
VALUE telemetry = Qnil;
|
|
38
|
+
volatile VALUE target_packets = Qnil;
|
|
39
|
+
volatile VALUE upcase_target_name = Qnil;
|
|
40
|
+
volatile VALUE telemetry = Qnil;
|
|
41
41
|
|
|
42
42
|
upcase_target_name = rb_funcall(target_name, id_method_to_s, 0);
|
|
43
43
|
upcase_target_name = rb_funcall(upcase_target_name, id_method_upcase, 0);
|
|
@@ -59,10 +59,10 @@ static VALUE packets(VALUE self, VALUE target_name) {
|
|
|
59
59
|
*/
|
|
60
60
|
static VALUE packet(VALUE self, VALUE target_name, VALUE packet_name)
|
|
61
61
|
{
|
|
62
|
-
VALUE packet = Qnil;
|
|
63
|
-
VALUE target_packets = Qnil;
|
|
64
|
-
VALUE upcase_target_name = Qnil;
|
|
65
|
-
VALUE upcase_packet_name = Qnil;
|
|
62
|
+
volatile VALUE packet = Qnil;
|
|
63
|
+
volatile VALUE target_packets = Qnil;
|
|
64
|
+
volatile VALUE upcase_target_name = Qnil;
|
|
65
|
+
volatile VALUE upcase_packet_name = Qnil;
|
|
66
66
|
|
|
67
67
|
target_packets = packets(self, target_name);
|
|
68
68
|
|
|
@@ -89,10 +89,10 @@ static VALUE packet(VALUE self, VALUE target_name, VALUE packet_name)
|
|
|
89
89
|
*/
|
|
90
90
|
static VALUE packet_and_item(VALUE self, VALUE target_name, VALUE packet_name, VALUE item_name)
|
|
91
91
|
{
|
|
92
|
-
VALUE upcase_packet_name = Qnil;
|
|
93
|
-
VALUE return_packet = Qnil;
|
|
94
|
-
VALUE item = Qnil;
|
|
95
|
-
VALUE return_value = Qnil;
|
|
92
|
+
volatile VALUE upcase_packet_name = Qnil;
|
|
93
|
+
volatile VALUE return_packet = Qnil;
|
|
94
|
+
volatile VALUE item = Qnil;
|
|
95
|
+
volatile VALUE return_value = Qnil;
|
|
96
96
|
char * string_packet_name = NULL;
|
|
97
97
|
|
|
98
98
|
upcase_packet_name = rb_funcall(packet_name, id_method_upcase, 0);
|
|
@@ -128,12 +128,12 @@ static VALUE packet_and_item(VALUE self, VALUE target_name, VALUE packet_name, V
|
|
|
128
128
|
*/
|
|
129
129
|
static VALUE value(int argc, VALUE* argv, VALUE self)
|
|
130
130
|
{
|
|
131
|
-
VALUE target_name = Qnil;
|
|
132
|
-
VALUE packet_name = Qnil;
|
|
133
|
-
VALUE item_name = Qnil;
|
|
134
|
-
VALUE value_type = Qnil;
|
|
135
|
-
VALUE result = Qnil;
|
|
136
|
-
VALUE packet = Qnil;
|
|
131
|
+
volatile VALUE target_name = Qnil;
|
|
132
|
+
volatile VALUE packet_name = Qnil;
|
|
133
|
+
volatile VALUE item_name = Qnil;
|
|
134
|
+
volatile VALUE value_type = Qnil;
|
|
135
|
+
volatile VALUE result = Qnil;
|
|
136
|
+
volatile VALUE packet = Qnil;
|
|
137
137
|
|
|
138
138
|
switch (argc)
|
|
139
139
|
{
|
|
@@ -176,22 +176,22 @@ static VALUE value(int argc, VALUE* argv, VALUE self)
|
|
|
176
176
|
* red, yellow, and green (if given) limits values.
|
|
177
177
|
*/
|
|
178
178
|
static VALUE values_and_limits_states(int argc, VALUE* argv, VALUE self) {
|
|
179
|
-
VALUE item_array = Qnil;
|
|
180
|
-
VALUE value_types = Qnil;
|
|
181
|
-
VALUE items = Qnil;
|
|
182
|
-
VALUE states = Qnil;
|
|
183
|
-
VALUE settings = Qnil;
|
|
184
|
-
VALUE entry = Qnil;
|
|
185
|
-
VALUE target_name = Qnil;
|
|
186
|
-
VALUE packet_name = Qnil;
|
|
187
|
-
VALUE item_name = Qnil;
|
|
188
|
-
VALUE value_type = Qnil;
|
|
189
|
-
VALUE result = Qnil;
|
|
190
|
-
VALUE return_value = Qnil;
|
|
191
|
-
VALUE limits = Qnil;
|
|
192
|
-
VALUE limits_set = Qnil;
|
|
193
|
-
VALUE limits_values = Qnil;
|
|
194
|
-
VALUE limits_settings = Qnil;
|
|
179
|
+
volatile VALUE item_array = Qnil;
|
|
180
|
+
volatile VALUE value_types = Qnil;
|
|
181
|
+
volatile VALUE items = Qnil;
|
|
182
|
+
volatile VALUE states = Qnil;
|
|
183
|
+
volatile VALUE settings = Qnil;
|
|
184
|
+
volatile VALUE entry = Qnil;
|
|
185
|
+
volatile VALUE target_name = Qnil;
|
|
186
|
+
volatile VALUE packet_name = Qnil;
|
|
187
|
+
volatile VALUE item_name = Qnil;
|
|
188
|
+
volatile VALUE value_type = Qnil;
|
|
189
|
+
volatile VALUE result = Qnil;
|
|
190
|
+
volatile VALUE return_value = Qnil;
|
|
191
|
+
volatile VALUE limits = Qnil;
|
|
192
|
+
volatile VALUE limits_set = Qnil;
|
|
193
|
+
volatile VALUE limits_values = Qnil;
|
|
194
|
+
volatile VALUE limits_settings = Qnil;
|
|
195
195
|
long length = 0;
|
|
196
196
|
long value_types_length = 0;
|
|
197
197
|
int index = 0;
|
|
@@ -81,6 +81,8 @@ module Cosmos
|
|
|
81
81
|
attr_accessor_with_redraw :unix_epoch_x_values
|
|
82
82
|
# Display x_value as UTC timestamp
|
|
83
83
|
attr_accessor_with_redraw :utc_time
|
|
84
|
+
# Display legend on bottom or right side
|
|
85
|
+
attr_accessor_with_redraw :legend_position
|
|
84
86
|
|
|
85
87
|
#########################################################################
|
|
86
88
|
# Callback attributes
|
|
@@ -148,6 +150,7 @@ module Cosmos
|
|
|
148
150
|
@show_popup_x_y = false
|
|
149
151
|
@unix_epoch_x_values = true
|
|
150
152
|
@utc_time = false
|
|
153
|
+
@legend_position = :bottom # :bottom or :right
|
|
151
154
|
|
|
152
155
|
# Initialize the callbacks
|
|
153
156
|
@draw_cursor_line_callback = nil
|
|
@@ -249,6 +252,9 @@ module Cosmos
|
|
|
249
252
|
# Time of previous left button release
|
|
250
253
|
@previous_left_button_release_time = Time.now
|
|
251
254
|
|
|
255
|
+
# List of line colors to use
|
|
256
|
+
@color_list = ['blue','red','green','darkorange', 'gold', 'purple', 'hotpink', 'lime', 'cornflowerblue', 'brown', 'coral', 'crimson', 'indigo', 'tan', 'lightblue', 'cyan', 'peru', 'maroon','orange','navy','teal','black']
|
|
257
|
+
|
|
252
258
|
@redraw_needed = true
|
|
253
259
|
|
|
254
260
|
setContentsMargins(0,0,0,0)
|
|
@@ -369,9 +375,27 @@ module Cosmos
|
|
|
369
375
|
end # def clear_lines
|
|
370
376
|
|
|
371
377
|
# Adds a line to the graph - Afterwards the graph is ready to be drawn
|
|
372
|
-
|
|
378
|
+
# color = 'auto' automatically determines color from index based lookup
|
|
379
|
+
def add_line(legend_text, y, x = nil, y_labels = nil, x_labels = nil, y_states = nil, x_states = nil, color = 'auto', axis = :LEFT, max_points_plotted = nil)
|
|
373
380
|
@unix_epoch_x_values = false unless x
|
|
374
381
|
|
|
382
|
+
# if color specified as auto, do lookup
|
|
383
|
+
if (color == 'auto')
|
|
384
|
+
# If the number of lines is less than number of available colors,
|
|
385
|
+
# choose an unused color
|
|
386
|
+
if (@lines.num_lines < @color_list.length)
|
|
387
|
+
unused_colors = @color_list.dup
|
|
388
|
+
@lines.legend.each do |name, line_color, axis|
|
|
389
|
+
unused_colors.delete(line_color)
|
|
390
|
+
end
|
|
391
|
+
color = unused_colors[0]
|
|
392
|
+
else
|
|
393
|
+
# Get an index within the color list for the next line index
|
|
394
|
+
line_color_idx = @lines.num_lines % (@color_list.length)
|
|
395
|
+
color = @color_list[line_color_idx]
|
|
396
|
+
end
|
|
397
|
+
end
|
|
398
|
+
|
|
375
399
|
@lines.add_line(legend_text, y, x, y_labels, x_labels, y_states, x_states, color, axis, max_points_plotted)
|
|
376
400
|
|
|
377
401
|
# Adding a line implies a redraw is needed
|
|
@@ -18,7 +18,7 @@ module Cosmos
|
|
|
18
18
|
|
|
19
19
|
attr_accessor :line_graph
|
|
20
20
|
|
|
21
|
-
def initialize(title)
|
|
21
|
+
def initialize (title, width=400, height=300)
|
|
22
22
|
super(Qt::CoreApplication.instance.activeWindow)
|
|
23
23
|
self.window_title = title
|
|
24
24
|
@layout = Qt::VBoxLayout.new
|
|
@@ -27,7 +27,7 @@ module Cosmos
|
|
|
27
27
|
@line_graph = LineGraph.new(self)
|
|
28
28
|
layout.addWidget(@line_graph)
|
|
29
29
|
|
|
30
|
-
resize(
|
|
30
|
+
resize(width, height)
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|