@ncd-io/node-red-enterprise-sensors 1.1.2 → 1.1.4

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.
@@ -141,7 +141,7 @@ module.exports = class WirelessSensor{
141
141
  }
142
142
  }
143
143
  // #OTF
144
- var otf_devices = [23,26,32,33,39,44,45,48,52,53,58,74,76,78,79,80,81,82,84,88,89,90,91,97,98,101,102,105,106,107,108,110,111,112,114,118,180,181,202,519,520,521,531,535,537,538,539,540,1010,1011];
144
+ var otf_devices = [23,26,32,33,39,44,45,48,52,53,56,58,74,76,78,79,80,81,82,84,88,89,90,91,97,98,101,102,105,106,107,108,110,111,112,114,118,180,181,202,519,520,521,531,535,537,538,539,540,1010,1011];
145
145
  var device_type = msbLsb(frame.data[6], frame.data[7]);
146
146
  // var device_type = frame.data[7];
147
147
 
@@ -202,7 +202,10 @@ module.exports = class WirelessSensor{
202
202
  frame.data.splice(2,0,frame.data[5],0);
203
203
  this.sensor_pool[frame.mac].reported_config = this.sensor_types[data.sensor_type].parse_fly(frame.data);
204
204
  }else if(mode === 'ACK'){
205
- this.sensor_pool[frame.mac].result = data.result;
205
+ this.sensor_pool[frame.mac].status = data.result;
206
+ if(data.data.length){
207
+ this.sensor_pool[frame.mac].data = data.data;
208
+ };
206
209
  }
207
210
  var that = this;
208
211
 
@@ -300,7 +303,7 @@ module.exports = class WirelessSensor{
300
303
  };
301
304
 
302
305
  // #OTF
