Skip to content

Commit

Permalink
Refactor/small fixes (#267)
Browse files Browse the repository at this point in the history
* #55 refactor: dp and nf unavailable in the beginning

Also tcp has more connection attempts becuase the new simulator is slower to connect with

* #104 feature: show reference when lock not active

* #54 test: fix dp/nf availability
  • Loading branch information
trebua authored Nov 19, 2019
1 parent 1d9c3f0 commit dc33db3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion public/TCP/TCPClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let messageProtocol = messageProtocols.IMC;

// How many times the TCP has tried to connect and how many times it can try before quitting.
let connectionAttempts = 0;
const limitAttempts = 3;
const limitAttempts = 5;

// Creates a client that receives and sends data to port 5000
function getConnectedClient() {
Expand Down
4 changes: 4 additions & 0 deletions public/__tests__/mapping.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ test(prefix + 'AutoHeading/AutoDepth clicks', () => {

// NF
test(prefix + 'NF clicks', () => {
global.mode.dpAvailable = true;
global.mode.nfAvailable = true;
global.mode.currentMode = 2;
handleClick([{ button: 'DPadLeft' }]);
expect(global.netfollowing.distance).toBe(0.9);
Expand Down Expand Up @@ -288,6 +290,8 @@ test(prefix + 'NF clicks', () => {

// DP
test(prefix + 'DP clicks', () => {
global.mode.dpAvailable = true;
global.mode.nfAvailable = true;
handleClick([{ button: 'Start' }]);
expect(global.mode.currentMode).toBe(1);
handleClick([{ button: 'Back' }]);
Expand Down
4 changes: 2 additions & 2 deletions public/utils/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ const initGlobals = () => {
*/
global.mode = {
currentMode: 0,
nfAvailable: true,
dpAvailable: true,
nfAvailable: false,
dpAvailable: false,
manual: 0,
dp: 1,
nf: 2,
Expand Down
2 changes: 1 addition & 1 deletion src/ControlComponents/Lock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function Lock({
max={max}
step={step}
clickFunction={updateValue}
externalValue={active ? currentValue : undefined}
externalValue={active ? currentValue : reference}
></ModeInput>
</div>
<div className="check">
Expand Down

0 comments on commit dc33db3

Please sign in to comment.