Skip to content

Commit

Permalink
[FIX] feedback / polish
Browse files Browse the repository at this point in the history
  • Loading branch information
zaneclaes committed Sep 21, 2020
1 parent dfe2803 commit 6620521
Show file tree
Hide file tree
Showing 12 changed files with 262 additions and 129 deletions.
6 changes: 5 additions & 1 deletion bin/launch
@@ -1,6 +1,6 @@
#!/bin/bash
set -eo pipefail
version="0.2"
version="0.3"

MAKERVERSE_HOME=${MAKERVERSE_HOME:-${HOME}}
# Figure out where the git checkout directory lives, if any:
Expand Down Expand Up @@ -151,6 +151,10 @@ launch() {
installPrompt "curl -sSL https://get.docker.com | sh" "https://www.docker.com/products/docker-desktop"
exit 1
fi

echo "Cleaning up old docker images..."
docker system prune --force

docker_tagged="${docker_img}:${channel}"
if [[ "$_arg_update" = "on" ]]; then
echo "Updating $docker_tagged..."
Expand Down
45 changes: 45 additions & 0 deletions docs/installation/web-server/docker.md
Expand Up @@ -78,3 +78,48 @@ docker run --rm --privileged --name makerverse \
## Updating

Each time the `bin/launch` script is run, it will automatically update the application by pulling the latest docker image. If you use the [linux service](/installation/web-server/linux-service/#updating), this happens each time you restart the service.

## Scripts & Widgets

Sometimes, you need to create a file or folder which Makerverse can access.

This is slightly complicated when using Docker:

- The folder where Makerverse is located is called the "project path."
- Anything in this folder is "shared" with the Makerverse application.
- However, while inside the Makerverse application, the path to the shared folder is `/home/node/makerverse`.

### Shared Path

When you run the `bin/launch` script, you should see something like this (example taken from a Raspberry Pi):

```
Makerverse:latest settings: /home/pi/.makerverse (project at: /home/pi/makerverse)
```

On a Mac, the project might be at something like `/Users/zaneclaes/makerverse`.

Inside Makerverse, you always use `/home/node/makerverse` to refer to the project path.

### Example

For example, on your Raspberry Pi or Linux computer running Makerverse, you could run:

```
cd makerverse
mkdir -p commands
```

And then perhaps create a script to turn on your CNC machine (e.g., `nano commands/cnc-power.sh`). You do **not** need to restart Makerverse. You should immediately be able to refer to the files in this "commands" folder (e.g., `/home/node/makerverse/commands/cnc-power.sh`).

For example, you might use the Makerverse settings to create a command which passes the argument "on":

```
bash /home/node/makerverse/actions/cnc-power.sh on
```

And another the argument "off":

```
bash /home/node/makerverse/events/cnc-power.sh off
```
6 changes: 6 additions & 0 deletions docs/installation/web-server/raspberry-pi.md
Expand Up @@ -36,6 +36,12 @@ When running the Desktop version, you will still need to follow on-screen instru

The Desktop edition is meant to be used as a shopfloor tablet. Once configured, it will automatically launch Chromium in "Kiosk" mode, loading the Makerverse application in a full-screen web browser. Makerverse is still running as a Web Server in the background, so other clients can also simultaneously connect.

## Scripts & Widgets

Files you need to access from Makerverse should be placed in the `/home/pi/makerverse` directory (or a new subdirectory thereof). Then, from Makerverse, you can access the files from `/home/node/makerverse` (notice the `pi` vs. `node`).

A more complete explanation of this topic may be found in the [Docker section](/installation/web-server/docker/).

## Updating

See: how to [update the linux service installation](/installation/web-server/linux-service/#updating).
13 changes: 8 additions & 5 deletions src/app/containers/Header/Header.jsx
Expand Up @@ -54,7 +54,7 @@ class Header extends PureComponent {
this._isMounted && this.setState(versionInfo);
}
} catch (res) {
// Ignore error
log.error('api:updates', res);
}
},
fetchCommands: async () => {
Expand All @@ -66,7 +66,7 @@ class Header extends PureComponent {
commands: commands.filter(command => command.enabled)
});
} catch (res) {
// Ignore error
log.error('api:fetchCommands', res);
}
},
runCommand: async (cmd) => {
Expand All @@ -80,7 +80,7 @@ class Header extends PureComponent {
})
});
} catch (res) {
// Ignore error
log.error('api:runCommand', res);
}
}
};
Expand Down Expand Up @@ -250,10 +250,11 @@ class Header extends PureComponent {
const signedInName = store.get('session.name');
const hideUserDropdown = !sessionEnabled;
const showCommands = commands.length > 0;
// const workspace = Workspaces.findByPath(location.pathname);
const workspace = Workspaces.findByPath(location.pathname);
const updateMsg = i18n._('A new version of {{name}} is available', { name: settings.productName }) + '. ' +
i18n._('Version {{version}}', { version: latestVersion.readable }) +
` (${moment(lastUpdate).format('LLL')})`;
const title = workspace ? workspace.name : 'Makerverse';

return (
<Navbar
Expand All @@ -272,7 +273,9 @@ class Header extends PureComponent {
src="images/logo-badge-32x32.png"
alt=""
/>
<h1 style={{ color: '#222', marginLeft: '15px', marginTop: 0, marginBottom: 0, fontSize: '30px', fontWeight: '600' }}>Makerverse</h1>
<h1 style={{ color: '#222', marginLeft: '15px', marginTop: 0, marginBottom: 0, fontSize: '30px', fontWeight: '600' }}>
{title}
</h1>
{updateAvailable && (
<Tooltip
placement="bottom"
Expand Down
2 changes: 1 addition & 1 deletion src/app/lib/Maslow/MaslowCalibration.jsx
Expand Up @@ -326,7 +326,7 @@ class MaslowCalibration {
const wpos = this.controller.state.status.wpos;
if (this.dist(mpos, wpos) >= 0.1) {
// Set WPos = MPos when they differ.
gcode.push(`G10 L20 P1 X${mpos.x} Y${mpos.y}`);
gcode.push(`G10 L20 P1 X${mpos.x} Y${mpos.y} Z${mpos.z}`);
}
if (this.opts.cutHoles) {
gcode.push(`G0 Z${this.opts.safeTravel}`);
Expand Down
16 changes: 11 additions & 5 deletions src/app/lib/workspace-axis.js
Expand Up @@ -120,17 +120,23 @@ class WorkspaceAxis {

// Returns an array of jog steps for this axis.
getJogSteps(opts) {
// const isImperialUnits = this._checkImperialUnits(imperialUnits);
const max = opts.max || (this.range / 2);
const min = opts.min || (this.accuracy);
const isImperialUnits = this._checkImperialUnits(opts.imperialUnits);
const max = (opts.max || (this.range / 2));
const min = (opts.min || (this.accuracy));
const steps = [];
for (let v = min; v < max; v *= 10) {
steps.push(this.round(v, opts.imperialUnits));
steps.push(this.round(v, isImperialUnits));
const v2 = v * 10;
if (v2 < max) {
steps.push(this.round(v2 / 2, opts.imperialUnits));
steps.push(this.round(v2 / 2, isImperialUnits));
}
}
// Remove the last element and add it in-order with the second-biggest element.
const last = steps.pop();
const next = this.round(max / 2, isImperialUnits);
steps.push(Math.min(last, next));
steps.push(Math.max(last, next));

steps.push(max);
return steps;
}
Expand Down
7 changes: 5 additions & 2 deletions src/app/lib/workspaces.jsx
Expand Up @@ -206,11 +206,14 @@ class Workspaces extends events.EventEmitter {
getJogSteps(imperialUnits = null) {
let axis = null;
const opts = { min: 9999, max: 0, imperialUnits: imperialUnits };
const div = imperialUnits ? 25.4 : 1;
const precision = imperialUnits ? 1 : 2;
const pow = Math.pow(10, precision);
Object.keys(this.axes).forEach((ak) => {
const a = this._axes[ak];
axis = (!axis || a.precision > axis.precision) ? a : axis;
opts.max = Math.max(opts.max, a.range / 2);
opts.min = Math.min(opts.min, a.accuracy);
opts.max = Math.max(opts.max, Math.round(a.range / 2 / div * pow) / pow);
opts.min = Math.min(opts.min, Math.round(a.accuracy / div * pow) / pow);
});
return axis ? axis.getJogSteps(opts) : null;
}
Expand Down

0 comments on commit 6620521

Please sign in to comment.