303
- var otf_devices = [23,26,32,33,39,44,45,48,52,53,58,74,76,78,79,80,81,82,84,88,89,90,91,97,98,101,102,105,106,107,108,110,111,112,114,118,180,181,202,519,520,521,531,535,537,538,539,540,1010,1011];
306
+ var otf_devices = [23,26,32,33,39,44,45,48,52,53,56,58,74,76,78,79,80,81,82,84,88,89,90,91,97,98,101,102,105,106,107,108,110,111,112,114,118,180,181,202,519,520,521,531,535,537,538,539,540,1010,1011];
304
307
  if(otf_devices.includes(parsed.sensor_type)){
305
308
  // If the message says FLY and there is not FLY timer in progress.
306
309
  if(payload[8] == 70 && payload[9] == 76 && payload[10] == 89) {
@@ -1161,18 +1164,6 @@ module.exports = class WirelessSensor{
1161
1164
  console.log(packet);
1162
1165
  return this.config_send(sensor_mac, packet);
1163
1166
  }
1164
- config_set_acceleration_interrupt_threshold_p1_84(sensor_mac, value){
1165
- console.log('config_set_acceleration_interrupt_threshold_p1_84');
1166
- var packet = [244, 79, 0, 0, 0, 60, 1, value];
1167
- console.log(packet);
1168
- return this.config_send(sensor_mac, packet);
1169
- }
1170
- config_set_acceleration_interrupt_threshold_p2_84(sensor_mac, value){
1171
- console.log('config_set_acceleration_interrupt_threshold_p2_84');
1172
- var packet = [244, 79, 0, 0, 0, 60, 2, value];
1173
- console.log(packet);
1174
- return this.config_send(sensor_mac, packet);
1175
- }
1176
1167
  config_get_sampling_interval_101(sensor_mac, sampling_interval){
1177
1168
  console.log('config_get_sampling_interval_101');
1178
1169
  var packet = [244, 79, 0, 0, 101, 7];
@@ -1580,6 +1571,72 @@ module.exports = class WirelessSensor{
1580
1571
  console.log(packet);
1581
1572
  return this.config_send(sensor_mac, packet);
1582
1573
  }
1574
+ config_set_odr_p1_110(sensor_mac, value){
1575
+ console.log('config_set_odr_p1_110');
1576
+ var packet = [244, 79, 0, 0, 101, 0, 1, value];
1577
+ console.log(packet);
1578
+ return this.config_send(sensor_mac, packet);
1579
+ }
1580
+ config_set_odr_p2_110(sensor_mac, value){
1581
+ console.log('config_set_odr_p2_110');
1582
+ var packet = [244, 79, 0, 0, 101, 0, 2, value];
1583
+ console.log(packet);
1584
+ return this.config_send(sensor_mac, packet);
1585
+ }
1586
+ config_set_sampling_duration_p1_110(sensor_mac, value){
1587
+ console.log('config_set_sampling_duration_p1_110');
1588
+ var packet = [244, 79, 0, 0, 101, 2, 1, value];
1589
+ console.log(packet);
1590
+ return this.config_send(sensor_mac, packet);
1591
+ }
1592
+ config_set_sampling_duration_p2_110(sensor_mac, value){
1593
+ console.log('config_set_sampling_duration_p2_110');
1594
+ var packet = [244, 79, 0, 0, 101, 2, 2, value];
1595
+ console.log(packet);
1596
+ return this.config_send(sensor_mac, packet);
1597
+ }
1598
+ config_set_low_pass_filter_p1_110(sensor_mac, value){
1599
+ console.log('config_set_low_pass_filter_p1_110');
1600
+ var packet = [244, 79, 0, 0, 80, 52, 1, value];
1601
+ console.log(packet);
1602
+ return this.config_send(sensor_mac, packet);
1603
+ }
1604
+ config_set_low_pass_filter_p2_110(sensor_mac, value){
1605
+ console.log('config_set_low_pass_filter_p2_110');
1606
+ var packet = [244, 79, 0, 0, 80, 52, 2, value];
1607
+ console.log(packet);
1608
+ return this.config_send(sensor_mac, packet);
1609
+ }
1610
+ config_set_high_pass_filter_p1_110(sensor_mac, value){
1611
+ console.log('config_set_high_pass_filter_p1_110');
1612
+ var packet = [244, 79, 0, 0, 80, 54, 1, value];
1613
+ console.log(packet);
1614
+ return this.config_send(sensor_mac, packet);
1615
+ }
1616
+ config_set_high_pass_filter_p2_110(sensor_mac, value){
1617
+ console.log('config_set_high_pass_filter_p2_110');
1618
+ var packet = [244, 79, 0, 0, 80, 54, 2, value];
1619
+ console.log(packet);
1620
+ return this.config_send(sensor_mac, packet);
1621
+ }
1622
+ config_set_motion_detect_threshold_p1_110(sensor_mac, value){
1623
+ console.log('config_set_motion_detect_threshold_p1_110');
1624
+ var packet = [244, 79, 0, 0, 80, 60, 1, value];
1625
+ console.log(packet);
1626
+ return this.config_send(sensor_mac, packet);
1627
+ }
1628
+ config_set_motion_detect_threshold_p2_110(sensor_mac, value){
1629
+ console.log('config_set_motion_detect_threshold_p2_110');
1630
+ var packet = [244, 79, 0, 0, 80, 60, 2, value];
1631
+ console.log(packet);
1632
+ return this.config_send(sensor_mac, packet);
1633
+ }
1634
+ config_set_acceleration_interrupt_threshold_84(sensor_mac, value){
1635
+ console.log('config_set_acceleration_interrupt_threshold_84');
1636
+ var packet = [244, 79, 0, 0, 0, 60, value];
1637
+ console.log(packet);
1638
+ return this.config_send(sensor_mac, packet);
1639
+ }
1583
1640
  config_set_current_calibration_13(sensor_mac, calib){
1584
1641
  console.log('config_set_current_calibration_13');
1585
1642
  var packet = [244, 1, 0, 0, 0];
@@ -1817,6 +1874,60 @@ module.exports = class WirelessSensor{
1817
1874
  console.log(packet);
1818
1875
  return this.config_send(sensor_mac, packet);
1819
1876
  }
1877
+ config_set_pressure_sensor_type_21(sensor_mac, value){
1878
+ console.log('config_set_pressure_sensor_type_21');
1879
+ var packet = [244, 64, 0, 0, 21, value]
1880
+ console.log(packet);
1881
+ return this.config_send(sensor_mac, packet);
1882
+ }
1883
+ config_set_thermocouple_type_112(sensor_mac, value){
1884
+ console.log('config_set_thermocouple_type_112');
1885
+ let packet = [244, 79, 0, 0, 101, 20, value];
1886
+ console.log(packet);
1887
+ return this.config_send(sensor_mac, packet);
1888
+ }
1889
+ config_set_filter_thermocouple_112(sensor_mac, value){
1890
+ console.log('config_set_filter_thermocouple_112');
1891
+ let packet = [244, 79, 0, 0, 101, 22, value];
1892
+ console.log(packet);
1893
+ return this.config_send(sensor_mac, packet);
1894
+ }
1895
+ config_set_cold_junction_thermocouple_112(sensor_mac, value){
1896
+ console.log('config_set_cold_junction_thermocouple_112');
1897
+ let packet = [244, 79, 0, 0, 101, 24, value];
1898
+ console.log(packet);
1899
+ return this.config_send(sensor_mac, packet);
1900
+ }
1901
+ config_set_sample_resolution_thermocouple_112(sensor_mac, value){
1902
+ console.log('config_set_sample_resolution_thermocouple_112');
1903
+ let packet = [244, 79, 0, 0, 101, 26, value];
1904
+ console.log(packet);
1905
+ return this.config_send(sensor_mac, packet);
1906
+ }
1907
+ config_set_number_of_samples_thermocouple_112(sensor_mac, value){
1908
+ console.log('config_set_number_of_samples_thermocouple_112');
1909
+ let packet = [244, 79, 0, 0, 101, 28, value];
1910
+ console.log(packet);
1911
+ return this.config_send(sensor_mac, packet);
1912
+ }
1913
+ config_set_operation_mode_thermocouple_112(sensor_mac, value){
1914
+ console.log('config_set_operation_mode_thermocouple_112');
1915
+ let packet = [244, 79, 0, 0, 101, 30, value];
1916
+ console.log(packet);
1917
+ return this.config_send(sensor_mac, packet);
1918
+ }
1919
+ config_set_measurement_type_thermocouple_112(sensor_mac, value){
1920
+ console.log('config_set_number_of_samples_thermocouple_112');
1921
+ let packet = [244, 79, 0, 0, 101, 32, value];
1922
+ console.log(packet);
1923
+ return this.config_send(sensor_mac, packet);
1924
+ }
1925
+ config_set_enable_rpm_calculate_status_110(sensor_mac, value){
1926
+ console.log('config_set_enable_rpm_calculate_status_110');
1927
+ let packet = [244, 79, 0, 0, 101, 85, value];
1928
+ console.log(packet);
1929
+ return this.config_send(sensor_mac, packet);
1930
+ }
1820
1931
  config_get_delay(sensor_mac){
1821
1932
  return new Promise((fulfill, reject) => {
1822
1933
  this.config_send(sensor_mac, [247, 21, 0, 0, 0]).then((res) => {
@@ -3276,7 +3387,7 @@ function sensor_types(parent){
3276
3387
  'hardware_id': frame.slice(19, 22),
3277
3388
  'report_rate': frame.slice(22, 26).reduce(msbLsb),
3278
3389
  'tx_counter': frame.slice(26, 30).reduce(msbLsb),
3279
-
3390
+
3280
3391
  }
3281
3392
  };
3282
3393
  }
@@ -6341,7 +6452,7 @@ function sensor_types(parent){
6341
6452
  },
6342
6453
  'parse_fly': (frame) => {
6343
6454
  let frame_data = {};
6344
- frame_data.mode = frame[12] ? 'Raw':'Processed';
6455
+ frame_data.mode = frame[12] ? 'Raw':'Processed';
6345
6456
  switch(frame[13]){
6346
6457
  case 0:
6347
6458
  frame_data.raw_lenght = 55;
@@ -6521,7 +6632,7 @@ function sensor_types(parent){
6521
6632
  },
6522
6633
  'parse_fly': (frame) => {
6523
6634
  let frame_data = {};
6524
- frame_data.mode = frame[12] ? 'Raw':'Processed';
6635
+ frame_data.mode = frame[12] ? 'Raw':'Processed';
6525
6636
  switch(frame[13]){
6526
6637
  case 0:
6527
6638
  frame_data.raw_lenght = 55;
@@ -7048,8 +7159,8 @@ function sensor_types(parent){
7048
7159
  frame_data.odr_1 = 25600;
7049
7160
  break;
7050
7161
  }
7051
- frame_data.sampling_duration_1 = frame[19]*50 + "ms";
7052
- switch(frame[21]){
7162
+ frame_data.sampling_duration_1 = frame[18]*50 + "ms";
7163
+ switch(frame[19]){
7053
7164
  case 0:
7054
7165
  frame_data.filter_status = "Disabled";
7055
7166
  break;
@@ -7057,7 +7168,7 @@ function sensor_types(parent){
7057
7168
  frame_data.filter_status = "Enabled";
7058
7169
  break;
7059
7170
  }
7060
- switch(frame[22]){
7171
+ switch(frame[20]){
7061
7172
  case 0:
7062
7173
  frame_data.lpf_coeff_1 = 4;
7063
7174
  break;
@@ -7090,7 +7201,7 @@ function sensor_types(parent){
7090
7201
  break;
7091
7202
  }
7092
7203
  frame_data.lpf_freq_1 = frame_data.odr_1 / frame_data.lpf_coeff_1;
7093
- switch(frame[24]){
7204
+ switch(frame[21]){
7094
7205
  case 0:
7095
7206
  frame_data.hpf_coeff_1 = 4;
7096
7207
  break;
@@ -7123,7 +7234,7 @@ function sensor_types(parent){
7123
7234
  break;
7124
7235
  }
7125
7236
  frame_data.hpf_freq_1 = frame_data.odr_1 / frame_data.hpf_coeff_1;
7126
- switch(frame[26]){
7237
+ switch(frame[22]){
7127
7238
  case 0:
7128
7239
  frame_data.sampling_interval = "5 Minutes";
7129
7240
  break;
@@ -7152,10 +7263,10 @@ function sensor_types(parent){
7152
7263
  frame_data.sampling_interval = "1 Minute";
7153
7264
  break;
7154
7265
  }
7155
- frame_data.on_request_timeout = frame[27] + " Seconds";
7156
- frame_data.deadband = frame[28] + "mg";
7266
+ frame_data.on_request_timeout = frame[23] + " Seconds";
7267
+ frame_data.deadband = frame[24] + "mg";
7157
7268
 
7158
- switch(frame[29]){
7269
+ switch(frame[25]){
7159
7270
  case 0:
7160
7271
  frame_data.payload_length = "50 Bytes";
7161
7272
  break;
@@ -7169,35 +7280,53 @@ function sensor_types(parent){
7169
7280
  frame_data.payload_length = "180 Bytes";
7170
7281
  break;
7171
7282
  }
7172
-
7283
+ switch(frame[26]){
7284
+ case 0:
7285
+ frame_data.fsr_text = "2g";
7286
+ break;
7287
+ case 1:
7288
+ frame_data.fsr_text = "4g";
7289
+ break;
7290
+ case 2:
7291
+ frame_data.fsr_text = "8g";
7292
+ break;
7293
+ case 3:
7294
+ frame_data.fsr_text = "16g";
7295
+ break;
7296
+ }
7297
+ frame_data.rpm_status = frame[27]? 'Enabled': 'Disabled';
7173
7298
  return {
7174
7299
  'firmware': frame[2],
7175
7300
  'destination_address': toMac(frame.slice(12, 16)),
7176
7301
  'mode': frame_data.mode,
7177
- 'odr_1': frame_data.odr_1+'Hz',
7178
- 'sampling_duration_1': frame_data.sampling_duration_1,
7302
+ 'odr': frame_data.odr_1+'Hz',
7303
+ 'sampling_duration': frame_data.sampling_duration_1,
7179
7304
  'filter_status': frame_data.filter_status,
7180
- 'lpf_coeff_1': frame_data.lpf_coeff_1,
7181
- 'lpf_freq_1': frame_data.lpf_freq_1+'Hz',
7182
- 'hpf_coeff_1': frame_data.hpf_coeff_1,
7183
- 'hpf_freq_1': frame_data.hpf_freq_1+'Hz',
7305
+ 'lpf_coeff': frame_data.lpf_coeff_1,
7306
+ 'lpf_freq': frame_data.lpf_freq_1+'Hz',
7307
+ 'hpf_coeff': frame_data.hpf_coeff_1,
7308
+ 'hpf_freq': frame_data.hpf_freq_1+'Hz',
7184
7309
  'sampling_interval': frame_data.sampling_interval,
7185
7310
  'on_request_timeout': frame_data.on_request_timeout,
7186
7311
  'deadband': frame_data.deadband,
7187
7312
  'payload_length': frame_data.payload_length,
7313
+ 'fsr': frame_data.fsr_text,
7314
+ 'rpm_compute_status': frame_data.rpm_status,
7188
7315
  'machine_values': {
7189
7316
  'firmware': frame[2],
7190
7317
  'destination_address': toMac(frame.slice(12, 16), false),
7191
7318
  'mode': frame[16],
7192
- 'odr_1': frame[17],
7193
- 'sampling_duration_1': frame[19],
7194
- 'filter_status': frame[21],
7195
- 'lpf_coeff_1': frame[22],
7196
- 'hpf_coeff_1': frame[24],
7197
- 'sampling_interval': frame[26],
7198
- 'on_request_timeout': frame[27],
7199
- 'deadband': frame[28],
7200
- 'payload_length': frame[29]
7319
+ 'odr': frame[17],
7320
+ 'sampling_duration': frame[18],
7321
+ 'filter_status': frame[19],
7322
+ 'lpf_coeff': frame[20],
7323
+ 'hpf_coeff': frame[21],
7324
+ 'sampling_interval': frame[22],
7325
+ 'on_request_timeout': frame[23],
7326
+ 'deadband': frame[24],
7327
+ 'payload_length': frame[25],
7328
+ 'fsr': frame[26],
7329
+ 'rpm_compute_status': frame[27]
7201
7330
  }
7202
7331
  }
7203
7332
  }
@@ -7856,7 +7985,21 @@ function sensor_types(parent){
7856
7985
  frame_data.payload_length = "180 Bytes";
7857
7986
  break;
7858
7987
  }
7859
-
7988
+ switch(frame[20]){
7989
+ case 0:
7990
+ frame_data.fsr_text = "2g";
7991
+ break;
7992
+ case 1:
7993
+ frame_data.fsr_text = "4g";
7994
+ break;
7995
+ case 2:
7996
+ frame_data.fsr_text = "8g";
7997
+ break;
7998
+ case 3:
7999
+ frame_data.fsr_text = "16g";
8000
+ break;
8001
+ }
8002
+ frame_data.rpm_status = frame[31]? 'Enabled': 'Disabled';
7860
8003
  return {
7861
8004
  'firmware': frame[2],
7862
8005
  'destination_address': toMac(frame.slice(12, 16)),
@@ -7878,6 +8021,8 @@ function sensor_types(parent){
7878
8021
  'on_request_timeout': frame_data.on_request_timeout,
7879
8022
  'deadband': frame_data.deadband,
7880
8023
  'payload_length': frame_data.payload_length,
8024
+ 'fsm': frame_data.fsr_text,
8025
+ 'rpm_compute_status': frame_data.rpm_status,
7881
8026
  'machine_values': {
7882
8027
  'firmware': frame[2],
7883
8028
  'destination_address': toMac(frame.slice(12, 16), false),
@@ -7894,7 +8039,9 @@ function sensor_types(parent){
7894
8039
  'sampling_interval': frame[26],
7895
8040
  'on_request_timeout': frame[27],
7896
8041
  'deadband': frame[28],
7897
- 'payload_length': frame[29]
8042
+ 'payload_length': frame[29],
8043
+ 'fsm': frame[30],
8044
+ 'rpm_compute_status': frame[31],
7898
8045
  }
7899
8046
  }
7900
8047
  }
@@ -8174,8 +8321,8 @@ function sensor_types(parent){
8174
8321
 
8175
8322
  odr: odr,
8176
8323
  temperature: signInt(payload.slice(10, 12).reduce(msbLsb), 16) / 100,
8177
- Ext_temperature: signInt(payload.slice(12, 16).reduce(msbLsb), 32) / 100,
8178
- Current: signInt(payload.slice(16, 20).reduce(msbLsb), 32) / 1000,
8324
+ ext_temperature: signInt(payload.slice(12, 16).reduce(msbLsb), 32) / 100,
8325
+ current: signInt(payload.slice(16, 20).reduce(msbLsb), 32) / 1000,
8179
8326
  x_rms_ACC_G: payload.slice(20, 22).reduce(msbLsb)/1000,
8180
8327
  x_max_ACC_G: payload.slice(22, 24).reduce(msbLsb)/1000,
8181
8328
  x_velocity_mm_sec: payload.slice(24, 26).reduce(msbLsb) / 100,
@@ -8252,8 +8399,8 @@ function sensor_types(parent){
8252
8399
  frame_data.odr_1 = 25600;
8253
8400
  break;
8254
8401
  }
8255
- frame_data.sampling_duration_1 = frame[19]*50 + "ms";
8256
- switch(frame[21]){
8402
+ frame_data.sampling_duration_1 = frame[18]*50 + "ms";
8403
+ switch(frame[19]){
8257
8404
  case 0:
8258
8405
  frame_data.filter_status = "Disabled";
8259
8406
  break;
@@ -8261,7 +8408,7 @@ function sensor_types(parent){
8261
8408
  frame_data.filter_status = "Enabled";
8262
8409
  break;
8263
8410
  }
8264
- switch(frame[22]){
8411
+ switch(frame[20]){
8265
8412
  case 0:
8266
8413
  frame_data.lpf_coeff_1 = 4;
8267
8414
  break;
@@ -8294,7 +8441,7 @@ function sensor_types(parent){
8294
8441
  break;
8295
8442
  }
8296
8443
  frame_data.lpf_freq_1 = frame_data.odr_1 / frame_data.lpf_coeff_1;
8297
- switch(frame[24]){
8444
+ switch(frame[21]){
8298
8445
  case 0:
8299
8446
  frame_data.hpf_coeff_1 = 4;
8300
8447
  break;
@@ -8327,7 +8474,7 @@ function sensor_types(parent){
8327
8474
  break;
8328
8475
  }
8329
8476
  frame_data.hpf_freq_1 = frame_data.odr_1 / frame_data.hpf_coeff_1;
8330
- switch(frame[26]){
8477
+ switch(frame[22]){
8331
8478
  case 0:
8332
8479
  frame_data.sampling_interval = "5 Minutes";
8333
8480
  break;
@@ -8356,10 +8503,10 @@ function sensor_types(parent){
8356
8503
  frame_data.sampling_interval = "1 Minute";
8357
8504
  break;
8358
8505
  }
8359
- frame_data.on_request_timeout = frame[27] + " Seconds";
8360
- frame_data.deadband = frame[28] + "mg";
8506
+ frame_data.on_request_timeout = frame[23] + " Seconds";
8507
+ frame_data.deadband = frame[24] + "mg";
8361
8508
 
8362
- switch(frame[29]){
8509
+ switch(frame[25]){
8363
8510
  case 0:
8364
8511
  frame_data.payload_length = "50 Bytes";
8365
8512
  break;
@@ -8373,35 +8520,53 @@ function sensor_types(parent){
8373
8520
  frame_data.payload_length = "180 Bytes";
8374
8521
  break;
8375
8522
  }
8376
-
8523
+ switch(frame[26]){
8524
+ case 0:
8525
+ frame_data.fsr_text = "2g";
8526
+ break;
8527
+ case 1:
8528
+ frame_data.fsr_text = "4g";
8529
+ break;
8530
+ case 2:
8531
+ frame_data.fsr_text = "8g";
8532
+ break;
8533
+ case 3:
8534
+ frame_data.fsr_text = "16g";
8535
+ break;
8536
+ }
8537
+ frame_data.rpm_status = frame[27]? 'Enabled': 'Disabled';
8377
8538
  return {
8378
8539
  'firmware': frame[2],
8379
8540
  'destination_address': toMac(frame.slice(12, 16)),
8380
8541
  'mode': frame_data.mode,
8381
- 'odr_1': frame_data.odr_1+'Hz',
8382
- 'sampling_duration_1': frame_data.sampling_duration_1,
8542
+ 'odr': frame_data.odr_1+'Hz',
8543
+ 'sampling_duration': frame_data.sampling_duration_1,
8383
8544
  'filter_status': frame_data.filter_status,
8384
- 'lpf_coeff_1': frame_data.lpf_coeff_1,
8385
- 'lpf_freq_1': frame_data.lpf_freq_1+'Hz',
8386
- 'hpf_coeff_1': frame_data.hpf_coeff_1,
8387
- 'hpf_freq_1': frame_data.hpf_freq_1+'Hz',
8545
+ 'lpf_coeff': frame_data.lpf_coeff_1,
8546
+ 'lpf_freq': frame_data.lpf_freq_1+'Hz',
8547
+ 'hpf_coeff': frame_data.hpf_coeff_1,
8548
+ 'hpf_freq': frame_data.hpf_freq_1+'Hz',
8388
8549
  'sampling_interval': frame_data.sampling_interval,
8389
8550
  'on_request_timeout': frame_data.on_request_timeout,
8390
8551
  'deadband': frame_data.deadband,
8391
8552
  'payload_length': frame_data.payload_length,
8553
+ 'fsm': frame_data.fsr_text,
8554
+ 'rpm_compute_status': frame_data.rpm_status,
8392
8555
  'machine_values': {
8393
8556
  'firmware': frame[2],
8394
8557
  'destination_address': toMac(frame.slice(12, 16), false),
8395
8558
  'mode': frame[16],
8396
- 'odr_1': frame[17],
8397
- 'sampling_duration_1': frame[19],
8398
- 'filter_status': frame[21],
8399
- 'lpf_coeff_1': frame[22],
8400
- 'hpf_coeff_1': frame[24],
8401
- 'sampling_interval': frame[26],
8402
- 'on_request_timeout': frame[27],
8403
- 'deadband': frame[28],
8404
- 'payload_length': frame[29]
8559
+ 'odr': frame[17],
8560
+ 'sampling_duration_1': frame[18],
8561
+ 'filter_status': frame[19],
8562
+ 'lpf_coeff': frame[20],
8563
+ 'hpf_coeff': frame[21],
8564
+ 'sampling_interval': frame[22],
8565
+ 'on_request_timeout': frame[23],
8566
+ 'deadband': frame[24],
8567
+ 'payload_length': frame[25],
8568
+ 'fsm': frame[26],
8569
+ 'rpm_compute_status': frame[27],
8405
8570
  }
8406
8571
  }
8407
8572
  }
@@ -8700,7 +8865,7 @@ function sensor_types(parent){
8700
8865
  z_peak_one_Hz: payload.slice(48, 50).reduce(msbLsb),
8701
8866
  z_peak_two_Hz: payload.slice(50, 52).reduce(msbLsb),
8702
8867
  z_peak_three_Hz: payload.slice(52, 54).reduce(msbLsb),
8703
- rpm: payload.slice(54, 56).reduce(msbLsb) / 10
8868
+ rpm: payload.slice(54, 56).reduce(msbLsb)
8704
8869
  };
8705
8870
  }
8706
8871
  // else{
@@ -8753,8 +8918,8 @@ function sensor_types(parent){
8753
8918
  frame_data.odr_1 = 25600;
8754
8919
  break;
8755
8920
  }
8756
- frame_data.sampling_duration_1 = frame[19]*50 + "ms";
8757
- switch(frame[21]){
8921
+ frame_data.sampling_duration_1 = frame[18]*50 + "ms";
8922
+ switch(frame[19]){
8758
8923
  case 0:
8759
8924
  frame_data.filter_status = "Disabled";
8760
8925
  break;
@@ -8762,7 +8927,7 @@ function sensor_types(parent){
8762
8927
  frame_data.filter_status = "Enabled";
8763
8928
  break;
8764
8929
  }
8765
- switch(frame[22]){
8930
+ switch(frame[20]){
8766
8931
  case 0:
8767
8932
  frame_data.lpf_coeff_1 = 4;
8768
8933
  break;
@@ -8795,7 +8960,7 @@ function sensor_types(parent){
8795
8960
  break;
8796
8961
  }
8797
8962
  frame_data.lpf_freq_1 = frame_data.odr_1 / frame_data.lpf_coeff_1;
8798
- switch(frame[24]){
8963
+ switch(frame[21]){
8799
8964
  case 0:
8800
8965
  frame_data.hpf_coeff_1 = 4;
8801
8966
  break;
@@ -8828,7 +8993,7 @@ function sensor_types(parent){
8828
8993
  break;
8829
8994
  }
8830
8995
  frame_data.hpf_freq_1 = frame_data.odr_1 / frame_data.hpf_coeff_1;
8831
- switch(frame[26]){
8996
+ switch(frame[22]){
8832
8997
  case 0:
8833
8998
  frame_data.sampling_interval = "5 Minutes";
8834
8999
  break;
@@ -8857,10 +9022,10 @@ function sensor_types(parent){
8857
9022
  frame_data.sampling_interval = "1 Minute";
8858
9023
  break;
8859
9024
  }
8860
- frame_data.on_request_timeout = frame[27] + " Seconds";
8861
- frame_data.deadband = frame[28] + "mg";
9025
+ frame_data.on_request_timeout = frame[23] + " Seconds";
9026
+ frame_data.deadband = frame[24] + "mg";
8862
9027
 
8863
- switch(frame[29]){
9028
+ switch(frame[25]){
8864
9029
  case 0:
8865
9030
  frame_data.payload_length = "50 Bytes";
8866
9031
  break;
@@ -8874,35 +9039,53 @@ function sensor_types(parent){
8874
9039
  frame_data.payload_length = "180 Bytes";
8875
9040
  break;
8876
9041
  }
8877
-
9042
+ switch(frame[26]){
9043
+ case 0:
9044
+ frame_data.fsr_text = "2g";
9045
+ break;
9046
+ case 1:
9047
+ frame_data.fsr_text = "4g";
9048
+ break;
9049
+ case 2:
9050
+ frame_data.fsr_text = "8g";
9051
+ break;
9052
+ case 3:
9053
+ frame_data.fsr_text = "16g";
9054
+ break;
9055
+ }
9056
+ frame_data.rpm_status = frame[27]? 'Enabled': 'Disabled';
8878
9057
  return {
8879
9058
  'firmware': frame[2],
8880
9059
  'destination_address': toMac(frame.slice(12, 16)),
8881
9060
  'mode': frame_data.mode,
8882
- 'odr_1': frame_data.odr_1+'Hz',
8883
- 'sampling_duration_1': frame_data.sampling_duration_1,
9061
+ 'odr': frame_data.odr_1+'Hz',
9062
+ 'sampling_duration': frame_data.sampling_duration_1,
8884
9063
  'filter_status': frame_data.filter_status,
8885
- 'lpf_coeff_1': frame_data.lpf_coeff_1,
8886
- 'lpf_freq_1': frame_data.lpf_freq_1+'Hz',
8887
- 'hpf_coeff_1': frame_data.hpf_coeff_1,
8888
- 'hpf_freq_1': frame_data.hpf_freq_1+'Hz',
9064
+ 'lpf_coeff': frame_data.lpf_coeff_1,
9065
+ 'lpf_freq': frame_data.lpf_freq_1+'Hz',
9066
+ 'hpf_coeff': frame_data.hpf_coeff_1,
9067
+ 'hpf_freq': frame_data.hpf_freq_1+'Hz',
8889
9068
  'sampling_interval': frame_data.sampling_interval,
8890
9069
  'on_request_timeout': frame_data.on_request_timeout,
8891
9070
  'deadband': frame_data.deadband,
8892
9071
  'payload_length': frame_data.payload_length,
9072
+ 'fsr': frame_data.fsr_text,
9073
+ 'rpm_compute_status': frame_data.rpm_status,
8893
9074
  'machine_values': {
8894
9075
  'firmware': frame[2],
8895
9076
  'destination_address': toMac(frame.slice(12, 16), false),
8896
9077
  'mode': frame[16],
8897
- 'odr_1': frame[17],
8898
- 'sampling_duration_1': frame[19],
8899
- 'filter_status': frame[21],
8900
- 'lpf_coeff_1': frame[22],
8901
- 'hpf_coeff_1': frame[24],
8902
- 'sampling_interval': frame[26],
8903
- 'on_request_timeout': frame[27],
8904
- 'deadband': frame[28],
8905
- 'payload_length': frame[29]
9078
+ 'odr': frame[17],
9079
+ 'sampling_duration': frame[18],
9080
+ 'filter_status': frame[19],
9081
+ 'lpf_coeff': frame[20],
9082
+ 'hpf_coeff': frame[21],
9083
+ 'sampling_interval': frame[22],
9084
+ 'on_request_timeout': frame[23],
9085
+ 'deadband': frame[24],
9086
+ 'payload_length': frame[25],
9087
+ 'fsr': frame[26],
9088
+ 'rpm_compute_status': frame[27],
8906
9089
  }
8907
9090
  }
8908
9091
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ncd-io/node-red-enterprise-sensors",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {