GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (890)

src/plugins/thrusters2x1/index.js (3 issues)

1
function thrusters2x1(name, deps) {
2
  deps.logger.debug('The motor_diags plugin.');
3
  //instance variables
4
  this.cockpit = deps.cockpit;
5
  this.global = deps.globalEventLoop;
6
  this.deps = deps;
7
  this.settings;
0 ignored issues
show
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
8
}
9
thrusters2x1.prototype.start = function start() {
10
  var self = this;
11
12
  //While we work on the best pattern this is a work around to make sure the MCU
13
  //gets the motor settings.  Every 30 seconds they get recent, or immediatly after
14
  //settings have changed.  This decouples the timing issues around the MCU not coming
15
  //up at the same time the Node module.
16
  this.settingtimer = setInterval(function(){self.SendMotorSettings()},30000)
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
17
18
  self.cockpit.on('callibrate_escs', function () {
19
    self.deps.globalEventLoop.emit('mcu.SendCommand', 'mcal()');
20
    self.deps.logger.debug('mcal() sent');
21
  });
22
  self.cockpit.on('plugin.thrusters2x1.motorTest', function (positions) {
23
    self.deps.globalEventLoop.emit('mcu.SendMotorTest', positions.port, positions.starboard, positions.vertical);
24
  });
25
  self.global.withHistory.on('settings-change.thrusters2x1', function (data) {  
26
    self.settings = data.thrusters2x1;
27
    self.SendMotorSettings();
28
  });
29
};
30
31
thrusters2x1.prototype.SendMotorSettings = function SendMotorSettings() {
32
    if (!this.settings){return;}
33
    var settings = this.settings;
34
    var port = settings.port['forward-modifier'];
35
    var vertical = settings.vertical['forward-modifier'];
36
    var starbord = settings.starboard['forward-modifier'];
37
    var nport = settings.port['reverse-modifier'];
38
    var nvertical = settings.vertical['reverse-modifier'];
39
    var nstarbord = settings.starboard['reverse-modifier'];
40
    if (settings.port.reversed) {
41
      port = port * -1;
42
      nport = nport * -1;
43
    }
44
    if (settings.vertical.reversed) {
45
      vertical = vertical * -1;
46
      nvertical = nvertical * -1;
47
    }
48
    if (settings.starboard.reversed) {
49
      starbord = starbord * -1;
50
      nstarbord = nstarbord * -1;
51
    }
52
    //todo: Move to motor-diag plugin
53
    //API to Arduino to pass a percent in 2 decimal accuracy requires multipling by 100 before sending.
54
    command = 'mtrmod1(' + port * 100 + ',' + vertical * 100 + ',' + starbord * 100 + ')';
55
    this.global.emit('mcu.SendCommand', command);
56
    command = 'mtrmod2(' + nport * 100 + ',' + nvertical * 100 + ',' + nstarbord * 100 + ')';
57
    this.global.emit('mcu.SendCommand', command);
58
  }
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
59
60
thrusters2x1.prototype.getSettingSchema = function getSettingSchema() {
61
  return [{
62
      'title': 'Thrusters',
63
      'description' : 'Settings for thrusters in a 2X1 (2 Port/Starboard lateral X 1 Vertical)',
64
      'category': 'hardware',
65
      'id': 'thrusters2x1',
66
      'type': 'object',
67
      'properties': {
68
        'motor-response-delay-ms': {
69
          'type': 'number',
70
          'title': 'Motor response delay (ms)',
71
          'description' : 'Response delay will smooth out thruster accelerations over time which prevents large current spikes.',
72
          'minimum': 0,
73
          'maximum': 100,
74
          'default': 0
75
        },
76
        'port': {
77
          'title:': 'Port Motor',
78
          'type': 'object',
79
          'properties': {
80
            'reversed': {
81
              'type': 'boolean',
82
              'format': 'checkbox',
83
              'default': false
84
            },
85
            'forward-modifier': {
86
              'description' : 'Used to adjust the power sent to the motor so that thrusters provide equal thrust',
87
              'type': 'number',
88
              'default': 1
89
            },
90
            'reverse-modifier': {
91
              'description' : 'Used to adjust the power sent to the motor so that thrusters provide equal thrust',              
92
              'type': 'number',
93
              'default': 2
94
            }
95
          }
96
        },
97
        'vertical': {
98
          'title:': 'Port Motor',
99
          'type': 'object',
100
          'properties': {
101
            'reversed': {
102
              'type': 'boolean',
103
              'format': 'checkbox',
104
              'default': false
105
            },
106
            'forward-modifier': {
107
              'description' : 'Used to adjust the power sent to the motor so that thrusters provide equal thrust',              
108
              'type': 'number',
109
              'default': 1
110
            },
111
            'reverse-modifier': {
112
              'description' : 'Used to adjust the power sent to the motor so that thrusters provide equal thrust',              
113
              'type': 'number',
114
              'default': 2
115
            }
116
          }
117
        },
118
        'starboard': {
119
          'title:': 'Port Motor',
120
          'type': 'object',
121
          'properties': {
122
            'reversed': {
123
              'type': 'boolean',
124
              'format': 'checkbox',
125
              'default': true
126
            },
127
            'forward-modifier': {
128
              'description' : 'Used to adjust the power sent to the motor so that thrusters provide equal thrust',              
129
              'type': 'number',
130
              'default': 1
131
            },
132
            'reverse-modifier': {
133
              'description' : 'Used to adjust the power sent to the motor so that thrusters provide equal thrust',              
134
              'type': 'number',
135
              'default': 2
136
            }
137
          }
138
        }
139
      }
140
    }];
141
};
142
//Expose either a function or object for require
143
module.exports = function (name, deps) {
144
  return new thrusters2x1(name, deps);
145
};