Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Autodesk/machine-collaboration-utility
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Printrbot/machine-collaboration-utility
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Feb 2, 2017

  1. Copy the full SHA
    ab5464e View commit details
  2. Copy the full SHA
    5dfffbd View commit details
  3. Copy the full SHA
    40d7182 View commit details
Showing with 23 additions and 6 deletions.
  1. +10 −3 bots/Conductor/Conductor.js
  2. +2 −2 bots/Marlin/PrintrbotSimple.js
  3. +2 −1 react/modules/Bots/Dashboard/ConductorPlayers.js
  4. +9 −0 server/middleware/bots/bot.js
13 changes: 10 additions & 3 deletions bots/Conductor/Conductor.js
Original file line number Diff line number Diff line change
@@ -40,7 +40,8 @@ const ConductorVirtual = function ConductorVirtual(app) {
bwait(self.commands.setupConductorArms(self));

// Go through each player and connect it
const players = JSON.parse(self.settings.custom).players;

const players = _.isString(self.settings.custom) ? JSON.parse(self.settings.custom).players : self.settings.custom.players;
for (const player of players) {
const localPlayer = _.find(self.app.context.bots.botList, (bot) => {
return bot.port === player.endpoint;
@@ -198,7 +199,10 @@ const ConductorVirtual = function ConductorVirtual(app) {
let doneConducting = true;
let accumulatePercentComplete = 0;
if (self.fsm.current === 'processingJob') {
const players = JSON.parse(self.settings.custom).players;


const players = _.isString(self.settings.custom) ? JSON.parse(self.settings.custom).players : self.settings.custom.players;

for (const player of players) {
if (player.jobUuid !== undefined) {
// Ping each job for status
@@ -346,7 +350,8 @@ const ConductorVirtual = function ConductorVirtual(app) {
}

playerArray.push({ name, endpoint });
bwait(self.updateBot({ custom: self.settings.custom }));
self.settings.custom.players = playerArray;
bwait(self.updateBot({ custom: {players:playerArray} }));
// should update the database version of this
return self.getBot();
} catch (ex) {
@@ -360,6 +365,8 @@ const ConductorVirtual = function ConductorVirtual(app) {
if (name === undefined) {
throw '"name" is undefined';
}
if (_.isString(self.settings.custom))
self.settings.custom = JSON.parse(self.settings.custom);

const players = self.settings.custom.players;
let playerRemoved = false;
4 changes: 2 additions & 2 deletions bots/Marlin/PrintrbotSimple.js
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ const Printrbot = function (app) {
});

_.extend(this.info, {
vid: 5824,
pid: 1155,
vid: 2974,
pid: 0600,
baudrate: 230400,
});
};
3 changes: 2 additions & 1 deletion react/modules/Bots/Dashboard/ConductorPlayers.js
Original file line number Diff line number Diff line change
@@ -12,7 +12,8 @@ export default class ConductorPlayers extends React.Component {

createPlayerList() {
const playerList = [];
for (const player of this.props.bot.settings.custom.players) {
let c = (_.isString(this.props.bot.settings.custom)) ? JSON.parse(this.props.bot.settings.custom) : this.props.bot.settings.custom;
for (const player of c.players) {
playerList.push(this.createPlayer(player));
}
return playerList;
9 changes: 9 additions & 0 deletions server/middleware/bots/bot.js
Original file line number Diff line number Diff line change
@@ -217,6 +217,15 @@ Bot.prototype.updateBot = bsync(function updateBot(newSettings) {
}
}
}

if (_.isString(settingsToUpdate)) {
settingsToUpdate = JSON.parse(settingsToUpdate);
}

if (_.isString(settingsToUpdate.custom)) {
settingsToUpdate.custom = JSON.parse(settingsToUpdate.custom);
}

if (settingsToUpdate.endpoint !== undefined) {
this.setPort(settingsToUpdate.endpoint);
}