config-editor-base 2.2.7 → 2.2.9

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.
package/dist/index.js CHANGED
@@ -441,6 +441,38 @@ var checkConfigFiltersDisabled = function checkConfigFiltersDisabled(content) {
441
441
  }
442
442
  };
443
443
  };
444
+ var checkConfigControlSignalZeroScalingFactor = function checkConfigControlSignalZeroScalingFactor(content) {
445
+ return function (dispatch) {
446
+ var channels = ["can_1", "can_2", "can_internal"];
447
+ var channel_names = ["CAN CH1", "CAN CH2", "CAN INTERNAL"];
448
+ for (var i = 0; i < 3; i++) {
449
+ if (content[channels[i]] != undefined && content[channels[i]].control != undefined) {
450
+ var can_control = content[channels[i]].control;
451
+ if (can_control.control_rx_state != undefined && can_control.control_tx_state != undefined) {
452
+ if (can_control.control_rx_state != 0 || can_control.control_tx_state != 0) {
453
+ var type_list = ["start", "stop"];
454
+ for (var j = 0; j < 2; j++) {
455
+ var type = type_list[j];
456
+ if (can_control[type] != undefined && can_control[type].signal != undefined && can_control[type].signal.factor != undefined && can_control[type].signal.length != undefined) {
457
+ var fields = ["factor", "length"];
458
+ var field_names = ["signal scaling factor", "signal bit length"];
459
+ for (var k = 0; k < 2; k++) {
460
+ if (can_control[type].signal[fields[k]] == 0) {
461
+ dispatch(set({
462
+ type: "warning",
463
+ message: "You have enabled a Control Signal on " + channel_names[i] + " (" + type + ") with a " + field_names[k] + " of 0 - this will result in a constant signal value and is most likely not intended.",
464
+ autoClear: false
465
+ }));
466
+ }
467
+ }
468
+ }
469
+ }
470
+ }
471
+ }
472
+ }
473
+ }
474
+ };
475
+ };
444
476
  var checkConfigTls = function checkConfigTls(content) {
445
477
  return function (dispatch) {
446
478
  if (content.connect != undefined && content.connect.s3 != undefined && content.connect.s3.server != undefined) {
@@ -586,6 +618,7 @@ var saveUpdatedConfiguration = function saveUpdatedConfiguration(filename, conte
586
618
  dispatch(checkConfigTlsPort(content));
587
619
  dispatch(checkFileSplitValue(content));
588
620
  dispatch(checkMissingAPN(content));
621
+ dispatch(checkConfigControlSignalZeroScalingFactor(content));
589
622
  }
590
623
  dispatch(setConfigContent(content));
591
624
  var blob = new Blob([JSON.stringify(content, null, 2)], {
@@ -686,6 +719,7 @@ var actions = {
686
719
  checkConfigTransmitPeriodDelay: checkConfigTransmitPeriodDelay,
687
720
  checkConfigTransmitMonitoring: checkConfigTransmitMonitoring,
688
721
  checkConfigFiltersDisabled: checkConfigFiltersDisabled,
722
+ checkConfigControlSignalZeroScalingFactor: checkConfigControlSignalZeroScalingFactor,
689
723
  checkConfigTls: checkConfigTls,
690
724
  checkConfigAwsEndpoint: checkConfigAwsEndpoint,
691
725
  checkS3EncryptedPasswordsNoKpub: checkS3EncryptedPasswordsNoKpub,