Skip to content

Commit

Permalink
Purge master relay code.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisl8 committed Oct 7, 2024
1 parent f80ee63 commit d956ec7
Show file tree
Hide file tree
Showing 20 changed files with 3 additions and 388 deletions.
1 change: 0 additions & 1 deletion cypress-tests/cypress/e2e/0-2-siteStartupLayout.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe("site initial layout and page function", () => {
cy.contains("robotName:").should("be.visible");
cy.contains("idleTimeoutInMinutes:").should("be.visible");
cy.contains("rosLibDelay:").should("be.visible");
cy.contains("useMasterPowerRelay:").should("be.visible");
cy.contains("masterPowerRelayUniqueString:").should("be.visible");
cy.contains("masterPowerRelayStringLocation:").should("be.visible");
cy.contains("useLCD:").should("be.visible");
Expand Down
7 changes: 0 additions & 7 deletions node/Arduino.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const robotModel = require('./robotModel');
const webModelFunctions = require('./webModelFunctions');
const UsbDevice = require('./UsbDevice');
const howManySecondsSince = require('./howManySecondsSince');
const masterRelay = require('./MasterRelay');
const personalData = require('./personalData');
const wait = require('./wait');

Expand Down Expand Up @@ -92,8 +91,6 @@ class Arduino {
}

static getPortName() {
/** @namespace personalData.masterPowerRelayStringLocation */
/** @namespace personalData.masterPowerRelayUniqueString */
const arduinoDevice = new UsbDevice(
personalData.arduinoUniqueString,
personalData.arduinoStringLocation,
Expand All @@ -104,10 +101,6 @@ class Arduino {
turnOnRelays() {
return new Promise((resolve, reject) => {
let delay = 0;
if (personalData.useMasterPowerRelay && !webModel.masterRelayOn) {
masterRelay('on');
delay = 3000;
}
setTimeout(() => {
let delayTwo = 0;
if (
Expand Down
1 change: 0 additions & 1 deletion node/Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const ipAddress = require('./ipAddress');

class Camera {
/** @namespace personalData.relays.has_fiveVolt */
/** @namespace personalData.useMasterPowerRelay */
constructor(cameraName, cameraModel) {
this.cameraName = cameraName;
this.cameraModel = cameraModel;
Expand Down
2 changes: 0 additions & 2 deletions node/LCD.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ let busy = false; // Prevent multiple instances from running at once in the same
let port; // Store port so we don't have to look it up every time.

async function getPortName() {
/** @namespace personalData.masterPowerRelayStringLocation */
/** @namespace personalData.masterPowerRelayUniqueString */
const relayDevice = new UsbDevice(
personalData.LCDString,
personalData.LCDLocation,
Expand Down
155 changes: 0 additions & 155 deletions node/MasterRelay.js

This file was deleted.

94 changes: 0 additions & 94 deletions node/ScanseSweepControl.js

This file was deleted.

3 changes: 1 addition & 2 deletions node/UsbRelayControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class UsbRelay {
if (
!personalData.demoWebSite &&
personalData.useUSBrelay &&
!robotModel.masterRelayBusy &&
!robotModel.usbRelayControlBusy
) {
if (webModel.debugging && webModel.logOtherMessages) {
Expand Down Expand Up @@ -111,7 +110,7 @@ class UsbRelay {
const timeout = 20; // loops
let triedSoFar = 0;
const checkBusyOrSwitch = () => {
if (!robotModel.usbRelayControlBusy && !robotModel.masterRelayBusy) {
if (!robotModel.usbRelayControlBusy) {
robotModel.usbRelayControlBusy = true;
const state = onOrOff.toLowerCase();
if (state !== 'on' && state !== 'off') {
Expand Down
10 changes: 2 additions & 8 deletions node/behaviors/handlePowerWithoutROS.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const personalData = require('../personalData');
const webModel = require('../webModel');
const webModelFunctions = require('../webModelFunctions');
const robotModel = require('../robotModel');
const masterRelay = require('../MasterRelay');
const wait = require('../wait');

async function handleUsbHubPower() {
Expand All @@ -12,7 +11,7 @@ async function handleUsbHubPower() {
webModelFunctions.scrollingStatusUpdate(message);
}

// Power off the Master Relay and all regular Relays after the idle timeout,
// Power off all regular Relays after the idle timeout,
// whether plugged in or not.
// NOTE: My last try at running this "continuously" it drained the 12v batteries,
// even when plugged in. Maybe my batteries are old, but it seems best to NOT do that.
Expand All @@ -22,8 +21,7 @@ async function handleUsbHubPower() {
if (
!webModel.ROSisRunning &&
webModel.idleTimeout &&
personalData.idleTimeoutInMinutes > 0 &&
webModel.masterRelayOn
personalData.idleTimeoutInMinutes > 0
) {
// NOTE: If you turn on debugging, this will update every behavior loop (1 second)
const dateNow = new Date();
Expand All @@ -38,10 +36,6 @@ async function handleUsbHubPower() {
if (idleMinutes > personalData.idleTimeoutInMinutes) {
console.log('Idle power down.');
webModelFunctions.scrollingStatusUpdate('Idle power down.');
if (personalData.useMasterPowerRelay) {
await wait(1); // The usbRelay calls just made by polling can clobber this if we don't wait.
masterRelay('off');
}
/** @namespace personalData.useUSBrelay */
if (personalData.useUSBrelay) {
await wait(1); // The usbRelay calls just made by polling can clobber this if we don't wait.
Expand Down
6 changes: 0 additions & 6 deletions node/behaviors/polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const personalData = require('../personalData');
const robotModel = require('../robotModel');
const speechEngine = require('../speechEngine');
const checkBattery = require('../checkBattery');
const masterRelay = require('../MasterRelay');
const getQRcodes = require('../getQRcodes');
const saveScreenShotForWeb = require('../saveScreenShotForWeb');
const howManySecondsSince = require('../howManySecondsSince');
Expand Down Expand Up @@ -54,10 +53,6 @@ async function polling() {
saveScreenShotForWeb();
}
}
if (webModel.checkMasterRelay) {
webModelFunctions.update('checkMasterRelay', false);
masterRelay('read');
}
if (webModel.checkUsbRelayBank) {
webModelFunctions.update('checkUsbRelayBank', false);
robotModel.usbRelay.updateAllRelayState();
Expand All @@ -81,7 +76,6 @@ async function polling() {
// It reduces how often zbarcam is run,
// and prevents it from getting stuck
robotModel.gettingQrCode = true;
// TODO: This doesn't work with the Master & 5volt relays off!
getQRcodes();
}

Expand Down
Loading

0 comments on commit d956ec7

Please sign in to comment.