Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f57049
commit 4318743
Showing
28 changed files
with
8,703 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
etc/bedclear | ||
etc/uuid | ||
tmp |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
|
||
echo "My IP address is $(hostname -I)" | ||
/home/pi/grid-bot/start-root.sh | ||
/home/pi/grid-bot/bin/start-root.sh | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
export ROOT=/home/pi/grid-bot | ||
|
||
nohup nice -n -20 su -l -c ${ROOT}/bin/start-gridbot.sh pi > /tmp/gridbot.log 2>&1 & | ||
nohup nice -n 19 su -l -c ${ROOT}/bin/start-gridhost.sh pi > /tmp/gridhost.log 2>&1 & | ||
nohup nice -n 19 ${ROOT}/bin/start-camera.sh > /tmp/camera.log 2>&1 & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
( | ||
echo "updating code from github" | ||
cd ../grid-bot && git pull && \ | ||
cd ../grid-host && git pull && \ | ||
cd ../grid-apps && git pull | ||
echo "code update complete" | ||
) | tee -a /tmp/update-code.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
[ -z "$1" ] && echo "missing host name" && exit | ||
|
||
echo "HOST NAME=${1}" | ||
echo "${1}" > /etc/hostname || echo "unable to update hostname" | ||
echo "127.0.0.1 ${1}" >> /etc/hosts || echo "unable to undate hosts" | ||
hostname "${1}" | ||
|
||
echo "updated host name. reboot required" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
[ -z "$1" ] && echo "missing ssid" && exit | ||
[ -z "$2" ] && echo "missing psk" && exit | ||
|
||
export TMPF=/tmp/wpa_supplicant.conf | ||
export FILE=/etc/wpa_supplicant/wpa_supplicant.conf | ||
|
||
echo "SSID=${1}" | ||
echo "PSK=${2}" | ||
echo "FILE=${FILE}" | ||
|
||
cat > ${TMPF} << EOF | ||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev | ||
update_config=1 | ||
country=US | ||
network={ | ||
ssid="${1}" | ||
psk="${2}" | ||
} | ||
EOF | ||
|
||
sudo mv ${TMPF} ${FILE} | ||
sudo cat ${FILE} | ||
|
||
echo "updated wifi settings. reboot required" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "grid-bot", | ||
"version": "0.0.1", | ||
"description": "Runtime environment setup for GridBot controllers and devices", | ||
"author": "Stewart Allen <sa@grid.space>", | ||
"license": "MIT", | ||
"private": false, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/stewartoallen/grid-bot.git" | ||
}, | ||
"keywords": [ | ||
"grid.space", | ||
"kiri:moto", | ||
"server", | ||
"3d", | ||
"print", | ||
"gcode" | ||
], | ||
"dependencies": { | ||
"connect": "^3.6.6", | ||
"minimist": "^1.2.0", | ||
"moment": "^2.22.2", | ||
"serialport": "^8.0.0", | ||
"serve-static": "^1.13.2", | ||
"ws": "^5.2.0" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
class LineBuffer { | ||
|
||
constructor(stream, online) { | ||
if (!stream) { | ||
throw "missing stream"; | ||
} | ||
const lbuf = this; | ||
this.enabled = true; | ||
this.buffer = null; | ||
this.stream = stream; | ||
this.online = online; | ||
if (online) { | ||
stream.on("readable", () => { | ||
let data; | ||
while (data = stream.read()) { | ||
lbuf.ondata(data); | ||
} | ||
}); | ||
} else { | ||
stream.on("data", data => { | ||
lbuf.ondata(data); | ||
}); | ||
} | ||
} | ||
|
||
ondata(data) { | ||
if (this.buffer) { | ||
this.buffer = Buffer.concat([this.buffer, data]); | ||
} else { | ||
this.buffer = data; | ||
} | ||
this.nextLine(); | ||
} | ||
|
||
nextLine() { | ||
if (!this.enabled) { | ||
return; | ||
} | ||
let left = 0; | ||
const data = this.buffer; | ||
const cr = data.indexOf("\r"); | ||
const lf = data.indexOf("\n"); | ||
if (lf && cr + 1 == lf) { left = 1 } | ||
if (lf >= 0) { | ||
let slice = data.slice(0, lf - left); | ||
if (this.online) { | ||
this.online(slice); | ||
} else { | ||
this.stream.emit("line", slice); | ||
} | ||
this.buffer = data.slice(lf + 1); | ||
this.nextLine(); | ||
} | ||
} | ||
|
||
} | ||
|
||
module.exports = LineBuffer; |
Oops, something went wrong.