├── .gitignore ├── bin ├── make-movie.sh ├── pi-ui-autostart ├── root-rc.local ├── setup-root.sh ├── start-camera.sh ├── start-gridbot.sh ├── start-gridhost.sh ├── start-root.sh ├── update-code.sh ├── update-name.sh └── update-wifi.sh ├── etc └── root-config.txt ├── init.js ├── license.md ├── package.json ├── readme.md ├── setup.sh ├── src ├── js │ ├── gridsend.js │ ├── linebuffer.js │ └── server.js ├── marlin │ ├── 2.0.x-longmill │ │ ├── Configuration.h │ │ ├── Configuration_adv.h │ │ ├── boards.h │ │ ├── pins.h │ │ └── platformio.ini │ └── 2.0.x │ │ ├── Configuration.h │ │ ├── Configuration_adv.h │ │ └── platformio.ini └── web │ ├── camera.css │ ├── camera.html │ ├── camera.jpg │ ├── camera.js │ ├── fa.min.js │ ├── favicon.ico │ ├── index.css │ ├── index.html │ ├── index.js │ ├── moment.js │ └── serial.js └── start-root.sh /.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | node_modules 3 | etc/server.json 4 | etc/bedclear 5 | etc/uuid 6 | tmp 7 | -------------------------------------------------------------------------------- /bin/make-movie.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | layers=$1 4 | 5 | [ -z "$layers" ] && echo "missing layers parameter" && exit 6 | 7 | x=0 8 | 9 | while [ $x -lt $layers ]; do 10 | cf="image-$(printf "%04d" $x).jpg" 11 | [ ! -f $cf ] && echo "missing $cf" && ( 12 | cp $lf $cf 13 | ) 14 | lf=$cf 15 | x=$((x+1)) 16 | done 17 | 18 | ffmpeg -r 60 -i image-%04d.jpg -s 800x600 movie.mp4 19 | -------------------------------------------------------------------------------- /bin/pi-ui-autostart: -------------------------------------------------------------------------------- 1 | @xset s noblank 2 | @xset s off 3 | @xset –dpms 4 | @chromium-browser --kiosk http://localhost:4080 5 | @unclutter -idle 0.1 6 | -------------------------------------------------------------------------------- /bin/root-rc.local: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "My IP address is $(hostname -I)" 4 | /home/pi/grid-bot/bin/start-root.sh 5 | 6 | exit 0 7 | -------------------------------------------------------------------------------- /bin/setup-root.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # update config.txt with required fields 4 | grep grid:bot /boot/config.txt || cat /home/pi/grid-bot/etc/root-config.txt >> /boot/config.txt 5 | 6 | # update rc.local to start grid:bot services 7 | cp /home/pi/grid-bot/bin/root-rc.local /etc/rc.local 8 | 9 | # allow tcp on x server 10 | grep ^xserver-allow-tcp=true /etc/lightdm/lightdm.conf || echo xserver-allow-tcp=true >> /etc/lightdm/lightdm.conf 11 | 12 | # redirect port 80 to 4080 with default index.html 13 | #echo '' > /var/www/html/index.html 14 | 15 | # update pacakges 16 | [ ! -f ${HOME}/.gb-up ] && apt -y update && apt -y dist-upgrade && touch ${HOME}/.gb-up 17 | 18 | # set timezone 19 | [ ! -f ${HOME}/.gb-tz ] && dpkg-reconfigure tzdata && touch ${HOME}/.gb-tz 20 | 21 | grep pi-gridbot /etc/hostname || ( 22 | echo pi-gridbot > /etc/hostname 23 | echo "127.0.0.1 pi-gridbot" >> /etc/hosts 24 | ) 25 | -------------------------------------------------------------------------------- /bin/start-camera.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # for standalone operation, add the following line to /etc/rc.local 4 | # nohup nice -n 19 su -l -c /home/pi/start-camera.sh pi > /tmp/camera.log 2>&1 & 5 | 6 | cd /home/pi/grid-bot >/dev/null 2>&1 || cd /home/pi 7 | 8 | # if motion enabled. use that port instead of stills 9 | [ -f etc/camera.conf ] && source etc/camera.conf 10 | if [ ! -z ${MOTION} ]; then 11 | motion -b -m 12 | echo ${MOTION} > /tmp/motion.port 13 | exit 14 | fi 15 | 16 | export cmd=$(which raspistill || which libcamera-still) 17 | 18 | [ ! -z $cmd ] || exit 19 | 20 | while /bin/true; do 21 | [ -f etc/camera.conf ] && source etc/camera.conf 22 | export RUN=1 23 | export DATE=$(date '+%Y-%m-%d') 24 | export TIME=$(date '+%H:%M') 25 | export TMPFILE=/tmp/camera.jpg 26 | export TEMP=${FILE_TEMP:-${TMPFILE}} 27 | export PERM=${FILE_PERM:-/var/www/html/camera.jpg} 28 | if [ ! -z ${TIMELAPSE} ]; then 29 | mkdir -p "${TIMELAPSE}/${DATE}" 30 | export TMPFILE="${TIMELAPSE}/${DATE}/${TIME}.jpg" 31 | if [ ! -z ${MAXAGE} ]; then 32 | find ${TIMELAPSE} -type f -mtime ${MAXAGE} -print -delete 33 | rmdir "${TIMELAPSE}/*" >/dev/null 2>&1 34 | fi 35 | if [ ! -z ${TRIGGER} ]; then 36 | if [ ! -f ${TRIGGER} ]; then 37 | export RUN=0 38 | fi 39 | fi 40 | fi 41 | [ ! -z ${NOIR} ] && export TUNING="--tuning-file /usr/share/libcamera/ipa/raspberrypi/imx219_noir.json" 42 | [ ${RUN} -eq 1 ] && ${cmd} -n \ 43 | --width ${WIDTH:-1600} \ 44 | --height ${HEIGHT:-1200} \ 45 | -q ${QUALITY:-20} \ 46 | -o ${TEMP} ${TUNING:-} \ 47 | -t ${TIMEOUT:-500} \ 48 | --shutter ${EXPOSURE:-40000} \ 49 | --rotation ${ROTATION:-90} \ 50 | --awb ${BALANCE:-greyworld} 2>/dev/null || exit 51 | [ ! -z ${MOGRIFY} ] && \ 52 | mogrify -rotate ${MOGRIFY} ${TEMP} 53 | cp ${TEMP} ${PERM} 54 | done 55 | -------------------------------------------------------------------------------- /bin/start-gridbot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export HOME=/home/pi 4 | export ROOT=${HOME}/grid-bot 5 | export NODE=${ROOT}/node/bin/node 6 | export BAUD=250000 7 | export OPTS='--listen --baud=${BAUD} --filedir=${ROOT}/uploads' 8 | export NODE=$(which node || echo $NODE) 9 | 10 | cd ${ROOT} 11 | while /bin/true; do 12 | [ -f etc/server.conf ] && source etc/server.conf 13 | echo "--- starting --- $(date)" 14 | eval "${NODE} src/js/server.js ${OPTS}" 15 | echo "--- exited ---" 16 | done 17 | -------------------------------------------------------------------------------- /bin/start-gridhost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export HOME=/home/pi 4 | export PATH=$PATH:$HOME/grid-bot/node/bin 5 | 6 | which node || echo "missing node" 7 | which node || exit 8 | 9 | cd $HOME/grid-host/ 10 | while /bin/true; do 11 | echo "--- starting --- $(date)" 12 | bin/grid-host 13 | echo "--- exited ---" 14 | done 15 | -------------------------------------------------------------------------------- /bin/start-root.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export ROOT=/home/pi/grid-bot 4 | mkdir -p /var/www/html 5 | 6 | # redirect traffic from port 80 to gridbot interface 7 | iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 4080 8 | iptables -A PREROUTING -t nat -i wlan0 -p tcp --dport 80 -j REDIRECT --to-port 4080 9 | 10 | nohup nice -n -20 su -l -c ${ROOT}/bin/start-gridbot.sh pi > /tmp/gridbot.log 2>&1 & 11 | #nohup nice -n 19 su -l -c ${ROOT}/bin/start-gridhost.sh pi > /tmp/gridhost.log 2>&1 & 12 | nohup nice -n 19 ${ROOT}/bin/start-camera.sh > /dev/null 2>&1 & 13 | -------------------------------------------------------------------------------- /bin/update-code.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ( 4 | echo "updating code from github" 5 | [ -d ../grid-bot ] && (cd ../grid-bot && git pull && npm i) 6 | [ -d ../grid-host ] && (cd ../grid-host && git pull && npm i) 7 | [ -d ../grid-apps ] && (cd ../grid-apps && git pull && npm i) 8 | sudo cp /home/pi/grid-bot/bin/root-rc.local /etc/rc.local 9 | echo "code update complete" 10 | ) | tee -a /tmp/update-code.log 11 | -------------------------------------------------------------------------------- /bin/update-name.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -z "$1" ] && echo "missing host name" && exit 4 | 5 | echo "HOST NAME=${1}" 6 | echo "${1}" > /etc/hostname || echo "unable to update hostname" 7 | echo "127.0.0.1 ${1}" >> /etc/hosts || echo "unable to undate hosts" 8 | hostname "${1}" 9 | 10 | echo "updated host name. reboot required" 11 | -------------------------------------------------------------------------------- /bin/update-wifi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -z "$1" ] && echo "missing ssid" && exit 4 | [ -z "$2" ] && echo "missing psk" && exit 5 | 6 | export TMPF=/tmp/wpa_supplicant.conf 7 | export FILE=/etc/wpa_supplicant/wpa_supplicant.conf 8 | 9 | echo "SSID=${1}" 10 | echo "PSK=${2}" 11 | echo "FILE=${FILE}" 12 | 13 | cat > ${TMPF} << EOF 14 | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 15 | update_config=1 16 | country=US 17 | 18 | network={ 19 | ssid="${1}" 20 | psk="${2}" 21 | } 22 | EOF 23 | 24 | sudo mv ${TMPF} ${FILE} 25 | sudo cat ${FILE} 26 | 27 | echo "updated wifi settings. reboot required" 28 | -------------------------------------------------------------------------------- /etc/root-config.txt: -------------------------------------------------------------------------------- 1 | # grid:bot ... for pi zero w 2 | #over_voltage=6 3 | #force_turbo=1 4 | 5 | # grid:bot ... pi 4 hdmi output 6 | #hdmi_force_hotplug=1 7 | #hdmi_drive=2 8 | 9 | # grid:bot ... for pi3 with 7" hdmi touch display 10 | #max_usb_current=1 11 | #hdmi_force_hotplug=1 12 | #config_hdmi_boost=7 13 | #hdmi_group=2 14 | #hdmi_mode=1 15 | #hdmi_mode=87 16 | #hdmi_drive=1 17 | #hdmi_cvt 800 480 60 6 0 0 0 18 | 19 | # grid:bot ... fir pi3 with element14 7" touch display 20 | dtoverlay=dwc2 21 | dtoverlay=gpio-shutdown 22 | 23 | # grid:bot ... hide undervoltage warnings 24 | avoid_warnings=1 25 | 26 | # grid:bot ... enable camera, set video mem 27 | start_x=1 28 | gpu_mem=128 29 | -------------------------------------------------------------------------------- /init.js: -------------------------------------------------------------------------------- 1 | module.exports = (server) => { 2 | let path = server.path; 3 | let join = require('path').join; 4 | let moddir = server.const.moddir; 5 | let srcdir = join(moddir, "src"); 6 | let webdir = join(moddir, "src/web"); 7 | 8 | // server "web" dir at the root of "/data" 9 | path.static(webdir, "/send"); 10 | }; 11 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | Copyright 2014-2018 Stewart Allen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included 11 | in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gridspace/grid-bot", 3 | "version": "0.1.0", 4 | "description": "Runtime environment for GridBot devices nd GridLocal clients", 5 | "author": "Stewart Allen ", 6 | "license": "MIT", 7 | "private": false, 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/GridSpace/grid-bot.git" 11 | }, 12 | "keywords": [ 13 | "grid.space", 14 | "kiri:moto", 15 | "server", 16 | "3d", 17 | "print", 18 | "gcode" 19 | ], 20 | "dependencies": { 21 | "connect": "^3.6.6", 22 | "minimist": "^1.2.5", 23 | "moment": "^2.27.0", 24 | "serialport": "^8.0.8", 25 | "serve-static": "^1.13.2", 26 | "ws": "^5.2.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | software interface for [GridBot](https://cad.onshape.com/documents/64a8b0664bd09cbffb0e0d17/w/044a002e53008b3bc2a845ec/e/9b8b7abe5b303b24f2f26d14) and other 3D printers or CNC mills. 2 | 3 | ### Just the Sender and Web UI 4 | 5 | this is suitable for anything from a Pi Zero on up. 6 | 7 | 1. clone this repo 8 | 2. cd to repo directory 9 | 3. `npm i` 10 | 4. if you don't have pm2 installed: `npm install -g pm2@latest` 11 | 5. create/edit `etc/server.json` inside the repo directory 12 | 6. `pm2 start src/js/server.js --name gridbot` 13 | 7. `pm2 log` 14 | 15 | the web interface will be on port `4080` 16 | 17 | ### etc/server.json 18 | 19 | ``` 20 | { 21 | "port": "/dev/ttyUSB0", 22 | "baud": 250000, 23 | } 24 | ``` 25 | 26 | ### for Klipper 27 | 28 | ``` 29 | { 30 | "port": "/tmp/printer", 31 | "baud": 250000, 32 | "on": { 33 | "boot": [ 34 | "M115" 35 | ] 36 | } 37 | } 38 | ``` 39 | 40 | ### Full Touch-Pi Intall 41 | 42 | from a fresh install of raspbian desktop, as user ```pi``` run this command: 43 | 44 | ```curl https://raw.githubusercontent.com/GridSpace/grid-bot/master/setup.sh | bash``` 45 | 46 | this could run for quite some time to update and install all OS dependencies 47 | 48 | ## Web interface screen shots 49 | 50 | ### Home Screen 51 | ![GridBot Home Screen](https://static.grid.space/img/gridbot-home.jpg) 52 | 53 | ### Jog and Movement Screen 54 | ![GridBot Move Screen](https://static.grid.space/img/gridbot-move.jpg) 55 | 56 | ### File Management Screen 57 | ![GridBot File Screen](https://static.grid.space/img/gridbot-file.jpg) 58 | 59 | ### Direct Communications Interface 60 | ![GridBot Comm Screen](https://static.grid.space/img/gridbot-comm.jpg) 61 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ `whoami` == 'root' ] && echo "run this script as the user 'pi'" && exit 4 | 5 | # require some packages 6 | sudo apt update 7 | sudo apt -y install automake avrdude g++ git unclutter vim wget 8 | 9 | [ -z "${HOME}" ] && echo "HOME not set" && exit 10 | 11 | cd ${HOME} 12 | 13 | # quietly remove all empty directories 14 | rmdir * >/dev/null 2>&1 15 | 16 | export ROOT="${HOME}/grid-bot" 17 | 18 | # install grid-bot package if missing 19 | [ ! -d "${ROOT}" ] && { 20 | echo "fetching grid-bot" 21 | git clone https://github.com/GridSpace/grid-bot.git 22 | } 23 | 24 | # update grid-bot 25 | cd "${ROOT}" 26 | git pull 27 | 28 | # uploads dir, remove legacy port link 29 | cd ${ROOT} 30 | rm port 31 | mkdir -p uploads 32 | 33 | # setup graphical interface boot 34 | export LXDIR=${HOME}/.config/lxsession/LXDE-pi 35 | mkdir -p "${LXDIR}" 36 | cp "${ROOT}/bin/pi-ui-autostart" "${LXDIR}/autostart" 37 | chmod 755 "${LXDIR}/autostart" 38 | 39 | # download, expand, link node 40 | if [ ! -d node ]; then 41 | echo "downloading nodejs" 42 | # for pi zero 43 | grep ARMv6 /proc/cpuinfo && { 44 | wget https://unofficial-builds.nodejs.org/download/release/v14.16.0/node-v14.16.0-linux-armv6l.tar.xz 45 | tar xf node-v14.16.0-linux-armv6l.tar.xz 46 | ln -sf node-v14.16.0-linux-armv6l node 47 | #wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-armv6l.tar.xz 48 | #tar xf node-v10.15.3-linux-armv6l.tar.xz 49 | #ln -sf node-v10.15.3-linux-armv6l node 50 | } 51 | # for pi 3 52 | grep ARMv7 /proc/cpuinfo && { 53 | wget https://nodejs.org/dist/latest-v14.x/node-v14.16.0-linux-armv7l.tar.xz 54 | tar xf node-v14.16.0-linux-armv7l.tar.xz 55 | ln -sf node-v14.16.0-linux-armv7l node 56 | #wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-armv7l.tar.xz 57 | #tar xf node-v10.15.3-linux-armv7l.tar.xz 58 | #ln -sf node-v10.15.3-linux-armv7l node 59 | } 60 | fi 61 | 62 | # ensure node in path 63 | grep node ${HOME}/.bashrc || { 64 | echo "export PATH=\${PATH}:${ROOT}/node/bin" >> ${HOME}/.bashrc 65 | } 66 | 67 | # make sure npm will work 68 | export PATH=${PATH}:${ROOT}/node/bin 69 | 70 | # update grid-bot post-node install (to get npm) 71 | cd ${ROOT} 72 | npm i 73 | 74 | # install grid-host 75 | [ ! -d "${HOME}/grid-host" ] && { 76 | echo "installing grid-host" 77 | cd ${HOME} 78 | git clone https://github.com/GridSpace/grid-host.git grid-host 79 | } 80 | 81 | # update grid-host modules 82 | cd "${HOME}/grid-host" 83 | git pull 84 | npm i 85 | 86 | # install grid-apps 87 | [ ! -d "${HOME}/grid-apps" ] && { 88 | echo "installing grid-apps" 89 | cd ${HOME} 90 | git clone https://github.com/GridSpace/grid-apps.git grid-apps 91 | } 92 | 93 | # update grid-apps modules 94 | cd "${HOME}/grid-apps" 95 | git pull 96 | npm i 97 | 98 | # do required root setups 99 | [ ! -d "${HOME}/.grid" ] && sudo ${ROOT}/bin/setup-root.sh && mkdir "${HOME}/.grid" 100 | 101 | # ssh setup/trust if desired 102 | [ ! -d "${HOME}/.ssh" ] && { 103 | mkdir -p "${HOME}/.ssh" 104 | chmod 700 "${HOME}/.ssh" 105 | } 106 | 107 | echo "change pi user password" 108 | echo "reboot required" 109 | -------------------------------------------------------------------------------- /src/js/gridsend.js: -------------------------------------------------------------------------------- 1 | /** Copyright Stewart Allen */ 2 | 3 | module.exports = { start, restart, stop, status }; 4 | 5 | /** 6 | * 7 | * @param {*} type device type 8 | * @param {*} url usually live.grid.space 9 | * @param {*} status device status 10 | * @param {*} update called on file receipt with (filename, gcode) 11 | */ 12 | function start(type, url, status, update) { 13 | if (req) { 14 | throw "grid send already started"; 15 | } 16 | console.log({starting: "gridsend", url}); 17 | proto = url.indexOf("https:") >= 0 ? https : http; 18 | stopped = false; 19 | looper(type, url, status, update); 20 | } 21 | 22 | function stop() { 23 | stopped = true; 24 | if (req) { 25 | req.destroy(); 26 | req = undefined; 27 | } 28 | } 29 | 30 | function restart() { 31 | if (req) { 32 | req.destroy(); 33 | req = undefined; 34 | } 35 | } 36 | 37 | function status() { 38 | return { stopped }; 39 | } 40 | 41 | const https = require('https'); 42 | const http = require('http'); 43 | 44 | let gridlast = '*'; 45 | let stopped; 46 | let req; 47 | let debug = false; 48 | 49 | function looper(type, url, status, update) { 50 | let timer = Date.now(); 51 | let killer = null; 52 | let sclean = JSON.parse(JSON.stringify(status)); 53 | sclean.buffer.collect = undefined; 54 | 55 | const opts = [ 56 | `uuid=${encodeURIComponent(status.device.uuid)}`, 57 | `stat=${encodeURIComponent(JSON.stringify(sclean))}`, 58 | `last=${gridlast}`, 59 | `time=${timer.toString(36)}`, 60 | `type=${type}` 61 | ].join('&'); 62 | 63 | if (opts.length > 4096) { 64 | console.log({invalid_opts: opts, exiting: true}); 65 | stopped = true; 66 | } 67 | 68 | const retry = function(time, bool) { 69 | debug = bool; 70 | if (killer) { 71 | clearTimeout(killer); 72 | } 73 | if (stopped) { 74 | return; 75 | } 76 | setTimeout(() => { 77 | looper(type, url, status, update); 78 | }, time); 79 | }; 80 | 81 | if (debug) { 82 | console.log({grid_up: url}); 83 | } 84 | req = proto.get(`${url}/api/grid_up?${opts}`, (res) => { 85 | const { headers, statusCode, statusMessage } = res; 86 | gridlast = '*'; 87 | if (debug) { 88 | console.log([headers, statusCode, statusMessage]); 89 | } 90 | let body = ''; 91 | res.on('data', data => { 92 | body += data.toString(); 93 | }); 94 | res.on('end', () => { 95 | debug = false; 96 | timer = Date.now() - timer; 97 | if (body === 'superceded') { 98 | // we have overlapping outbound calls (bad on us) 99 | console.log({grid_up: body}); 100 | return; 101 | } 102 | if (body === 'reconnect') { 103 | // console.log({reconnect: timer}); 104 | retry(100); 105 | } else { 106 | let [file, gcode] = body.split("\0"); 107 | if (file && gcode) { 108 | console.log({file, gcode: gcode.length}); 109 | gridlast = file; 110 | update(file, gcode); 111 | } else { 112 | if (body.length > 80) { 113 | body = body.split('\n').slice(0,10); 114 | } 115 | console.log({grid_up_reply: body, timer}); 116 | } 117 | retry(1000); 118 | } 119 | }); 120 | res.on('error', error => { 121 | console.log({http_get_error: error}); 122 | retry(2000, true); 123 | }); 124 | }).on('error', error => { 125 | console.log({grid_up_error: error}); 126 | retry(2000, true); 127 | }); 128 | killer = setTimeout(() => { 129 | console.log("killing zombied connection @ 3 min idle"); 130 | restart(); 131 | }, 3 * 60 * 1000); 132 | } 133 | -------------------------------------------------------------------------------- /src/js/linebuffer.js: -------------------------------------------------------------------------------- 1 | /** Copyright Stewart Allen */ 2 | 3 | class LineBuffer { 4 | 5 | constructor(stream, online) { 6 | if (!stream) { 7 | throw "missing stream"; 8 | } 9 | const lbuf = this; 10 | this.enabled = true; 11 | this.buffer = null; 12 | this.stream = stream; 13 | this.online = online; 14 | this.bytes = 0; 15 | this.crlf = false; 16 | if (online) { 17 | stream.on("readable", () => { 18 | let data; 19 | while (data = stream.read()) { 20 | lbuf.ondata(data); 21 | } 22 | }); 23 | } else { 24 | stream.on("data", data => { 25 | lbuf.ondata(data); 26 | }); 27 | } 28 | } 29 | 30 | ondata(data) { 31 | this.bytes += data.length; 32 | if (this.buffer) { 33 | this.buffer = Buffer.concat([this.buffer, data]); 34 | } else { 35 | this.buffer = data; 36 | } 37 | this.nextLine(); 38 | } 39 | 40 | nextLine() { 41 | if (!this.enabled) { 42 | return; 43 | } 44 | let left = 0; 45 | const data = this.buffer; 46 | const cr = data.indexOf("\r"); 47 | const lf = data.indexOf("\n"); 48 | if (lf && cr + 1 == lf) { 49 | left = 1; 50 | this.crlf = true; 51 | } else { 52 | this.crlf = false; 53 | } 54 | if (lf >= 0) { 55 | let slice = data.slice(0, lf - left); 56 | if (this.online) { 57 | this.online(slice); 58 | } else { 59 | this.stream.emit("line", slice); 60 | } 61 | this.buffer = data.slice(lf + 1); 62 | this.nextLine(); 63 | } 64 | } 65 | 66 | } 67 | 68 | module.exports = LineBuffer; 69 | -------------------------------------------------------------------------------- /src/marlin/2.0.x-longmill/boards.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Marlin 3D Printer Firmware 3 | * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] 4 | * 5 | * Based on Sprinter and grbl. 6 | * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | #pragma once 23 | 24 | #include "macros.h" 25 | 26 | #define BOARD_UNKNOWN -1 27 | 28 | // 29 | // RAMPS 1.3 / 1.4 - ATmega1280, ATmega2560 30 | // 31 | 32 | #define BOARD_RAMPS_OLD 1000 // MEGA/RAMPS up to 1.2 33 | 34 | #define BOARD_RAMPS_13_EFB 1010 // RAMPS 1.3 (Power outputs: Hotend, Fan, Bed) 35 | #define BOARD_RAMPS_13_EEB 1011 // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed) 36 | #define BOARD_RAMPS_13_EFF 1012 // RAMPS 1.3 (Power outputs: Hotend, Fan0, Fan1) 37 | #define BOARD_RAMPS_13_EEF 1013 // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Fan) 38 | #define BOARD_RAMPS_13_SF 1014 // RAMPS 1.3 (Power outputs: Spindle, Controller Fan) 39 | 40 | #define BOARD_RAMPS_14_EFB 1020 // RAMPS 1.4 (Power outputs: Hotend, Fan, Bed) 41 | #define BOARD_RAMPS_14_EEB 1021 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed) 42 | #define BOARD_RAMPS_14_EFF 1022 // RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1) 43 | #define BOARD_RAMPS_14_EEF 1023 // RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan) 44 | #define BOARD_RAMPS_14_SF 1024 // RAMPS 1.4 (Power outputs: Spindle, Controller Fan) 45 | 46 | #define BOARD_RAMPS_PLUS_EFB 1030 // RAMPS Plus 3DYMY (Power outputs: Hotend, Fan, Bed) 47 | #define BOARD_RAMPS_PLUS_EEB 1031 // RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Bed) 48 | #define BOARD_RAMPS_PLUS_EFF 1032 // RAMPS Plus 3DYMY (Power outputs: Hotend, Fan0, Fan1) 49 | #define BOARD_RAMPS_PLUS_EEF 1033 // RAMPS Plus 3DYMY (Power outputs: Hotend0, Hotend1, Fan) 50 | #define BOARD_RAMPS_PLUS_SF 1034 // RAMPS Plus 3DYMY (Power outputs: Spindle, Controller Fan) 51 | 52 | // 53 | // RAMPS Derivatives - ATmega1280, ATmega2560 54 | // 55 | 56 | #define BOARD_3DRAG 1100 // 3Drag Controller 57 | #define BOARD_K8200 1101 // Velleman K8200 Controller (derived from 3Drag Controller) 58 | #define BOARD_K8400 1102 // Velleman K8400 Controller (derived from 3Drag Controller) 59 | #define BOARD_BAM_DICE 1103 // 2PrintBeta BAM&DICE with STK drivers 60 | #define BOARD_BAM_DICE_DUE 1104 // 2PrintBeta BAM&DICE Due with STK drivers 61 | #define BOARD_MKS_BASE 1105 // MKS BASE v1.0 62 | #define BOARD_MKS_BASE_14 1106 // MKS v1.4 with A4982 stepper drivers 63 | #define BOARD_MKS_BASE_15 1107 // MKS v1.5 with Allegro A4982 stepper drivers 64 | #define BOARD_MKS_BASE_HEROIC 1108 // MKS BASE 1.0 with Heroic HR4982 stepper drivers 65 | #define BOARD_MKS_GEN_13 1109 // MKS GEN v1.3 or 1.4 66 | #define BOARD_MKS_GEN_L 1110 // MKS GEN L 67 | #define BOARD_KFB_2 1111 // BigTreeTech or BIQU KFB2.0 68 | #define BOARD_ZRIB_V20 1112 // zrib V2.0 control board (Chinese knock off RAMPS replica) 69 | #define BOARD_FELIX2 1113 // Felix 2.0+ Electronics Board (RAMPS like) 70 | #define BOARD_RIGIDBOARD 1114 // Invent-A-Part RigidBoard 71 | #define BOARD_RIGIDBOARD_V2 1115 // Invent-A-Part RigidBoard V2 72 | #define BOARD_SAINSMART_2IN1 1116 // Sainsmart 2-in-1 board 73 | #define BOARD_ULTIMAKER 1117 // Ultimaker 74 | #define BOARD_ULTIMAKER_OLD 1118 // Ultimaker (Older electronics. Pre 1.5.4. This is rare) 75 | #define BOARD_AZTEEG_X3 1119 // Azteeg X3 76 | #define BOARD_AZTEEG_X3_PRO 1120 // Azteeg X3 Pro 77 | #define BOARD_ULTIMAIN_2 1121 // Ultimainboard 2.x (Uses TEMP_SENSOR 20) 78 | #define BOARD_RUMBA 1122 // Rumba 79 | #define BOARD_RUMBA_RAISE3D 1123 // Raise3D N series Rumba derivative 80 | #define BOARD_RL200 1124 // Rapide Lite 200 (v1, low-cost RUMBA clone with drv) 81 | #define BOARD_FORMBOT_TREX2PLUS 1125 // Formbot T-Rex 2 Plus 82 | #define BOARD_FORMBOT_TREX3 1126 // Formbot T-Rex 3 83 | #define BOARD_FORMBOT_RAPTOR 1127 // Formbot Raptor 84 | #define BOARD_FORMBOT_RAPTOR2 1128 // Formbot Raptor 2 85 | #define BOARD_BQ_ZUM_MEGA_3D 1129 // bq ZUM Mega 3D 86 | #define BOARD_MAKEBOARD_MINI 1130 // MakeBoard Mini v2.1.2 is a control board sold by MicroMake 87 | #define BOARD_TRIGORILLA_13 1131 // TriGorilla Anycubic version 1.3-based on RAMPS EFB 88 | #define BOARD_TRIGORILLA_14 1132 // ... Ver 1.4 89 | #define BOARD_TRIGORILLA_14_11 1133 // ... Rev 1.1 (new servo pin order) 90 | #define BOARD_RAMPS_ENDER_4 1134 // Creality: Ender-4, CR-8 91 | #define BOARD_RAMPS_CREALITY 1135 // Creality: CR10S, CR20, CR-X 92 | #define BOARD_RAMPS_DAGOMA 1136 // Dagoma F5 93 | #define BOARD_FYSETC_F6_13 1137 // FYSETC F6 1.3 94 | #define BOARD_FYSETC_F6_14 1138 // FYSETC F6 1.4 95 | #define BOARD_DUPLICATOR_I3_PLUS 1139 // Wanhao Duplicator i3 Plus 96 | #define BOARD_VORON 1140 // VORON Design 97 | #define BOARD_TRONXY_V3_1_0 1141 // Tronxy TRONXY-V3-1.0 98 | #define BOARD_Z_BOLT_X_SERIES 1142 // Z-Bolt X Series 99 | #define BOARD_TT_OSCAR 1143 // TT OSCAR 100 | #define BOARD_OVERLORD 1144 // Overlord/Overlord Pro 101 | #define BOARD_HJC2560C_REV1 1145 // ADIMLab Gantry v1 102 | #define BOARD_HJC2560C_REV2 1146 // ADIMLab Gantry v2 103 | #define BOARD_TANGO 1147 // BIQU Tango V1 104 | #define BOARD_MKS_GEN_L_V2 1148 // MKS GEN L V2 105 | 106 | // 107 | // RAMBo and derivatives 108 | // 109 | 110 | #define BOARD_RAMBO 1200 // Rambo 111 | #define BOARD_MINIRAMBO 1201 // Mini-Rambo 112 | #define BOARD_MINIRAMBO_10A 1202 // Mini-Rambo 1.0a 113 | #define BOARD_EINSY_RAMBO 1203 // Einsy Rambo 114 | #define BOARD_EINSY_RETRO 1204 // Einsy Retro 115 | #define BOARD_SCOOVO_X9H 1205 // abee Scoovo X9H 116 | 117 | // 118 | // Other ATmega1280, ATmega2560 119 | // 120 | 121 | #define BOARD_CNCONTROLS_11 1300 // Cartesio CN Controls V11 122 | #define BOARD_CNCONTROLS_12 1301 // Cartesio CN Controls V12 123 | #define BOARD_CNCONTROLS_15 1302 // Cartesio CN Controls V15 124 | #define BOARD_CHEAPTRONIC 1303 // Cheaptronic v1.0 125 | #define BOARD_CHEAPTRONIC_V2 1304 // Cheaptronic v2.0 126 | #define BOARD_MIGHTYBOARD_REVE 1305 // Makerbot Mightyboard Revision E 127 | #define BOARD_MEGATRONICS 1306 // Megatronics 128 | #define BOARD_MEGATRONICS_2 1307 // Megatronics v2.0 129 | #define BOARD_MEGATRONICS_3 1308 // Megatronics v3.0 130 | #define BOARD_MEGATRONICS_31 1309 // Megatronics v3.1 131 | #define BOARD_MEGATRONICS_32 1310 // Megatronics v3.2 132 | #define BOARD_ELEFU_3 1311 // Elefu Ra Board (v3) 133 | #define BOARD_LEAPFROG 1312 // Leapfrog 134 | #define BOARD_MEGACONTROLLER 1313 // Mega controller 135 | #define BOARD_GT2560_REV_A 1314 // Geeetech GT2560 Rev. A 136 | #define BOARD_GT2560_REV_A_PLUS 1315 // Geeetech GT2560 Rev. A+ (with auto level probe) 137 | #define BOARD_GT2560_V3 1316 // Geeetech GT2560 Rev B for A10(M/D) 138 | #define BOARD_GT2560_V3_MC2 1317 // Geeetech GT2560 Rev B for Mecreator2 139 | #define BOARD_GT2560_V3_A20 1318 // Geeetech GT2560 Rev B for A20(M/D) 140 | #define BOARD_EINSTART_S 1319 // Einstart retrofit 141 | #define BOARD_WANHAO_ONEPLUS 1320 // Wanhao 0ne+ i3 Mini 142 | #define BOARD_LEAPFROG_XEED2015 1321 // Leapfrog Xeed 2015 143 | #define BOARD_SIENCI_LONGMILL 1322 // Sienci LongMill 144 | 145 | // 146 | // ATmega1281, ATmega2561 147 | // 148 | 149 | #define BOARD_MINITRONICS 1400 // Minitronics v1.0/1.1 150 | #define BOARD_SILVER_GATE 1401 // Silvergate v1.0 151 | 152 | // 153 | // Sanguinololu and Derivatives - ATmega644P, ATmega1284P 154 | // 155 | 156 | #define BOARD_SANGUINOLOLU_11 1500 // Sanguinololu < 1.2 157 | #define BOARD_SANGUINOLOLU_12 1501 // Sanguinololu 1.2 and above 158 | #define BOARD_MELZI 1502 // Melzi 159 | #define BOARD_MELZI_MAKR3D 1503 // Melzi with ATmega1284 (MaKr3d version) 160 | #define BOARD_MELZI_CREALITY 1504 // Melzi Creality3D board (for CR-10 etc) 161 | #define BOARD_MELZI_MALYAN 1505 // Melzi Malyan M150 board 162 | #define BOARD_MELZI_TRONXY 1506 // Tronxy X5S 163 | #define BOARD_STB_11 1507 // STB V1.1 164 | #define BOARD_AZTEEG_X1 1508 // Azteeg X1 165 | #define BOARD_ANET_10 1509 // Anet 1.0 (Melzi clone) 166 | 167 | // 168 | // Other ATmega644P, ATmega644, ATmega1284P 169 | // 170 | 171 | #define BOARD_GEN3_MONOLITHIC 1600 // Gen3 Monolithic Electronics 172 | #define BOARD_GEN3_PLUS 1601 // Gen3+ 173 | #define BOARD_GEN6 1602 // Gen6 174 | #define BOARD_GEN6_DELUXE 1603 // Gen6 deluxe 175 | #define BOARD_GEN7_CUSTOM 1604 // Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics" 176 | #define BOARD_GEN7_12 1605 // Gen7 v1.1, v1.2 177 | #define BOARD_GEN7_13 1606 // Gen7 v1.3 178 | #define BOARD_GEN7_14 1607 // Gen7 v1.4 179 | #define BOARD_OMCA_A 1608 // Alpha OMCA board 180 | #define BOARD_OMCA 1609 // Final OMCA board 181 | #define BOARD_SETHI 1610 // Sethi 3D_1 182 | 183 | // 184 | // Teensyduino - AT90USB1286, AT90USB1286P 185 | // 186 | 187 | #define BOARD_TEENSYLU 1700 // Teensylu 188 | #define BOARD_PRINTRBOARD 1701 // Printrboard (AT90USB1286) 189 | #define BOARD_PRINTRBOARD_REVF 1702 // Printrboard Revision F (AT90USB1286) 190 | #define BOARD_BRAINWAVE 1703 // Brainwave (AT90USB646) 191 | #define BOARD_BRAINWAVE_PRO 1704 // Brainwave Pro (AT90USB1286) 192 | #define BOARD_SAV_MKI 1705 // SAV Mk-I (AT90USB1286) 193 | #define BOARD_TEENSY2 1706 // Teensy++2.0 (AT90USB1286) 194 | #define BOARD_5DPRINT 1707 // 5DPrint D8 Driver Board 195 | 196 | // 197 | // LPC1768 ARM Cortex M3 198 | // 199 | 200 | #define BOARD_RAMPS_14_RE_ARM_EFB 2000 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend, Fan, Bed) 201 | #define BOARD_RAMPS_14_RE_ARM_EEB 2001 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Bed) 202 | #define BOARD_RAMPS_14_RE_ARM_EFF 2002 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend, Fan0, Fan1) 203 | #define BOARD_RAMPS_14_RE_ARM_EEF 2003 // Re-ARM with RAMPS 1.4 (Power outputs: Hotend0, Hotend1, Fan) 204 | #define BOARD_RAMPS_14_RE_ARM_SF 2004 // Re-ARM with RAMPS 1.4 (Power outputs: Spindle, Controller Fan) 205 | #define BOARD_MKS_SBASE 2005 // MKS-Sbase (Power outputs: Hotend0, Hotend1, Bed, Fan) 206 | #define BOARD_AZSMZ_MINI 2006 // AZSMZ Mini 207 | #define BOARD_BIQU_BQ111_A4 2007 // BIQU BQ111-A4 (Power outputs: Hotend, Fan, Bed) 208 | #define BOARD_SELENA_COMPACT 2008 // Selena Compact (Power outputs: Hotend0, Hotend1, Bed0, Bed1, Fan0, Fan1) 209 | #define BOARD_BIQU_B300_V1_0 2009 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver) 210 | #define BOARD_MKS_SGEN_L 2010 // MKS-SGen-L (Power outputs: Hotend0, Hotend1, Bed, Fan) 211 | #define BOARD_GMARSH_X6_REV1 2011 // GMARSH X6 board, revision 1 prototype 212 | #define BOARD_BIGTREE_SKR_V1_1 2012 // BigTreeTech SKR v1.1 (Power outputs: Hotend0, Hotend1, Fan, Bed) 213 | #define BOARD_BIGTREE_SKR_V1_3 2013 // BigTreeTech SKR v1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed) 214 | #define BOARD_BIGTREE_SKR_V1_4 2014 // BigTreeTech SKR v1.4 (Power outputs: Hotend0, Hotend1, Fan, Bed) 215 | 216 | // 217 | // LPC1769 ARM Cortex M3 218 | // 219 | 220 | #define BOARD_MKS_SGEN 2500 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan) 221 | #define BOARD_AZTEEG_X5_GT 2501 // Azteeg X5 GT (Power outputs: Hotend0, Hotend1, Bed, Fan) 222 | #define BOARD_AZTEEG_X5_MINI 2502 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan) 223 | #define BOARD_AZTEEG_X5_MINI_WIFI 2503 // Azteeg X5 Mini Wifi (Power outputs: Hotend0, Bed, Fan) 224 | #define BOARD_COHESION3D_REMIX 2504 // Cohesion3D ReMix 225 | #define BOARD_COHESION3D_MINI 2505 // Cohesion3D Mini 226 | #define BOARD_SMOOTHIEBOARD 2506 // Smoothieboard 227 | #define BOARD_TH3D_EZBOARD 2507 // TH3D EZBoard v1.0 228 | #define BOARD_BIGTREE_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO (Power outputs: Hotend0, Hotend1, Fan, Bed) 229 | 230 | // 231 | // SAM3X8E ARM Cortex M3 232 | // 233 | 234 | #define BOARD_DUE3DOM 3000 // DUE3DOM for Arduino DUE 235 | #define BOARD_DUE3DOM_MINI 3001 // DUE3DOM MINI for Arduino DUE 236 | #define BOARD_RADDS 3002 // RADDS 237 | #define BOARD_RAMPS_FD_V1 3003 // RAMPS-FD v1 238 | #define BOARD_RAMPS_FD_V2 3004 // RAMPS-FD v2 239 | #define BOARD_RAMPS_SMART_EFB 3005 // RAMPS-SMART (Power outputs: Hotend, Fan, Bed) 240 | #define BOARD_RAMPS_SMART_EEB 3006 // RAMPS-SMART (Power outputs: Hotend0, Hotend1, Bed) 241 | #define BOARD_RAMPS_SMART_EFF 3007 // RAMPS-SMART (Power outputs: Hotend, Fan0, Fan1) 242 | #define BOARD_RAMPS_SMART_EEF 3008 // RAMPS-SMART (Power outputs: Hotend0, Hotend1, Fan) 243 | #define BOARD_RAMPS_SMART_SF 3009 // RAMPS-SMART (Power outputs: Spindle, Controller Fan) 244 | #define BOARD_RAMPS_DUO_EFB 3010 // RAMPS Duo (Power outputs: Hotend, Fan, Bed) 245 | #define BOARD_RAMPS_DUO_EEB 3011 // RAMPS Duo (Power outputs: Hotend0, Hotend1, Bed) 246 | #define BOARD_RAMPS_DUO_EFF 3012 // RAMPS Duo (Power outputs: Hotend, Fan0, Fan1) 247 | #define BOARD_RAMPS_DUO_EEF 3013 // RAMPS Duo (Power outputs: Hotend0, Hotend1, Fan) 248 | #define BOARD_RAMPS_DUO_SF 3014 // RAMPS Duo (Power outputs: Spindle, Controller Fan) 249 | #define BOARD_RAMPS4DUE_EFB 3015 // RAMPS4DUE (Power outputs: Hotend, Fan, Bed) 250 | #define BOARD_RAMPS4DUE_EEB 3016 // RAMPS4DUE (Power outputs: Hotend0, Hotend1, Bed) 251 | #define BOARD_RAMPS4DUE_EFF 3017 // RAMPS4DUE (Power outputs: Hotend, Fan0, Fan1) 252 | #define BOARD_RAMPS4DUE_EEF 3018 // RAMPS4DUE (Power outputs: Hotend0, Hotend1, Fan) 253 | #define BOARD_RAMPS4DUE_SF 3019 // RAMPS4DUE (Power outputs: Spindle, Controller Fan) 254 | #define BOARD_RURAMPS4D_11 3020 // RuRAMPS4Duo v1.1 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed) 255 | #define BOARD_RURAMPS4D_13 3021 // RuRAMPS4Duo v1.3 (Power outputs: Hotend0, Hotend1, Hotend2, Fan0, Fan1, Bed) 256 | #define BOARD_ULTRATRONICS_PRO 3022 // ReprapWorld Ultratronics Pro V1.0 257 | #define BOARD_ARCHIM1 3023 // UltiMachine Archim1 (with DRV8825 drivers) 258 | #define BOARD_ARCHIM2 3024 // UltiMachine Archim2 (with TMC2130 drivers) 259 | #define BOARD_ALLIGATOR 3025 // Alligator Board R2 260 | 261 | // 262 | // SAM3X8C ARM Cortex M3 263 | // 264 | 265 | #define BOARD_PRINTRBOARD_G2 3100 // PRINTRBOARD G2 266 | #define BOARD_ADSK 3101 // Arduino DUE Shield Kit (ADSK) 267 | 268 | // 269 | // STM32 ARM Cortex-M3 270 | // 271 | 272 | #define BOARD_STM32F103RE 4000 // STM32F103RE Libmaple-based STM32F1 controller 273 | #define BOARD_MALYAN_M200 4001 // STM32C8T6 Libmaple-based STM32F1 controller 274 | #define BOARD_STM3R_MINI 4002 // STM32F103RE Libmaple-based STM32F1 controller 275 | #define BOARD_GTM32_PRO_VB 4003 // STM32F103VET6 controller 276 | #define BOARD_MORPHEUS 4004 // STM32F103C8 / STM32F103CB Libmaple-based STM32F1 controller 277 | #define BOARD_CHITU3D 4005 // Chitu3D (STM32F103RET6) 278 | #define BOARD_MKS_ROBIN 4006 // MKS Robin (STM32F103ZET6) 279 | #define BOARD_MKS_ROBIN_MINI 4007 // MKS Robin Mini (STM32F103VET6) 280 | #define BOARD_MKS_ROBIN_NANO 4008 // MKS Robin Nano (STM32F103VET6) 281 | #define BOARD_MKS_ROBIN_LITE 4009 // MKS Robin Lite/Lite2 (STM32F103RCT6) 282 | #define BOARD_MKS_ROBIN_LITE3 4010 // MKS Robin Lite3 (STM32F103RCT6) 283 | #define BOARD_MKS_ROBIN_PRO 4011 // MKS Robin Pro (STM32F103ZET6) 284 | #define BOARD_BIGTREE_SKR_MINI_V1_1 4012 // BigTreeTech SKR Mini v1.1 (STM32F103RC) 285 | #define BOARD_BTT_SKR_MINI_E3_V1_0 4013 // BigTreeTech SKR Mini E3 (STM32F103RC) 286 | #define BOARD_BTT_SKR_MINI_E3_V1_2 4014 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC) 287 | #define BOARD_BIGTREE_SKR_E3_DIP 4015 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE) 288 | #define BOARD_JGAURORA_A5S_A1 4016 // JGAurora A5S A1 (STM32F103ZET6) 289 | #define BOARD_FYSETC_AIO_II 4017 // FYSETC AIO_II 290 | #define BOARD_FYSETC_CHEETAH 4018 // FYSETC Cheetah 291 | #define BOARD_FYSETC_CHEETAH_V12 4019 // FYSETC Cheetah V1.2 292 | #define BOARD_LONGER3D_LK 4020 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6 293 | #define BOARD_GTM32_MINI 4021 // STM32F103VET6 controller 294 | #define BOARD_GTM32_MINI_A30 4022 // STM32F103VET6 controller 295 | #define BOARD_GTM32_REV_B 4023 // STM32F103VET6 controller 296 | 297 | 298 | // 299 | // ARM Cortex-M4F 300 | // 301 | 302 | #define BOARD_TEENSY31_32 4100 // Teensy3.1 and Teensy3.2 303 | #define BOARD_TEENSY35_36 4101 // Teensy3.5 and Teensy3.6 304 | 305 | // 306 | // STM32 ARM Cortex-M4F 307 | // 308 | 309 | #define BOARD_BEAST 4200 // STM32F4xxVxT6 Libmaple-based STM32F4 controller 310 | #define BOARD_GENERIC_STM32F4 4201 // STM32 STM32GENERIC-based STM32F4 controller 311 | #define BOARD_ARMED 4202 // Arm'ed STM32F4-based controller 312 | #define BOARD_RUMBA32 4203 // RUMBA32 STM32F4-based controller 313 | #define BOARD_BLACK_STM32F407VE 4204 // BLACK_STM32F407VE 314 | #define BOARD_BLACK_STM32F407ZE 4205 // BLACK_STM32F407ZE 315 | #define BOARD_STEVAL_3DP001V1 4206 // STEVAL-3DP001V1 3D PRINTER BOARD 316 | #define BOARD_BIGTREE_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZG) 317 | #define BOARD_BIGTREE_BTT002_V1_0 4208 // BigTreeTech BTT002 v1.0 (STM32F407VE) 318 | #define BOARD_LERDGE_K 4209 // Lerdge K (STM32F407ZG) 319 | #define BOARD_LERDGE_X 4210 // Lerdge X (STM32F407VE) 320 | #define BOARD_VAKE403D 4211 // VAkE 403D (STM32F446VET6) 321 | #define BOARD_FYSETC_S6 4212 // FYSETC S6 board 322 | #define BOARD_FLYF407ZG 4213 // FLYF407ZG board (STM32F407ZG) 323 | #define BOARD_MKS_ROBIN2 4214 // MKS_ROBIN2 (STM32F407ZE) 324 | 325 | // 326 | // ARM Cortex M7 327 | // 328 | 329 | #define BOARD_THE_BORG 5000 // THE-BORG (Power outputs: Hotend0, Hotend1, Bed, Fan) 330 | #define BOARD_REMRAM_V1 5001 // RemRam v1 331 | 332 | // 333 | // Espressif ESP32 WiFi 334 | // 335 | #define BOARD_ESPRESSIF_ESP32 6000 336 | #define BOARD_MRR_ESPA 6001 337 | #define BOARD_MRR_ESPE 6002 338 | 339 | // 340 | // Simulations 341 | // 342 | 343 | #define BOARD_LINUX_RAMPS 9999 344 | 345 | #define _MB_1(B) (defined(BOARD_##B) && MOTHERBOARD==BOARD_##B) 346 | #define MB(V...) DO(MB,||,V) 347 | 348 | #define IS_MELZI MB(MELZI, MELZI_CREALITY, MELZI_MAKR3D, MELZI_MALYAN, MELZI_TRONXY) 349 | -------------------------------------------------------------------------------- /src/marlin/2.0.x-longmill/platformio.ini: -------------------------------------------------------------------------------- 1 | # 2 | # Marlin Firmware 3 | # PlatformIO Configuration File 4 | # 5 | # For detailed documentation with EXAMPLES: 6 | # 7 | # http://docs.platformio.org/en/latest/projectconf.html 8 | # 9 | 10 | # Automatic targets - enable auto-uploading 11 | # targets = upload 12 | 13 | # 14 | # By default platformio build will abort after 5 errors. 15 | # Remove '-fmax-errors=5' from build_flags below to see all. 16 | # 17 | 18 | [platformio] 19 | src_dir = Marlin 20 | boards_dir = buildroot/share/PlatformIO/boards 21 | default_envs = megaatmega2560 22 | 23 | [common] 24 | default_src_filter = + - - + 25 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py 26 | build_flags = -fmax-errors=5 -g -D__MARLIN_FIRMWARE__ -fmerge-all-constants 27 | lib_deps = 28 | U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip 29 | LiquidCrystal@1.3.4 30 | TMCStepper@>=0.5.2,<1.0.0 31 | Adafruit NeoPixel@1.2.5 32 | Adafruit_MAX31865=https://github.com/adafruit/Adafruit_MAX31865/archive/master.zip 33 | LiquidTWI2=https://github.com/lincomatic/LiquidTWI2/archive/master.zip 34 | Arduino-L6470=https://github.com/ameyer/Arduino-L6470/archive/dev.zip 35 | SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip 36 | SailfishRGB_LED=https://github.com/mikeshub/SailfishRGB_LED/archive/master.zip 37 | SlowSoftI2CMaster=https://github.com/mikeshub/SlowSoftI2CMaster/archive/master.zip 38 | 39 | # Globally defined properties 40 | # inherited by all environments 41 | [env] 42 | framework = arduino 43 | build_flags = ${common.build_flags} 44 | lib_deps = ${common.lib_deps} 45 | 46 | ################################# 47 | # # 48 | # Unique Core Architectures # 49 | # # 50 | # Add a new "env" below if no # 51 | # entry has values suitable to # 52 | # build for a given board. # 53 | # # 54 | ################################# 55 | 56 | # 57 | # ATmega2560 58 | # 59 | [env:megaatmega2560] 60 | platform = atmelavr 61 | board = megaatmega2560 62 | board_build.f_cpu = 16000000L 63 | lib_deps = ${common.lib_deps} 64 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 65 | src_filter = ${common.default_src_filter} + 66 | monitor_speed = 250000 67 | 68 | # 69 | # ATmega1280 70 | # 71 | [env:megaatmega1280] 72 | platform = atmelavr 73 | board = megaatmega1280 74 | board_build.f_cpu = 16000000L 75 | lib_deps = ${common.lib_deps} 76 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 77 | src_filter = ${common.default_src_filter} + 78 | monitor_speed = 250000 79 | 80 | # 81 | # RAMBo 82 | # 83 | [env:rambo] 84 | platform = atmelavr 85 | board = reprap_rambo 86 | board_build.f_cpu = 16000000L 87 | lib_deps = ${common.lib_deps} 88 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 89 | src_filter = ${common.default_src_filter} + 90 | monitor_speed = 250000 91 | 92 | # 93 | # FYSETC F6 V1.3 94 | # 95 | [env:FYSETC_F6_13] 96 | platform = atmelavr 97 | board = fysetc_f6_13 98 | board_build.f_cpu = 16000000L 99 | lib_deps = ${common.lib_deps} 100 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 101 | src_filter = ${common.default_src_filter} + 102 | monitor_speed = 250000 103 | 104 | # 105 | # Sanguinololu (ATmega644p) 106 | # 107 | [env:sanguino_atmega644p] 108 | platform = atmelavr 109 | board = sanguino_atmega644p 110 | lib_deps = ${common.lib_deps} 111 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 112 | src_filter = ${common.default_src_filter} + 113 | monitor_speed = 250000 114 | 115 | # 116 | # Sanguinololu (ATmega1284p) 117 | # 118 | [env:sanguino_atmega1284p] 119 | platform = atmelavr 120 | board = sanguino_atmega1284p 121 | lib_deps = ${common.lib_deps} 122 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 123 | src_filter = ${common.default_src_filter} + 124 | monitor_speed = 250000 125 | 126 | # 127 | # Melzi and clones (ATmega1284p) 128 | # 129 | [env:melzi] 130 | platform = atmelavr 131 | board = sanguino_atmega1284p 132 | lib_deps = ${common.lib_deps} 133 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 134 | src_filter = ${common.default_src_filter} + 135 | monitor_speed = 250000 136 | build_flags = ${common.build_flags} 137 | lib_ignore = TMCStepper 138 | upload_speed = 57600 139 | 140 | # 141 | # Melzi and clones (Optiboot bootloader) 142 | # 143 | [env:melzi_optiboot] 144 | platform = atmelavr 145 | board = sanguino_atmega1284p 146 | lib_deps = ${common.lib_deps} 147 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 148 | src_filter = ${common.default_src_filter} + 149 | monitor_speed = 250000 150 | build_flags = ${common.build_flags} 151 | lib_ignore = TMCStepper 152 | upload_speed = 115200 153 | 154 | # 155 | # AT90USB1286 boards using CDC bootloader 156 | # - BRAINWAVE 157 | # - BRAINWAVE_PRO 158 | # - SAV_MKI 159 | # - TEENSYLU 160 | # 161 | [env:at90usb1286_cdc] 162 | platform = teensy 163 | board = at90usb1286 164 | lib_deps = ${common.lib_deps} 165 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 166 | src_filter = ${common.default_src_filter} + 167 | monitor_speed = 250000 168 | 169 | # 170 | # AT90USB1286 boards using DFU bootloader 171 | # - PrintrBoard 172 | # - PrintrBoard Rev.F 173 | # - ? 5DPRINT ? 174 | # 175 | [env:at90usb1286_dfu] 176 | platform = teensy 177 | board = at90usb1286 178 | lib_deps = ${common.lib_deps} 179 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 180 | src_filter = ${common.default_src_filter} + 181 | monitor_speed = 250000 182 | 183 | # 184 | # Due (Atmel SAM3X8E ARM Cortex-M3) 185 | # 186 | # - RAMPS4DUE 187 | # - RADDS 188 | # 189 | [env:DUE] 190 | platform = atmelsam 191 | board = due 192 | src_filter = ${common.default_src_filter} + 193 | monitor_speed = 250000 194 | 195 | [env:DUE_USB] 196 | platform = atmelsam 197 | board = dueUSB 198 | src_filter = ${common.default_src_filter} + 199 | monitor_speed = 250000 200 | 201 | [env:DUE_debug] 202 | # Used when WATCHDOG_RESET_MANUAL is enabled 203 | platform = atmelsam 204 | board = due 205 | src_filter = ${common.default_src_filter} + 206 | monitor_speed = 250000 207 | build_flags = ${common.build_flags} 208 | -funwind-tables 209 | -mpoke-function-name 210 | 211 | # 212 | # NXP LPC176x ARM Cortex-M3 213 | # 214 | [env:LPC1768] 215 | platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.2.zip 216 | board = nxp_lpc1768 217 | build_flags = -DU8G_HAL_LINKS -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags} 218 | # debug options for backtrace 219 | # -funwind-tables 220 | # -mpoke-function-name 221 | lib_ldf_mode = off 222 | lib_compat_mode = strict 223 | extra_scripts = Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py 224 | src_filter = ${common.default_src_filter} + 225 | monitor_speed = 250000 226 | lib_deps = Servo 227 | LiquidCrystal 228 | U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip 229 | TMCStepper@>=0.6.1,<1.0.0 230 | Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/release.zip 231 | SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip 232 | 233 | [env:LPC1769] 234 | platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.2.zip 235 | board = nxp_lpc1769 236 | build_flags = -DU8G_HAL_LINKS -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags} 237 | # debug options for backtrace 238 | # -funwind-tables 239 | # -mpoke-function-name 240 | lib_ldf_mode = off 241 | lib_compat_mode = strict 242 | extra_scripts = Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py 243 | src_filter = ${common.default_src_filter} + 244 | monitor_speed = 250000 245 | lib_deps = Servo 246 | LiquidCrystal 247 | U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip 248 | TMCStepper@>=0.6.1,<1.0.0 249 | Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/release.zip 250 | SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip 251 | 252 | # 253 | # STM32F103RC 254 | # 255 | [env:STM32F103RC] 256 | platform = ststm32 257 | board = genericSTM32F103RC 258 | platform_packages = tool-stm32duino 259 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 260 | ${common.build_flags} -std=gnu++14 261 | build_unflags = -std=gnu++11 262 | src_filter = ${common.default_src_filter} + 263 | lib_deps = ${common.lib_deps} 264 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 265 | lib_ignore = Adafruit NeoPixel, SPI 266 | monitor_speed = 115200 267 | 268 | # 269 | # STM32F103RC_fysetc 270 | # 271 | [env:STM32F103RC_fysetc] 272 | platform = ststm32 273 | board = genericSTM32F103RC 274 | #board_build.core = maple 275 | platform_packages = tool-stm32duino 276 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 277 | ${common.build_flags} -std=gnu++14 -DDEBUG_LEVEL=0 -DHAVE_SW_SERIAL 278 | build_unflags = -std=gnu++11 279 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py 280 | src_filter = ${common.default_src_filter} + 281 | lib_deps = ${common.lib_deps} 282 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 283 | lib_ignore = Adafruit NeoPixel, SPI 284 | lib_ldf_mode = chain 285 | debug_tool = stlink 286 | upload_protocol = serial 287 | monitor_speed = 250000 288 | 289 | # 290 | # BigTree SKR Mini V1.1 / SKR mini E3 / SKR E3 DIP (STM32F103RCT6 ARM Cortex-M3) 291 | # 292 | # STM32F103RC_bigtree ............. RCT6 with 256K 293 | # STM32F103RC_bigtree_USB ......... RCT6 with 256K (USB mass storage) 294 | # STM32F103RC_bigtree_512K ........ RCT6 with 512K 295 | # STM32F103RC_bigtree_512K_USB .... RCT6 with 512K (USB mass storage) 296 | # 297 | 298 | [env:STM32F103RC_bigtree] 299 | platform = ststm32 300 | board = genericSTM32F103RC 301 | platform_packages = tool-stm32duino 302 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 303 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 304 | build_unflags = -std=gnu++11 305 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py 306 | src_filter = ${common.default_src_filter} + 307 | lib_deps = ${common.lib_deps} 308 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 309 | lib_ignore = Adafruit NeoPixel, SPI 310 | monitor_speed = 115200 311 | 312 | [env:STM32F103RC_bigtree_USB] 313 | platform = ststm32 314 | board = genericSTM32F103RC 315 | platform_packages = tool-stm32duino 316 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 317 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 -DUSE_USB_COMPOSITE 318 | build_unflags = -std=gnu++11 319 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py 320 | src_filter = ${common.default_src_filter} + 321 | lib_deps = ${common.lib_deps} 322 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 323 | lib_ignore = Adafruit NeoPixel, SPI 324 | monitor_speed = 115200 325 | 326 | [env:STM32F103RC_bigtree_512K] 327 | platform = ststm32 328 | board = genericSTM32F103RC 329 | board_upload.maximum_size=524288 330 | platform_packages = tool-stm32duino 331 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 332 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 -DSTM32_FLASH_SIZE=512 333 | build_unflags = -std=gnu++11 334 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py 335 | src_filter = ${common.default_src_filter} + 336 | lib_deps = ${common.lib_deps} 337 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 338 | lib_ignore = Adafruit NeoPixel, SPI 339 | monitor_speed = 115200 340 | 341 | [env:STM32F103RC_bigtree_512K_USB] 342 | platform = ststm32 343 | board = genericSTM32F103RC 344 | board_upload.maximum_size=524288 345 | platform_packages = tool-stm32duino 346 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 347 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 -DSTM32_FLASH_SIZE=512 -DUSE_USB_COMPOSITE 348 | build_unflags = -std=gnu++11 349 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py 350 | src_filter = ${common.default_src_filter} + 351 | lib_deps = ${common.lib_deps} 352 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 353 | lib_ignore = Adafruit NeoPixel, SPI 354 | monitor_speed = 115200 355 | 356 | # 357 | # STM32F103RE 358 | # 359 | [env:STM32F103RE] 360 | platform = ststm32 361 | board = genericSTM32F103RE 362 | platform_packages = tool-stm32duino 363 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 364 | ${common.build_flags} -std=gnu++14 365 | build_unflags = -std=gnu++11 366 | src_filter = ${common.default_src_filter} + 367 | lib_deps = ${common.lib_deps} 368 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 369 | lib_ignore = Adafruit NeoPixel, SPI 370 | monitor_speed = 115200 371 | 372 | # 373 | # STM32F103RE_bigtree ............. RET6 374 | # STM32F103RE_bigtree_USB ......... RET6 (USB mass storage) 375 | # 376 | [env:STM32F103RE_bigtree] 377 | platform = ststm32 378 | board = genericSTM32F103RE 379 | platform_packages = tool-stm32duino 380 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 381 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 382 | build_unflags = -std=gnu++11 383 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py 384 | src_filter = ${common.default_src_filter} + 385 | lib_deps = ${common.lib_deps} 386 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 387 | lib_ignore = Adafruit NeoPixel, SPI 388 | debug_tool = stlink 389 | upload_protocol = stlink 390 | monitor_speed = 115200 391 | 392 | [env:STM32F103RE_bigtree_USB] 393 | platform = ststm32 394 | board = genericSTM32F103RE 395 | platform_packages = tool-stm32duino 396 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 397 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 -DUSE_USB_COMPOSITE 398 | build_unflags = -std=gnu++11 399 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py 400 | src_filter = ${common.default_src_filter} + 401 | lib_deps = ${common.lib_deps} 402 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 403 | lib_ignore = Adafruit NeoPixel, SPI 404 | debug_tool = stlink 405 | upload_protocol = stlink 406 | monitor_speed = 115200 407 | 408 | # 409 | # STM32F4 with STM32GENERIC 410 | # 411 | [env:STM32F4] 412 | platform = ststm32 413 | board = disco_f407vg 414 | build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F4 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED 415 | lib_ignore = Adafruit NeoPixel, TMCStepper 416 | src_filter = ${common.default_src_filter} + - 417 | monitor_speed = 250000 418 | 419 | # 420 | # STM32F7 with STM32GENERIC 421 | # 422 | [env:STM32F7] 423 | platform = ststm32 424 | board = remram_v1 425 | build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F7 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED 426 | lib_ignore = Adafruit NeoPixel, TMCStepper 427 | src_filter = ${common.default_src_filter} + - 428 | monitor_speed = 250000 429 | 430 | # 431 | # ARMED (STM32) 432 | # 433 | [env:ARMED] 434 | platform = ststm32 435 | board = armed_v1 436 | build_flags = ${common.build_flags} 437 | -DUSBCON -DUSBD_VID=0x0483 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="ARMED_V1"' -DUSBD_USE_CDC 438 | -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing -std=gnu11 -std=gnu++11 439 | -IMarlin/src/HAL/HAL_STM32 440 | lib_ignore = Adafruit NeoPixel, SoftwareSerial 441 | src_filter = ${common.default_src_filter} + 442 | monitor_speed = 250000 443 | 444 | # 445 | # Longer 3D board in Alfawise U20 (STM32F103VET6) 446 | # 447 | [env:STM32F103VE_longer] 448 | platform = ststm32 449 | board = genericSTM32F103VE 450 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 451 | ${common.build_flags} -std=gnu++14 -USERIAL_USB 452 | -DSTM32F1xx -DU20 -DTS_V12 453 | build_unflags = -std=gnu++11 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 454 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py 455 | src_filter = ${common.default_src_filter} + 456 | lib_ignore = Adafruit NeoPixel, LiquidTWI2, SPI 457 | monitor_speed = 250000 458 | 459 | # 460 | # MKS Robin (STM32F103ZET6) 461 | # 462 | [env:mks_robin] 463 | platform = ststm32 464 | board = genericSTM32F103ZE 465 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 466 | ${common.build_flags} -std=gnu++14 -DSTM32_XL_DENSITY 467 | build_unflags = -std=gnu++11 468 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin.py 469 | src_filter = ${common.default_src_filter} + 470 | lib_ignore = Adafruit NeoPixel, SPI 471 | monitor_speed = 250000 472 | 473 | 474 | # 475 | # MKS Robin Pro (STM32F103ZET6) 476 | # 477 | [env:mks_robin_pro] 478 | platform = ststm32 479 | board = genericSTM32F103ZE 480 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_pro.py 481 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 482 | ${common.build_flags} -std=gnu++14 -DSTM32_XL_DENSITY 483 | build_unflags = -std=gnu++11 484 | src_filter = ${common.default_src_filter} + 485 | lib_deps = ${common.lib_deps} 486 | lib_ignore = Adafruit NeoPixel, SPI, TMCStepper 487 | 488 | # 489 | # MKS Robin Lite/Lite2 (STM32F103RCT6) 490 | # 491 | [env:mks_robin_lite] 492 | platform = ststm32 493 | board = genericSTM32F103RC 494 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 495 | ${common.build_flags} -std=gnu++14 496 | build_unflags = -std=gnu++11 497 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_lite.py 498 | src_filter = ${common.default_src_filter} + 499 | lib_ignore = Adafruit NeoPixel, SPI 500 | monitor_speed = 250000 501 | 502 | # 503 | # MKS ROBIN LITE3 (STM32F103RCT6) 504 | # 505 | [env:mks_robin_lite3] 506 | platform = ststm32 507 | board = genericSTM32F103RC 508 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_lite3.py 509 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 510 | ${common.build_flags} -std=gnu++14 511 | build_unflags = -std=gnu++11 512 | src_filter = ${common.default_src_filter} + 513 | lib_deps = ${common.lib_deps} 514 | lib_ignore = Adafruit NeoPixel, SPI 515 | 516 | 517 | # 518 | # MKS Robin Mini (STM32F103VET6) 519 | # 520 | [env:mks_robin_mini] 521 | platform = ststm32 522 | board = genericSTM32F103VE 523 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 524 | ${common.build_flags} -std=gnu++14 525 | build_unflags = -std=gnu++11 526 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_mini.py 527 | src_filter = ${common.default_src_filter} + 528 | lib_ignore = Adafruit NeoPixel, SPI 529 | monitor_speed = 250000 530 | 531 | # 532 | # MKS Robin Nano (STM32F103VET6) 533 | # 534 | [env:mks_robin_nano] 535 | platform = ststm32 536 | board = genericSTM32F103VE 537 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 538 | ${common.build_flags} -std=gnu++14 539 | build_unflags = -std=gnu++11 540 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano.py 541 | src_filter = ${common.default_src_filter} + 542 | lib_ignore = Adafruit NeoPixel, SPI 543 | monitor_speed = 250000 544 | 545 | # 546 | # JGAurora A5S A1 (STM32F103ZET6) 547 | # 548 | [env:jgaurora_a5s_a1] 549 | platform = ststm32 550 | board = genericSTM32F103ZE 551 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 552 | ${common.build_flags} -DSTM32F1xx -std=gnu++14 -DSTM32_XL_DENSITY 553 | build_unflags = -std=gnu++11 554 | extra_scripts = buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py 555 | src_filter = ${common.default_src_filter} + 556 | lib_ignore = Adafruit NeoPixel, SPI 557 | monitor_speed = 250000 558 | 559 | # 560 | # Malyan M200 (STM32F103CB) 561 | # 562 | [env:STM32F103CB_malyan] 563 | platform = ststm32 564 | board = malyanM200 565 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py -DMCU_STM32F103CB -D __STM32F1__=1 -std=c++1y -D MOTHERBOARD="BOARD_MALYAN_M200" -DSERIAL_USB -ffunction-sections -fdata-sections -Wl,--gc-sections 566 | -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__ 567 | src_filter = ${common.default_src_filter} + 568 | lib_ignore = Adafruit NeoPixel, LiquidCrystal, LiquidTWI2, TMCStepper, U8glib-HAL, SPI 569 | 570 | # 571 | # Chitu boards like Tronxy X5s (STM32F103ZET6) 572 | # 573 | [env:chitu_f103] 574 | platform = ststm32 575 | board = genericSTM32F103ZE 576 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 577 | ${common.build_flags} -DSTM32F1xx -std=gnu++14 -DSTM32_XL_DENSITY 578 | build_unflags = -std=gnu++11 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG= -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 579 | extra_scripts = buildroot/share/PlatformIO/scripts/chitu_crypt.py 580 | src_filter = ${common.default_src_filter} + 581 | lib_ignore = Adafruit NeoPixel 582 | monitor_speed = 250000 583 | 584 | 585 | # 586 | # FLYF407ZG 587 | # 588 | [env:FLYF407ZG] 589 | platform = ststm32 590 | board = FLYF407ZG 591 | platform_packages = framework-arduinoststm32@>=3.10700.191028 592 | build_flags = ${common.build_flags} 593 | -DSTM32F4 -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407ZG\" 594 | -DTARGET_STM32F4 -DVECT_TAB_OFFSET=0x8000 595 | -IMarlin/src/HAL/HAL_STM32 596 | build_unflags = -std=gnu++11 597 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py 598 | lib_ignore = Adafruit NeoPixel, TMCStepper, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster, SoftwareSerial 599 | src_filter = ${common.default_src_filter} + 600 | monitor_speed = 250000 601 | 602 | 603 | # 604 | # FYSETC S6 (STM32F446VET6 ARM Cortex-M4) 605 | # 606 | [env:FYSETC_S6] 607 | platform = ststm32 608 | board = fysetc_s6 609 | platform_packages = tool-stm32duino 610 | build_flags = ${common.build_flags} 611 | -DTARGET_STM32F4 -std=gnu++14 612 | -DVECT_TAB_OFFSET=0x10000 613 | -DUSBCON -DUSBD_USE_CDC -DHAL_PCD_MODULE_ENABLED -DUSBD_VID=0x0483 '-DUSB_PRODUCT="FYSETC_S6"' 614 | build_unflags = -std=gnu++11 615 | extra_scripts = buildroot/share/PlatformIO/scripts/fysetc_STM32S6.py 616 | src_filter = ${common.default_src_filter} + 617 | lib_ignore = Arduino-L6470 618 | debug_tool = stlink 619 | #upload_protocol = stlink 620 | upload_protocol = serial 621 | monitor_speed = 250000 622 | 623 | # 624 | # STM32F407VET6 with RAMPS-like shield 625 | # 'Black' STM32F407VET6 board - http://wiki.stm32duino.com/index.php?title=STM32F407 626 | # Shield - https://github.com/jmz52/Hardware 627 | # 628 | [env:STM32F407VE_black] 629 | platform = ststm32 630 | board = blackSTM32F407VET6 631 | platform_packages = framework-arduinoststm32@>=3.10700.191028 632 | build_flags = ${common.build_flags} 633 | -DTARGET_STM32F4 -DARDUINO_BLACK_F407VE 634 | -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"BLACK_F407VE\" 635 | -IMarlin/src/HAL/HAL_STM32 636 | build_unflags = -std=gnu++11 637 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py 638 | lib_ignore = Adafruit NeoPixel, TMCStepper, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster, SoftwareSerial 639 | src_filter = ${common.default_src_filter} + 640 | monitor_speed = 250000 641 | 642 | # 643 | # BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4) 644 | # 645 | [env:BIGTREE_SKR_PRO] 646 | platform = ststm32 647 | board = BigTree_SKR_Pro 648 | platform_packages = framework-arduinoststm32@>=3.10700.191028 649 | build_flags = ${common.build_flags} 650 | -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407ZG\" 651 | -DTARGET_STM32F4 -DSTM32F407_5ZX -DVECT_TAB_OFFSET=0x8000 652 | -DHAVE_HWSERIAL6 653 | -IMarlin/src/HAL/HAL_STM32 654 | build_unflags = -std=gnu++11 655 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py 656 | lib_deps = 657 | U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip 658 | LiquidCrystal 659 | TMCStepper@>=0.5.2,<1.0.0 660 | Adafruit NeoPixel 661 | LiquidTWI2=https://github.com/lincomatic/LiquidTWI2/archive/master.zip 662 | Arduino-L6470=https://github.com/ameyer/Arduino-L6470/archive/dev.zip 663 | lib_ignore = SoftwareSerial, SoftwareSerialM 664 | src_filter = ${common.default_src_filter} + 665 | monitor_speed = 250000 666 | 667 | # 668 | # BigTreeTech BTT002 (STM32F407VET6 ARM Cortex-M4) 669 | # 670 | [env:BIGTREE_BTT002] 671 | platform = ststm32@5.6.0 672 | board = BigTree_Btt002 673 | platform_packages = framework-arduinoststm32@>=3.10700.191028 674 | build_flags = ${common.build_flags} 675 | -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407VE\" 676 | -DTARGET_STM32F4 -DSTM32F407_5VX -DVECT_TAB_OFFSET=0x8000 677 | -DHAVE_HWSERIAL2 678 | -DHAVE_HWSERIAL3 679 | -DPIN_SERIAL2_RX=PD_6 680 | -DPIN_SERIAL2_TX=PD_5 681 | build_unflags = -std=gnu++11 682 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py 683 | lib_ignore = Adafruit NeoPixel, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster 684 | src_filter = ${common.default_src_filter} + 685 | monitor_speed = 250000 686 | 687 | # 688 | # Teensy 3.1 / 3.2 (ARM Cortex-M4) 689 | # 690 | [env:teensy31] 691 | platform = teensy 692 | board = teensy31 693 | lib_deps = ${common.lib_deps} 694 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 695 | lib_ignore = Adafruit NeoPixel 696 | src_filter = ${common.default_src_filter} + 697 | monitor_speed = 250000 698 | 699 | # 700 | # Teensy 3.5 / 3.6 (ARM Cortex-M4) 701 | # 702 | [env:teensy35] 703 | platform = teensy 704 | board = teensy35 705 | lib_deps = ${common.lib_deps} 706 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 707 | lib_ignore = Adafruit NeoPixel 708 | src_filter = ${common.default_src_filter} + 709 | monitor_speed = 250000 710 | 711 | # 712 | # Espressif ESP32 713 | # 714 | [env:esp32] 715 | platform = espressif32 716 | board = esp32dev 717 | build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0 718 | lib_deps = ${common.lib_deps} 719 | AsyncTCP=https://github.com/me-no-dev/AsyncTCP/archive/master.zip 720 | ESPAsyncWebServer=https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip 721 | lib_ignore = LiquidCrystal, LiquidTWI2, SailfishLCD, SailfishRGB_LED 722 | src_filter = ${common.default_src_filter} + 723 | upload_speed = 115200 724 | monitor_speed = 250000 725 | #upload_port = marlinesp.local 726 | #board_build.flash_mode = qio 727 | 728 | # 729 | # Native 730 | # No supported Arduino libraries, base Marlin only 731 | # 732 | [env:linux_native] 733 | platform = native 734 | framework = 735 | build_flags = -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined 736 | src_build_flags = -Wall -IMarlin/src/HAL/HAL_LINUX/include 737 | build_unflags = -Wall 738 | lib_ldf_mode = off 739 | lib_deps = 740 | extra_scripts = 741 | src_filter = ${common.default_src_filter} + 742 | 743 | # 744 | # Adafruit Grand Central M4 (Atmel SAMD51P20A ARM Cortex-M4) 745 | # 746 | [env:SAMD51_grandcentral_m4] 747 | platform = atmelsam 748 | board = adafruit_grandcentral_m4 749 | build_flags = ${common.build_flags} -std=gnu++17 750 | extra_scripts = ${common.extra_scripts} 751 | build_unflags = -std=gnu++11 752 | src_filter = ${common.default_src_filter} + 753 | debug_tool = jlink 754 | 755 | # 756 | # RUMBA32 757 | # 758 | [env:rumba32_f446ve] 759 | platform = ststm32 760 | board = rumba32_f446ve 761 | build_flags = ${common.build_flags} 762 | -DSTM32F4xx 763 | -DARDUINO_RUMBA32_F446VE 764 | -DARDUINO_ARCH_STM32 765 | "-DBOARD_NAME=\"RUMBA32_F446VE\"" 766 | -DSTM32F446xx 767 | -DUSBCON 768 | -DUSBD_VID=0x0483 769 | "-DUSB_MANUFACTURER=\"Unknown\"" 770 | "-DUSB_PRODUCT=\"RUMBA32_F446VE\"" 771 | -DHAL_PCD_MODULE_ENABLED 772 | -DUSBD_USE_CDC 773 | -DDISABLE_GENERIC_SERIALUSB 774 | -DHAL_UART_MODULE_ENABLED 775 | -Os 776 | lib_ignore = Adafruit NeoPixel 777 | src_filter = ${common.default_src_filter} + 778 | monitor_speed = 500000 779 | upload_protocol = dfu 780 | 781 | # 782 | # MKS RUMBA32(add TMC2208/2209 UART interface and AUX-1) 783 | # 784 | [env:mks_rumba32] 785 | platform = ststm32 786 | board = rumba32_f446ve 787 | build_flags = ${common.build_flags} 788 | -DSTM32F4xx -DARDUINO_RUMBA32_F446VE -DARDUINO_ARCH_STM32 "-DBOARD_NAME=\"RUMBA32_F446VE\"" 789 | -DSTM32F446xx -DUSBCON -DUSBD_VID=0x8000 790 | "-DUSB_MANUFACTURER=\"Unknown\"" 791 | "-DUSB_PRODUCT=\"RUMBA32_F446VE\"" 792 | -DHAL_PCD_MODULE_ENABLED 793 | -DUSBD_USE_CDC 794 | -DDISABLE_GENERIC_SERIALUSB 795 | -DHAL_UART_MODULE_ENABLED 796 | -Os 797 | lib_ignore = Adafruit NeoPixel 798 | src_filter = ${common.default_src_filter} + + - 799 | monitor_speed = 250000 800 | upload_protocol = dfu 801 | 802 | # 803 | # Just print the dependency tree 804 | # 805 | [env:include_tree] 806 | platform = atmelavr 807 | board = megaatmega2560 808 | build_flags = -c -H -std=gnu++11 -Wall -Os -D__MARLIN_FIRMWARE__ 809 | lib_deps = ${common.lib_deps} 810 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 811 | src_filter = + 812 | -------------------------------------------------------------------------------- /src/marlin/2.0.x/platformio.ini: -------------------------------------------------------------------------------- 1 | # 2 | # Marlin Firmware 3 | # PlatformIO Configuration File 4 | # 5 | # For detailed documentation with EXAMPLES: 6 | # 7 | # http://docs.platformio.org/en/latest/projectconf.html 8 | # 9 | 10 | # Automatic targets - enable auto-uploading 11 | # targets = upload 12 | 13 | # 14 | # By default platformio build will abort after 5 errors. 15 | # Remove '-fmax-errors=5' from build_flags below to see all. 16 | # 17 | 18 | [platformio] 19 | src_dir = Marlin 20 | boards_dir = buildroot/share/PlatformIO/boards 21 | default_envs = LPC1768 22 | 23 | [common] 24 | default_src_filter = + - - + 25 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py 26 | build_flags = -fmax-errors=5 -g -D__MARLIN_FIRMWARE__ -fmerge-all-constants 27 | lib_deps = 28 | U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip 29 | LiquidCrystal@1.3.4 30 | TMCStepper@>=0.5.2,<1.0.0 31 | Adafruit NeoPixel@1.2.5 32 | Adafruit_MAX31865=https://github.com/adafruit/Adafruit_MAX31865/archive/master.zip 33 | LiquidTWI2=https://github.com/lincomatic/LiquidTWI2/archive/master.zip 34 | Arduino-L6470=https://github.com/ameyer/Arduino-L6470/archive/dev.zip 35 | SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip 36 | SailfishRGB_LED=https://github.com/mikeshub/SailfishRGB_LED/archive/master.zip 37 | SlowSoftI2CMaster=https://github.com/mikeshub/SlowSoftI2CMaster/archive/master.zip 38 | 39 | # Globally defined properties 40 | # inherited by all environments 41 | [env] 42 | framework = arduino 43 | build_flags = ${common.build_flags} 44 | lib_deps = ${common.lib_deps} 45 | 46 | ################################# 47 | # # 48 | # Unique Core Architectures # 49 | # # 50 | # Add a new "env" below if no # 51 | # entry has values suitable to # 52 | # build for a given board. # 53 | # # 54 | ################################# 55 | 56 | # 57 | # ATmega2560 58 | # 59 | [env:megaatmega2560] 60 | platform = atmelavr 61 | board = megaatmega2560 62 | board_build.f_cpu = 16000000L 63 | lib_deps = ${common.lib_deps} 64 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 65 | src_filter = ${common.default_src_filter} + 66 | monitor_speed = 250000 67 | 68 | # 69 | # ATmega1280 70 | # 71 | [env:megaatmega1280] 72 | platform = atmelavr 73 | board = megaatmega1280 74 | board_build.f_cpu = 16000000L 75 | lib_deps = ${common.lib_deps} 76 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 77 | src_filter = ${common.default_src_filter} + 78 | monitor_speed = 250000 79 | 80 | # 81 | # RAMBo 82 | # 83 | [env:rambo] 84 | platform = atmelavr 85 | board = reprap_rambo 86 | board_build.f_cpu = 16000000L 87 | lib_deps = ${common.lib_deps} 88 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 89 | src_filter = ${common.default_src_filter} + 90 | monitor_speed = 250000 91 | 92 | # 93 | # FYSETC F6 V1.3 94 | # 95 | [env:FYSETC_F6_13] 96 | platform = atmelavr 97 | board = fysetc_f6_13 98 | board_build.f_cpu = 16000000L 99 | lib_deps = ${common.lib_deps} 100 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 101 | src_filter = ${common.default_src_filter} + 102 | monitor_speed = 250000 103 | 104 | # 105 | # Sanguinololu (ATmega644p) 106 | # 107 | [env:sanguino_atmega644p] 108 | platform = atmelavr 109 | board = sanguino_atmega644p 110 | lib_deps = ${common.lib_deps} 111 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 112 | src_filter = ${common.default_src_filter} + 113 | monitor_speed = 250000 114 | 115 | # 116 | # Sanguinololu (ATmega1284p) 117 | # 118 | [env:sanguino_atmega1284p] 119 | platform = atmelavr 120 | board = sanguino_atmega1284p 121 | lib_deps = ${common.lib_deps} 122 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 123 | src_filter = ${common.default_src_filter} + 124 | monitor_speed = 250000 125 | 126 | # 127 | # Melzi and clones (ATmega1284p) 128 | # 129 | [env:melzi] 130 | platform = atmelavr 131 | board = sanguino_atmega1284p 132 | lib_deps = ${common.lib_deps} 133 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 134 | src_filter = ${common.default_src_filter} + 135 | monitor_speed = 250000 136 | build_flags = ${common.build_flags} 137 | lib_ignore = TMCStepper 138 | upload_speed = 57600 139 | 140 | # 141 | # Melzi and clones (Optiboot bootloader) 142 | # 143 | [env:melzi_optiboot] 144 | platform = atmelavr 145 | board = sanguino_atmega1284p 146 | lib_deps = ${common.lib_deps} 147 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 148 | src_filter = ${common.default_src_filter} + 149 | monitor_speed = 250000 150 | build_flags = ${common.build_flags} 151 | lib_ignore = TMCStepper 152 | upload_speed = 115200 153 | 154 | # 155 | # AT90USB1286 boards using CDC bootloader 156 | # - BRAINWAVE 157 | # - BRAINWAVE_PRO 158 | # - SAV_MKI 159 | # - TEENSYLU 160 | # 161 | [env:at90usb1286_cdc] 162 | platform = teensy 163 | board = at90usb1286 164 | lib_deps = ${common.lib_deps} 165 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 166 | src_filter = ${common.default_src_filter} + 167 | monitor_speed = 250000 168 | 169 | # 170 | # AT90USB1286 boards using DFU bootloader 171 | # - PrintrBoard 172 | # - PrintrBoard Rev.F 173 | # - ? 5DPRINT ? 174 | # 175 | [env:at90usb1286_dfu] 176 | platform = teensy 177 | board = at90usb1286 178 | lib_deps = ${common.lib_deps} 179 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 180 | src_filter = ${common.default_src_filter} + 181 | monitor_speed = 250000 182 | 183 | # 184 | # Due (Atmel SAM3X8E ARM Cortex-M3) 185 | # 186 | # - RAMPS4DUE 187 | # - RADDS 188 | # 189 | [env:DUE] 190 | platform = atmelsam 191 | board = due 192 | src_filter = ${common.default_src_filter} + 193 | monitor_speed = 250000 194 | 195 | [env:DUE_USB] 196 | platform = atmelsam 197 | board = dueUSB 198 | src_filter = ${common.default_src_filter} + 199 | monitor_speed = 250000 200 | 201 | [env:DUE_debug] 202 | # Used when WATCHDOG_RESET_MANUAL is enabled 203 | platform = atmelsam 204 | board = due 205 | src_filter = ${common.default_src_filter} + 206 | monitor_speed = 250000 207 | build_flags = ${common.build_flags} 208 | -funwind-tables 209 | -mpoke-function-name 210 | 211 | # 212 | # NXP LPC176x ARM Cortex-M3 213 | # 214 | [env:LPC1768] 215 | platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.2.zip 216 | board = nxp_lpc1768 217 | build_flags = -DU8G_HAL_LINKS -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags} 218 | # debug options for backtrace 219 | # -funwind-tables 220 | # -mpoke-function-name 221 | lib_ldf_mode = off 222 | lib_compat_mode = strict 223 | extra_scripts = Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py 224 | src_filter = ${common.default_src_filter} + 225 | monitor_speed = 250000 226 | lib_deps = Servo 227 | LiquidCrystal 228 | U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip 229 | TMCStepper@>=0.6.1,<1.0.0 230 | Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/release.zip 231 | SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip 232 | 233 | [env:LPC1769] 234 | platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.2.zip 235 | board = nxp_lpc1769 236 | build_flags = -DU8G_HAL_LINKS -IMarlin/src/HAL/HAL_LPC1768/include -IMarlin/src/HAL/HAL_LPC1768/u8g ${common.build_flags} 237 | # debug options for backtrace 238 | # -funwind-tables 239 | # -mpoke-function-name 240 | lib_ldf_mode = off 241 | lib_compat_mode = strict 242 | extra_scripts = Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py 243 | src_filter = ${common.default_src_filter} + 244 | monitor_speed = 250000 245 | lib_deps = Servo 246 | LiquidCrystal 247 | U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip 248 | TMCStepper@>=0.6.1,<1.0.0 249 | Adafruit NeoPixel=https://github.com/p3p/Adafruit_NeoPixel/archive/release.zip 250 | SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip 251 | 252 | # 253 | # STM32F103RC 254 | # 255 | [env:STM32F103RC] 256 | platform = ststm32 257 | board = genericSTM32F103RC 258 | platform_packages = tool-stm32duino 259 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 260 | ${common.build_flags} -std=gnu++14 261 | build_unflags = -std=gnu++11 262 | src_filter = ${common.default_src_filter} + 263 | lib_deps = ${common.lib_deps} 264 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 265 | lib_ignore = Adafruit NeoPixel, SPI 266 | monitor_speed = 115200 267 | 268 | # 269 | # STM32F103RC_fysetc 270 | # 271 | [env:STM32F103RC_fysetc] 272 | platform = ststm32 273 | board = genericSTM32F103RC 274 | #board_build.core = maple 275 | platform_packages = tool-stm32duino 276 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 277 | ${common.build_flags} -std=gnu++14 -DDEBUG_LEVEL=0 -DHAVE_SW_SERIAL 278 | build_unflags = -std=gnu++11 279 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py 280 | src_filter = ${common.default_src_filter} + 281 | lib_deps = ${common.lib_deps} 282 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 283 | lib_ignore = Adafruit NeoPixel, SPI 284 | lib_ldf_mode = chain 285 | debug_tool = stlink 286 | upload_protocol = serial 287 | monitor_speed = 250000 288 | 289 | # 290 | # BigTree SKR Mini V1.1 / SKR mini E3 / SKR E3 DIP (STM32F103RCT6 ARM Cortex-M3) 291 | # 292 | # STM32F103RC_bigtree ............. RCT6 with 256K 293 | # STM32F103RC_bigtree_USB ......... RCT6 with 256K (USB mass storage) 294 | # STM32F103RC_bigtree_512K ........ RCT6 with 512K 295 | # STM32F103RC_bigtree_512K_USB .... RCT6 with 512K (USB mass storage) 296 | # 297 | 298 | [env:STM32F103RC_bigtree] 299 | platform = ststm32 300 | board = genericSTM32F103RC 301 | platform_packages = tool-stm32duino 302 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 303 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 304 | build_unflags = -std=gnu++11 305 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py 306 | src_filter = ${common.default_src_filter} + 307 | lib_deps = ${common.lib_deps} 308 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 309 | lib_ignore = Adafruit NeoPixel, SPI 310 | monitor_speed = 115200 311 | 312 | [env:STM32F103RC_bigtree_USB] 313 | platform = ststm32 314 | board = genericSTM32F103RC 315 | platform_packages = tool-stm32duino 316 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 317 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 -DUSE_USB_COMPOSITE 318 | build_unflags = -std=gnu++11 319 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py 320 | src_filter = ${common.default_src_filter} + 321 | lib_deps = ${common.lib_deps} 322 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 323 | lib_ignore = Adafruit NeoPixel, SPI 324 | monitor_speed = 115200 325 | 326 | [env:STM32F103RC_bigtree_512K] 327 | platform = ststm32 328 | board = genericSTM32F103RC 329 | board_upload.maximum_size=524288 330 | platform_packages = tool-stm32duino 331 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 332 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 -DSTM32_FLASH_SIZE=512 333 | build_unflags = -std=gnu++11 334 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py 335 | src_filter = ${common.default_src_filter} + 336 | lib_deps = ${common.lib_deps} 337 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 338 | lib_ignore = Adafruit NeoPixel, SPI 339 | monitor_speed = 115200 340 | 341 | [env:STM32F103RC_bigtree_512K_USB] 342 | platform = ststm32 343 | board = genericSTM32F103RC 344 | board_upload.maximum_size=524288 345 | platform_packages = tool-stm32duino 346 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 347 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 -DSTM32_FLASH_SIZE=512 -DUSE_USB_COMPOSITE 348 | build_unflags = -std=gnu++11 349 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RC_SKR_MINI.py 350 | src_filter = ${common.default_src_filter} + 351 | lib_deps = ${common.lib_deps} 352 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 353 | lib_ignore = Adafruit NeoPixel, SPI 354 | monitor_speed = 115200 355 | 356 | # 357 | # STM32F103RE 358 | # 359 | [env:STM32F103RE] 360 | platform = ststm32 361 | board = genericSTM32F103RE 362 | platform_packages = tool-stm32duino 363 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 364 | ${common.build_flags} -std=gnu++14 365 | build_unflags = -std=gnu++11 366 | src_filter = ${common.default_src_filter} + 367 | lib_deps = ${common.lib_deps} 368 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 369 | lib_ignore = Adafruit NeoPixel, SPI 370 | monitor_speed = 115200 371 | 372 | # 373 | # STM32F103RE_bigtree ............. RET6 374 | # STM32F103RE_bigtree_USB ......... RET6 (USB mass storage) 375 | # 376 | [env:STM32F103RE_bigtree] 377 | platform = ststm32 378 | board = genericSTM32F103RE 379 | platform_packages = tool-stm32duino 380 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 381 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 382 | build_unflags = -std=gnu++11 383 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py 384 | src_filter = ${common.default_src_filter} + 385 | lib_deps = ${common.lib_deps} 386 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 387 | lib_ignore = Adafruit NeoPixel, SPI 388 | debug_tool = stlink 389 | upload_protocol = stlink 390 | monitor_speed = 115200 391 | 392 | [env:STM32F103RE_bigtree_USB] 393 | platform = ststm32 394 | board = genericSTM32F103RE 395 | platform_packages = tool-stm32duino 396 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 397 | ${common.build_flags} -DDEBUG_LEVEL=0 -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4 -DUSE_USB_COMPOSITE 398 | build_unflags = -std=gnu++11 399 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103RE_SKR_E3_DIP.py 400 | src_filter = ${common.default_src_filter} + 401 | lib_deps = ${common.lib_deps} 402 | SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip 403 | lib_ignore = Adafruit NeoPixel, SPI 404 | debug_tool = stlink 405 | upload_protocol = stlink 406 | monitor_speed = 115200 407 | 408 | # 409 | # STM32F4 with STM32GENERIC 410 | # 411 | [env:STM32F4] 412 | platform = ststm32 413 | board = disco_f407vg 414 | build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F4 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED 415 | lib_ignore = Adafruit NeoPixel, TMCStepper 416 | src_filter = ${common.default_src_filter} + - 417 | monitor_speed = 250000 418 | 419 | # 420 | # STM32F7 with STM32GENERIC 421 | # 422 | [env:STM32F7] 423 | platform = ststm32 424 | board = remram_v1 425 | build_flags = ${common.build_flags} -DUSE_STM32GENERIC -DSTM32GENERIC -DSTM32F7 -DMENU_USB_SERIAL -DMENU_SERIAL=SerialUSB -DHAL_IWDG_MODULE_ENABLED 426 | lib_ignore = Adafruit NeoPixel, TMCStepper 427 | src_filter = ${common.default_src_filter} + - 428 | monitor_speed = 250000 429 | 430 | # 431 | # ARMED (STM32) 432 | # 433 | [env:ARMED] 434 | platform = ststm32 435 | board = armed_v1 436 | build_flags = ${common.build_flags} 437 | -DUSBCON -DUSBD_VID=0x0483 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="ARMED_V1"' -DUSBD_USE_CDC 438 | -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing -std=gnu11 -std=gnu++11 439 | -IMarlin/src/HAL/HAL_STM32 440 | lib_ignore = Adafruit NeoPixel, SoftwareSerial 441 | src_filter = ${common.default_src_filter} + 442 | monitor_speed = 250000 443 | 444 | # 445 | # Longer 3D board in Alfawise U20 (STM32F103VET6) 446 | # 447 | [env:STM32F103VE_longer] 448 | platform = ststm32 449 | board = genericSTM32F103VE 450 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 451 | ${common.build_flags} -std=gnu++14 -USERIAL_USB 452 | -DSTM32F1xx -DU20 -DTS_V12 453 | build_unflags = -std=gnu++11 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 454 | extra_scripts = buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py 455 | src_filter = ${common.default_src_filter} + 456 | lib_ignore = Adafruit NeoPixel, LiquidTWI2, SPI 457 | monitor_speed = 250000 458 | 459 | # 460 | # MKS Robin (STM32F103ZET6) 461 | # 462 | [env:mks_robin] 463 | platform = ststm32 464 | board = genericSTM32F103ZE 465 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 466 | ${common.build_flags} -std=gnu++14 -DSTM32_XL_DENSITY 467 | build_unflags = -std=gnu++11 468 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin.py 469 | src_filter = ${common.default_src_filter} + 470 | lib_ignore = Adafruit NeoPixel, SPI 471 | monitor_speed = 250000 472 | 473 | 474 | # 475 | # MKS Robin Pro (STM32F103ZET6) 476 | # 477 | [env:mks_robin_pro] 478 | platform = ststm32 479 | board = genericSTM32F103ZE 480 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_pro.py 481 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 482 | ${common.build_flags} -std=gnu++14 -DSTM32_XL_DENSITY 483 | build_unflags = -std=gnu++11 484 | src_filter = ${common.default_src_filter} + 485 | lib_deps = ${common.lib_deps} 486 | lib_ignore = Adafruit NeoPixel, SPI, TMCStepper 487 | 488 | # 489 | # MKS Robin Lite/Lite2 (STM32F103RCT6) 490 | # 491 | [env:mks_robin_lite] 492 | platform = ststm32 493 | board = genericSTM32F103RC 494 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 495 | ${common.build_flags} -std=gnu++14 496 | build_unflags = -std=gnu++11 497 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_lite.py 498 | src_filter = ${common.default_src_filter} + 499 | lib_ignore = Adafruit NeoPixel, SPI 500 | monitor_speed = 250000 501 | 502 | # 503 | # MKS ROBIN LITE3 (STM32F103RCT6) 504 | # 505 | [env:mks_robin_lite3] 506 | platform = ststm32 507 | board = genericSTM32F103RC 508 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_lite3.py 509 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 510 | ${common.build_flags} -std=gnu++14 511 | build_unflags = -std=gnu++11 512 | src_filter = ${common.default_src_filter} + 513 | lib_deps = ${common.lib_deps} 514 | lib_ignore = Adafruit NeoPixel, SPI 515 | 516 | 517 | # 518 | # MKS Robin Mini (STM32F103VET6) 519 | # 520 | [env:mks_robin_mini] 521 | platform = ststm32 522 | board = genericSTM32F103VE 523 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 524 | ${common.build_flags} -std=gnu++14 525 | build_unflags = -std=gnu++11 526 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_mini.py 527 | src_filter = ${common.default_src_filter} + 528 | lib_ignore = Adafruit NeoPixel, SPI 529 | monitor_speed = 250000 530 | 531 | # 532 | # MKS Robin Nano (STM32F103VET6) 533 | # 534 | [env:mks_robin_nano] 535 | platform = ststm32 536 | board = genericSTM32F103VE 537 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 538 | ${common.build_flags} -std=gnu++14 539 | build_unflags = -std=gnu++11 540 | extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano.py 541 | src_filter = ${common.default_src_filter} + 542 | lib_ignore = Adafruit NeoPixel, SPI 543 | monitor_speed = 250000 544 | 545 | # 546 | # JGAurora A5S A1 (STM32F103ZET6) 547 | # 548 | [env:jgaurora_a5s_a1] 549 | platform = ststm32 550 | board = genericSTM32F103ZE 551 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 552 | ${common.build_flags} -DSTM32F1xx -std=gnu++14 -DSTM32_XL_DENSITY 553 | build_unflags = -std=gnu++11 554 | extra_scripts = buildroot/share/PlatformIO/scripts/jgaurora_a5s_a1_with_bootloader.py 555 | src_filter = ${common.default_src_filter} + 556 | lib_ignore = Adafruit NeoPixel, SPI 557 | monitor_speed = 250000 558 | 559 | # 560 | # Malyan M200 (STM32F103CB) 561 | # 562 | [env:STM32F103CB_malyan] 563 | platform = ststm32 564 | board = malyanM200 565 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py -DMCU_STM32F103CB -D __STM32F1__=1 -std=c++1y -D MOTHERBOARD="BOARD_MALYAN_M200" -DSERIAL_USB -ffunction-sections -fdata-sections -Wl,--gc-sections 566 | -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__ 567 | src_filter = ${common.default_src_filter} + 568 | lib_ignore = Adafruit NeoPixel, LiquidCrystal, LiquidTWI2, TMCStepper, U8glib-HAL, SPI 569 | 570 | # 571 | # Chitu boards like Tronxy X5s (STM32F103ZET6) 572 | # 573 | [env:chitu_f103] 574 | platform = ststm32 575 | board = genericSTM32F103ZE 576 | build_flags = !python Marlin/src/HAL/HAL_STM32F1/build_flags.py 577 | ${common.build_flags} -DSTM32F1xx -std=gnu++14 -DSTM32_XL_DENSITY 578 | build_unflags = -std=gnu++11 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG= -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 579 | extra_scripts = buildroot/share/PlatformIO/scripts/chitu_crypt.py 580 | src_filter = ${common.default_src_filter} + 581 | lib_ignore = Adafruit NeoPixel 582 | monitor_speed = 250000 583 | 584 | 585 | # 586 | # FLYF407ZG 587 | # 588 | [env:FLYF407ZG] 589 | platform = ststm32 590 | board = FLYF407ZG 591 | platform_packages = framework-arduinoststm32@>=3.10700.191028 592 | build_flags = ${common.build_flags} 593 | -DSTM32F4 -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407ZG\" 594 | -DTARGET_STM32F4 -DVECT_TAB_OFFSET=0x8000 595 | -IMarlin/src/HAL/HAL_STM32 596 | build_unflags = -std=gnu++11 597 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py 598 | lib_ignore = Adafruit NeoPixel, TMCStepper, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster, SoftwareSerial 599 | src_filter = ${common.default_src_filter} + 600 | monitor_speed = 250000 601 | 602 | 603 | # 604 | # FYSETC S6 (STM32F446VET6 ARM Cortex-M4) 605 | # 606 | [env:FYSETC_S6] 607 | platform = ststm32 608 | board = fysetc_s6 609 | platform_packages = tool-stm32duino 610 | build_flags = ${common.build_flags} 611 | -DTARGET_STM32F4 -std=gnu++14 612 | -DVECT_TAB_OFFSET=0x10000 613 | -DUSBCON -DUSBD_USE_CDC -DHAL_PCD_MODULE_ENABLED -DUSBD_VID=0x0483 '-DUSB_PRODUCT="FYSETC_S6"' 614 | build_unflags = -std=gnu++11 615 | extra_scripts = buildroot/share/PlatformIO/scripts/fysetc_STM32S6.py 616 | src_filter = ${common.default_src_filter} + 617 | lib_ignore = Arduino-L6470 618 | debug_tool = stlink 619 | #upload_protocol = stlink 620 | upload_protocol = serial 621 | monitor_speed = 250000 622 | 623 | # 624 | # STM32F407VET6 with RAMPS-like shield 625 | # 'Black' STM32F407VET6 board - http://wiki.stm32duino.com/index.php?title=STM32F407 626 | # Shield - https://github.com/jmz52/Hardware 627 | # 628 | [env:STM32F407VE_black] 629 | platform = ststm32 630 | board = blackSTM32F407VET6 631 | platform_packages = framework-arduinoststm32@>=3.10700.191028 632 | build_flags = ${common.build_flags} 633 | -DTARGET_STM32F4 -DARDUINO_BLACK_F407VE 634 | -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"BLACK_F407VE\" 635 | -IMarlin/src/HAL/HAL_STM32 636 | build_unflags = -std=gnu++11 637 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py 638 | lib_ignore = Adafruit NeoPixel, TMCStepper, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster, SoftwareSerial 639 | src_filter = ${common.default_src_filter} + 640 | monitor_speed = 250000 641 | 642 | # 643 | # BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4) 644 | # 645 | [env:BIGTREE_SKR_PRO] 646 | platform = ststm32 647 | board = BigTree_SKR_Pro 648 | platform_packages = framework-arduinoststm32@>=3.10700.191028 649 | build_flags = ${common.build_flags} 650 | -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407ZG\" 651 | -DTARGET_STM32F4 -DSTM32F407_5ZX -DVECT_TAB_OFFSET=0x8000 652 | -DHAVE_HWSERIAL6 653 | -IMarlin/src/HAL/HAL_STM32 654 | build_unflags = -std=gnu++11 655 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py 656 | lib_deps = 657 | U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/bugfix.zip 658 | LiquidCrystal 659 | TMCStepper@>=0.5.2,<1.0.0 660 | Adafruit NeoPixel 661 | LiquidTWI2=https://github.com/lincomatic/LiquidTWI2/archive/master.zip 662 | Arduino-L6470=https://github.com/ameyer/Arduino-L6470/archive/dev.zip 663 | lib_ignore = SoftwareSerial, SoftwareSerialM 664 | src_filter = ${common.default_src_filter} + 665 | monitor_speed = 250000 666 | 667 | # 668 | # BigTreeTech BTT002 (STM32F407VET6 ARM Cortex-M4) 669 | # 670 | [env:BIGTREE_BTT002] 671 | platform = ststm32@5.6.0 672 | board = BigTree_Btt002 673 | platform_packages = framework-arduinoststm32@>=3.10700.191028 674 | build_flags = ${common.build_flags} 675 | -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483 -DUSB_PRODUCT=\"STM32F407VE\" 676 | -DTARGET_STM32F4 -DSTM32F407_5VX -DVECT_TAB_OFFSET=0x8000 677 | -DHAVE_HWSERIAL2 678 | -DHAVE_HWSERIAL3 679 | -DPIN_SERIAL2_RX=PD_6 680 | -DPIN_SERIAL2_TX=PD_5 681 | build_unflags = -std=gnu++11 682 | extra_scripts = pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py 683 | lib_ignore = Adafruit NeoPixel, SailfishLCD, SailfishRGB_LED, SlowSoftI2CMaster 684 | src_filter = ${common.default_src_filter} + 685 | monitor_speed = 250000 686 | 687 | # 688 | # Teensy 3.1 / 3.2 (ARM Cortex-M4) 689 | # 690 | [env:teensy31] 691 | platform = teensy 692 | board = teensy31 693 | lib_deps = ${common.lib_deps} 694 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 695 | lib_ignore = Adafruit NeoPixel 696 | src_filter = ${common.default_src_filter} + 697 | monitor_speed = 250000 698 | 699 | # 700 | # Teensy 3.5 / 3.6 (ARM Cortex-M4) 701 | # 702 | [env:teensy35] 703 | platform = teensy 704 | board = teensy35 705 | lib_deps = ${common.lib_deps} 706 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 707 | lib_ignore = Adafruit NeoPixel 708 | src_filter = ${common.default_src_filter} + 709 | monitor_speed = 250000 710 | 711 | # 712 | # Espressif ESP32 713 | # 714 | [env:esp32] 715 | platform = espressif32 716 | board = esp32dev 717 | build_flags = ${common.build_flags} -DCORE_DEBUG_LEVEL=0 718 | lib_deps = ${common.lib_deps} 719 | AsyncTCP=https://github.com/me-no-dev/AsyncTCP/archive/master.zip 720 | ESPAsyncWebServer=https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip 721 | lib_ignore = LiquidCrystal, LiquidTWI2, SailfishLCD, SailfishRGB_LED 722 | src_filter = ${common.default_src_filter} + 723 | upload_speed = 115200 724 | monitor_speed = 250000 725 | #upload_port = marlinesp.local 726 | #board_build.flash_mode = qio 727 | 728 | # 729 | # Native 730 | # No supported Arduino libraries, base Marlin only 731 | # 732 | [env:linux_native] 733 | platform = native 734 | framework = 735 | build_flags = -D__PLAT_LINUX__ -std=gnu++17 -ggdb -g -lrt -lpthread -D__MARLIN_FIRMWARE__ -Wno-expansion-to-defined 736 | src_build_flags = -Wall -IMarlin/src/HAL/HAL_LINUX/include 737 | build_unflags = -Wall 738 | lib_ldf_mode = off 739 | lib_deps = 740 | extra_scripts = 741 | src_filter = ${common.default_src_filter} + 742 | 743 | # 744 | # Adafruit Grand Central M4 (Atmel SAMD51P20A ARM Cortex-M4) 745 | # 746 | [env:SAMD51_grandcentral_m4] 747 | platform = atmelsam 748 | board = adafruit_grandcentral_m4 749 | build_flags = ${common.build_flags} -std=gnu++17 750 | extra_scripts = ${common.extra_scripts} 751 | build_unflags = -std=gnu++11 752 | src_filter = ${common.default_src_filter} + 753 | debug_tool = jlink 754 | 755 | # 756 | # RUMBA32 757 | # 758 | [env:rumba32_f446ve] 759 | platform = ststm32 760 | board = rumba32_f446ve 761 | build_flags = ${common.build_flags} 762 | -DSTM32F4xx 763 | -DARDUINO_RUMBA32_F446VE 764 | -DARDUINO_ARCH_STM32 765 | "-DBOARD_NAME=\"RUMBA32_F446VE\"" 766 | -DSTM32F446xx 767 | -DUSBCON 768 | -DUSBD_VID=0x0483 769 | "-DUSB_MANUFACTURER=\"Unknown\"" 770 | "-DUSB_PRODUCT=\"RUMBA32_F446VE\"" 771 | -DHAL_PCD_MODULE_ENABLED 772 | -DUSBD_USE_CDC 773 | -DDISABLE_GENERIC_SERIALUSB 774 | -DHAL_UART_MODULE_ENABLED 775 | -Os 776 | lib_ignore = Adafruit NeoPixel 777 | src_filter = ${common.default_src_filter} + 778 | monitor_speed = 500000 779 | upload_protocol = dfu 780 | 781 | # 782 | # MKS RUMBA32(add TMC2208/2209 UART interface and AUX-1) 783 | # 784 | [env:mks_rumba32] 785 | platform = ststm32 786 | board = rumba32_f446ve 787 | build_flags = ${common.build_flags} 788 | -DSTM32F4xx -DARDUINO_RUMBA32_F446VE -DARDUINO_ARCH_STM32 "-DBOARD_NAME=\"RUMBA32_F446VE\"" 789 | -DSTM32F446xx -DUSBCON -DUSBD_VID=0x8000 790 | "-DUSB_MANUFACTURER=\"Unknown\"" 791 | "-DUSB_PRODUCT=\"RUMBA32_F446VE\"" 792 | -DHAL_PCD_MODULE_ENABLED 793 | -DUSBD_USE_CDC 794 | -DDISABLE_GENERIC_SERIALUSB 795 | -DHAL_UART_MODULE_ENABLED 796 | -Os 797 | lib_ignore = Adafruit NeoPixel 798 | src_filter = ${common.default_src_filter} + + - 799 | monitor_speed = 250000 800 | upload_protocol = dfu 801 | 802 | # 803 | # Just print the dependency tree 804 | # 805 | [env:include_tree] 806 | platform = atmelavr 807 | board = megaatmega2560 808 | build_flags = -c -H -std=gnu++11 -Wall -Os -D__MARLIN_FIRMWARE__ 809 | lib_deps = ${common.lib_deps} 810 | TMC26XStepper=https://github.com/trinamic/TMC26XStepper/archive/master.zip 811 | src_filter = + 812 | -------------------------------------------------------------------------------- /src/web/camera.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --image-url: url("data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="); 3 | } 4 | 5 | body { 6 | position: fixed; 7 | top: 0; 8 | left: 0; 9 | right: 0; 10 | bottom: 0; 11 | margin: 0; 12 | padding: 0; 13 | border: 0; 14 | background: black; 15 | background-size: contain; 16 | background-position: center; 17 | background-repeat: no-repeat; 18 | background-image: var(--image-url); 19 | } 20 | -------------------------------------------------------------------------------- /src/web/camera.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | camera 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/web/camera.jpg: -------------------------------------------------------------------------------- 1 | /var/www/html/camera.jpg -------------------------------------------------------------------------------- /src/web/camera.js: -------------------------------------------------------------------------------- 1 | function init() { 2 | document.body.onclick = () => { 3 | window.location = `http://${location.hostname}:4080/index.html`; 4 | }; 5 | updateImage(); 6 | } 7 | 8 | let recover; 9 | 10 | function updateImage() { 11 | clearTimeout(recover); 12 | let time = Date.now(); 13 | let img = new Image(); 14 | let url = `http://${location.hostname}/camera.jpg?time=${time}`; 15 | img.onload = () => { 16 | document.documentElement.style.setProperty('--image-url', `url(${url})`); 17 | setTimeout(updateImage, 1000); 18 | }; 19 | img.onerror = () => { 20 | setTimeout(updateImage, 1000); 21 | }; 22 | img.src = url; 23 | recover = setTimeout(updateImage, 5000); 24 | } 25 | -------------------------------------------------------------------------------- /src/web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GridSpace/grid-bot/c33969f787e8f3de42eeda3ada5f0168e87c38d2/src/web/favicon.ico -------------------------------------------------------------------------------- /src/web/index.css: -------------------------------------------------------------------------------- 1 | *:focus { 2 | outline: none; 3 | } 4 | div,span { 5 | x-box-sizing: border-box; 6 | } 7 | body { 8 | top: 0; 9 | left: 0; 10 | right: 0; 11 | bottom: 0; 12 | margin: 0; 13 | border: 0; 14 | padding: 0; 15 | position: fixed; 16 | background-color: #ddd; 17 | } 18 | div { 19 | margin: 0; 20 | border: 0; 21 | padding: 0; 22 | position: relative; 23 | } 24 | td { 25 | text-align: center; 26 | } 27 | label { 28 | font-size: large; 29 | margin: 5px; 30 | } 31 | input { 32 | background-color: white; 33 | font-family: monospace; 34 | padding: 3px; 35 | border: 1px solid #ccc; 36 | border-radius: 3px; 37 | margin-left: 5px; 38 | margin-right: 5px; 39 | font-size: large; 40 | } 41 | input:focus { 42 | background-color: #f9f9f9; 43 | } 44 | input:disabled { 45 | color: #111; 46 | } 47 | button { 48 | padding: 5px 8px 5px 8px; 49 | background-color: #e5ecf5; 50 | border: 1px solid rgba(0,0,0,0.25); 51 | border-radius: 5px; 52 | font-size: large; 53 | } 54 | button:hover { 55 | background-color: #b5b8c5; 56 | } 57 | button:active { 58 | background-color: #c5c8d5; 59 | } 60 | #body { 61 | font-size: 14px; 62 | font-family: sans-serif; 63 | align-items: center; 64 | justify-content: flex-start; 65 | top: 0; 66 | left: 0; 67 | right: 0; 68 | margin: auto; 69 | padding: 0; 70 | width: 800px; 71 | min-width: 800px; 72 | max-width: 800px; 73 | height: 480px; 74 | min-height: 480px; 75 | max-height: 480px; 76 | white-space: nowrap; 77 | overflow: hidden; 78 | position: fixed; 79 | } 80 | #header { 81 | font-family: monospace; 82 | position: absolute; 83 | top: 0; 84 | left: 0; 85 | right: 0; 86 | } 87 | #hdr_padd { 88 | position: relative; 89 | text-align: center; 90 | width: 50px; 91 | } 92 | #hdr_padd label { 93 | margin: 0; 94 | color: #00f; 95 | } 96 | #hdr_padd:hover #hdr_macro { 97 | display: grid; 98 | } 99 | #hdr_macro { 100 | grid-template-columns: auto auto auto; 101 | grid-template-rows: auto; 102 | column-gap: 5px; 103 | row-gap: 5px; 104 | display: none; 105 | position: absolute; 106 | padding: 3px; 107 | z-index: 10; 108 | background-color: white; 109 | border: 1px solid #ddd; 110 | border-radius: 7px; 111 | max-height: 480px; 112 | overflow-y: auto; 113 | } 114 | #hdr_macro button { 115 | xfont-size: 12px; 116 | margin: 3px; 117 | } 118 | .mtop { 119 | margin-top: 20px; 120 | } 121 | #menu { 122 | width: 50px; 123 | font-size: 30px !important; 124 | } 125 | #menu > div { 126 | display: flex; 127 | flex-direction: row; 128 | align-items: center; 129 | align-content: stretch; 130 | flex-grow: 1; 131 | width: 48px; 132 | border-bottom: 1px solid #ddd; 133 | border-right: 1px solid black; 134 | border-left: 1px solid #ddd; 135 | border-top: 1px solid #ddd; 136 | color: #888; 137 | } 138 | #menu > div:hover { 139 | background-color: #eee; 140 | } 141 | #menu > div > svg { 142 | margin-left: auto; 143 | margin-right: auto; 144 | } 145 | .menu_sel { 146 | border-bottom: 1px solid black !important; 147 | border-right: 1px solid #f4f4f4 !important; 148 | border-left: 1px solid #f4f4f4 !important; 149 | border-top: 1px solid black !important; 150 | background-color: #f4f4f4; 151 | color: black !important; 152 | } 153 | #pages > div { 154 | display: none; 155 | width: 749px; 156 | min-height: 0; 157 | flex-grow: 1; 158 | background-color: #f4f4f4; 159 | border-top: 1px solid black; 160 | border-right: 1px solid black; 161 | border-bottom: 1px solid black; 162 | } 163 | #page-home, #page-ctrl, #page-move { 164 | padding: 5px; 165 | width: 739px !important; 166 | } 167 | #filename { 168 | text-align: center; 169 | } 170 | #progress { 171 | display: block; 172 | } 173 | #progress-bar { 174 | border-radius: 2px; 175 | position: absolute; 176 | background-color: rgba(255,0,0,0.25); 177 | top: 0; 178 | left: 0; 179 | right: 0; 180 | bottom: 0; 181 | margin: 5px; 182 | padding: 0; 183 | border: 0; 184 | } 185 | #printing label { 186 | width: 5em; 187 | } 188 | #printing input { 189 | margin: 5px; 190 | width: 300px; 191 | } 192 | #printing button { 193 | margin: 5px; 194 | } 195 | #heating button { 196 | width: 50px; 197 | } 198 | #heating input { 199 | text-align: center; 200 | } 201 | #feedscale { 202 | margin-left: 0 !important; 203 | margin-right: 0 !important; 204 | text-align: center; 205 | } 206 | #preheat button, #cooldown button { 207 | width: 180px; 208 | } 209 | #page-home button { 210 | margin-bottom: 5px; 211 | } 212 | #page-home input:nth-child(1n+2) { 213 | margin-bottom: 5px; 214 | } 215 | .homeact button { 216 | margin-bottom: 0 !important; 217 | } 218 | #toptoggle { 219 | position: absolute; 220 | top: 11px; 221 | right: 13px; 222 | } 223 | #state { 224 | text-align: center; 225 | margin-bottom: 30px; 226 | font-size: x-large; 227 | font-weight: bold; 228 | padding: 10px; 229 | } 230 | #bed_at,#nozzle_at,#nozzle2_at,#bed_temp,#nozzle_temp,#nozzle2_temp { 231 | width: 60px; 232 | margin-left: 0; 233 | } 234 | #keypad { 235 | position: absolute; 236 | right: 5px; 237 | bottom: 76px; 238 | z-index: 100000; 239 | border: 1px solid #ddd; 240 | background-color: #f8f8f8; 241 | padding: 8px; 242 | } 243 | #keypad button { 244 | width: 50px; 245 | height: 50px; 246 | margin: 3px; 247 | } 248 | #page-move td { 249 | text-align: center; 250 | } 251 | #temps { 252 | background-color: #f2f2f2; 253 | border: 1px solid #bbb; 254 | margin: 10px 0 5px 0; 255 | border-radius: 5px; 256 | padding: 5px; 257 | align-items: flex-end; 258 | } 259 | #temps .bed { 260 | background: linear-gradient(red 0 5%, rgba(255,0,0,0.05) 5% 100%); 261 | border-top: 2px solid red; 262 | width: 1px; 263 | } 264 | #temps .noz { 265 | background: linear-gradient(blue 0 5%, rgba(0,0,255,0.05) 5% 100%); 266 | border-top: 2px solid blue; 267 | width: 1px; 268 | } 269 | .xyz > div { 270 | margin: 4px; 271 | } 272 | .xyz input { 273 | text-align: right; 274 | } 275 | .jog button { 276 | margin: 3px; 277 | } 278 | .jog div div button { 279 | padding: 10px !important; 280 | } 281 | #jogpad button { 282 | font-weight: bold; 283 | min-width: 65px; 284 | min-height: 65px; 285 | } 286 | #page-file > div { 287 | width: 50%; 288 | } 289 | #page-file { 290 | min-height: 0; 291 | } 292 | #menu-conf { 293 | display: none !important; 294 | } 295 | #menu-file svg { 296 | font-size: larger; 297 | } 298 | #menu-terminal svg { 299 | font-size: smaller; 300 | } 301 | #file-list-wrap { 302 | overflow-y: auto; 303 | margin: 10px 0 10px 10px; 304 | background: #fafafa; 305 | xmax-height: 400px; 306 | } 307 | #file-detail { 308 | overflow-y: auto; 309 | margin: 10px 10px 10px 10px; 310 | background: #fafafa; 311 | } 312 | #file-detail button { 313 | margin: 0 10px 5px 10px; 314 | } 315 | #file-list { 316 | font-family: monospace; 317 | background: rgba(250,250,250,0.25); 318 | border-radius: 5px; 319 | user-select: none; 320 | } 321 | #file-list label { 322 | font-size: x-large; 323 | overflow-x: hidden; 324 | } 325 | #file-list div:nth-child(1n+2) { 326 | border-top: 1px dashed #ddd; 327 | } 328 | #file-list button { 329 | font-size: smaller; 330 | margin: 2px 4px 2px 4px; 331 | padding: 2px 4px 2px 4px; 332 | border-radius: 3px; 333 | } 334 | #file-list > div:hover { 335 | background-color: #ddd; 336 | } 337 | #file-info { 338 | border-bottom: 1px solid #ddd; 339 | } 340 | #file-info > div { 341 | display: flex; 342 | flex-direction: row; 343 | } 344 | #file-info label { 345 | font-weight: bold; 346 | width: 75px; 347 | } 348 | #file-info span { 349 | margin: 5px 5px 5px 10px; 350 | font-size: larger; 351 | } 352 | #file-detail button { 353 | margin-top: 5px; 354 | } 355 | .file-selected { 356 | background-color: #e8e8e8; 357 | } 358 | #comm-input { 359 | background-color: white; 360 | padding: 5px 5px 5px 5px; 361 | border-bottom: 1px solid #ccc; 362 | flex-shrink: 0; 363 | } 364 | #comm-input > input { 365 | padding: 3px 5px 3px 5px; 366 | } 367 | #comm-log { 368 | padding: 0 5px 5px 5px; 369 | font-family: monospace; 370 | font-size: smaller; 371 | overflow: auto; 372 | padding: 5px; 373 | } 374 | #page-vids { 375 | position: relative; 376 | align-items: center; 377 | } 378 | #page-vids img, #page-vids iframe { 379 | width: 100%; 380 | height: 100%; 381 | margin: 0; 382 | border: 0; 383 | padding: 0; 384 | } 385 | #page-ctrl > label { 386 | margin: 0; 387 | padding: 5px; 388 | padding-bottom: 5px; 389 | border-bottom: 1px solid #ddd; 390 | background-color: white; 391 | } 392 | #page-ctrl > label:nth-child(1n+3) { 393 | border-top: 1px solid #ddd; 394 | } 395 | #page-ctrl > div { 396 | padding: 5px; 397 | } 398 | #page-ctrl button { 399 | font-size: medium !important; 400 | flex-shrink: 0; 401 | } 402 | #settings { 403 | overflow-y: auto; 404 | min-height: 0; 405 | background-color: #f8f8f8; 406 | } 407 | .settings:hover { 408 | background-color: #eee; 409 | } 410 | #settings table { 411 | margin: 0; 412 | border: 0; 413 | padding: 0; 414 | border-collapse: collapse; 415 | } 416 | #settings th,td { 417 | text-align: left; 418 | } 419 | #settings label { 420 | padding-right: 2px; 421 | white-space: nowrap; 422 | font-size: smaller; 423 | } 424 | #macros { 425 | display: grid; 426 | grid-template-columns: auto 1fr auto; 427 | grid-template-rows: auto; 428 | column-gap: 5px; 429 | row-gap: 5px; 430 | margin: 5px; 431 | overflow-y: auto; 432 | } 433 | #macros button, #macros input { 434 | padding: 6px; 435 | margin: 0; 436 | } 437 | .row { 438 | display: flex; 439 | flex-direction: row; 440 | } 441 | .col { 442 | display: flex; 443 | flex-direction: column; 444 | } 445 | .fix { 446 | position: fixed; 447 | } 448 | .rel { 449 | position: relative; 450 | } 451 | .abs { 452 | position: absolute; 453 | } 454 | .shrink { 455 | flex-shrink: 1; 456 | } 457 | .over-y { 458 | overflow-y: auto; 459 | } 460 | .grow { 461 | flex-grow: 1; 462 | } 463 | .mh0 { 464 | min-height: 0; 465 | } 466 | .zero { 467 | margin: 0 !important; 468 | border: 0 !important; 469 | padding: 0 !important; 470 | } 471 | .space-around { 472 | justify-content: space-around; 473 | } 474 | .space-between { 475 | justify-content: space-between; 476 | } 477 | .items-stretch { 478 | align-items: stretch !important; 479 | } 480 | .items-center { 481 | align-items: center; 482 | } 483 | .content-stretch { 484 | align-content: stretch; 485 | } 486 | .content-center { 487 | align-content: center; 488 | } 489 | .a-end { 490 | align-items: flex-end; 491 | } 492 | .j-end { 493 | justify-content: flex-end; 494 | } 495 | .text-center { 496 | text-align: center; 497 | } 498 | .no-lm { 499 | margin-left: 0 !important; 500 | } 501 | .no-rm { 502 | margin-right: 0 !important; 503 | } 504 | .five { 505 | width: 5px; 506 | height: 5px; 507 | } 508 | .ten { 509 | width: 10px; 510 | height: 10px; 511 | } 512 | .editable { 513 | background-color: #ffe; 514 | } 515 | .bg_red { 516 | background-color: #fdd !important; 517 | } 518 | .bg_green { 519 | background-color: #dfd !important; 520 | } 521 | .bg_yellow { 522 | background-color: #ffd !important; 523 | } 524 | -------------------------------------------------------------------------------- /src/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | GridBot 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 26 | 27 | 36 | 37 |
38 | 39 |
40 | 41 | 42 |
43 |
44 |
45 |
46 | 47 | 48 |
49 |
50 | 51 | 52 |
53 |
54 | 55 |
56 | 57 |
58 |
59 |
60 |
61 | 62 | 63 | 64 |
65 |
66 | 67 |
68 |
69 | 70 | 71 | 72 | 73 |
74 |
75 | 76 | 77 | 78 | 79 |
80 |
81 | 82 | 83 | 84 | 85 |
86 |
87 | 88 | 89 |
90 |
91 | 92 | 93 |
94 |
95 |
96 | 97 | 98 | 99 | 100 | 101 |
102 |
103 |
104 | 105 |
106 |
107 | 108 |
109 |
110 | 111 | 112 |
113 |
114 |
115 | 116 | 117 |
118 |
119 |
120 | 121 | 122 |
123 |
124 |
125 | 126 | 127 | 128 |
129 |
130 | 131 |
132 | 133 |
134 | 135 |
136 |
137 | 138 |
139 |
140 |
141 |
142 |
143 |
144 | 145 | 146 |
147 |
148 | 149 | 150 |
151 |
152 | 153 | 154 |
155 |
156 |
157 | 158 | 159 | 160 |
161 |
162 | 163 | 164 | 165 |
166 |
167 | 168 | 169 | 170 |
171 |
172 | 173 | 174 | 175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 | 183 |
184 |
185 | 186 | 187 | 188 |
189 |
190 | 191 | 192 | 193 |
194 |
195 |
196 |
197 |
198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 |
 
 
 
222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 |
239 |
240 |
241 |
242 | 243 |
244 |
245 | 246 | 247 | 248 | 249 |
250 |
251 | 252 | 253 | 254 | 255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 | 263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 | 277 | 278 | 279 | 280 |
281 |
282 | 283 |
284 |
285 |
286 | 287 |
288 |
289 |
facing
290 |
drill
291 |
pocket
292 |
293 |
294 | facing 295 |
296 |
297 | drill 298 |
299 |
300 | pocket 301 |
302 |
303 |
304 | 305 | 306 | 307 | 308 | 309 | 310 |
311 | 312 |
313 |
314 |
315 | 316 |
317 |
318 | 319 | 320 | 321 |
322 |
323 |
324 | 325 |
326 | 327 |
328 |
329 |
330 | 331 |
332 |
333 | serial ports 334 | 337 | baud 338 | 342 | 343 |
344 |
345 | 346 |
347 |
348 | 349 | 350 | -------------------------------------------------------------------------------- /src/web/index.js: -------------------------------------------------------------------------------- 1 | /** Copyright Stewart Allen -- All Rights Reserved */ 2 | 3 | "use strict"; 4 | 5 | const IGNORE = 1; 6 | 7 | const MCODE = { 8 | M92: "steps per", 9 | M145: IGNORE, // material properties 10 | M149: IGNORE, // temps: C, F 11 | M200: IGNORE, // filament size: S0 D1.75 12 | M201: "accel max", 13 | M203: "feedrate max", 14 | M204: "accel", 15 | M205: "advanced", 16 | M206: "home offset", 17 | M301: "hot end pid", 18 | M304: "bed pid", 19 | M412: "filament runout", 20 | M413: "power loss", 21 | M414: IGNORE, // language font 22 | M420: "bed leveling", 23 | M603: "filament", 24 | M851: "z probe offset", 25 | M808: "repeat count", 26 | M900: "linear advance", 27 | M906: "stepper current", 28 | M913: "hybrid @", 29 | M914: "stallguard @" 30 | }; 31 | 32 | const MLINE = { 33 | M205: 4 34 | }; 35 | 36 | const MKEYS = { 37 | M205: [ "X", "Y", "Z", "E", "B", "S", "T", "J" ] 38 | } 39 | 40 | let istouch = true || 'ontouchstart' in document.documentElement || window.innerWidth === 800; 41 | let interval = null; 42 | let queue = []; 43 | let logmsg = []; 44 | let files = {}; 45 | let file_selected = null; 46 | let success = false; 47 | let ready = false; 48 | let sock = null; 49 | let last_jog = null; 50 | let last_jog_speed = null; 51 | let last_cfg = {}; // last config object 52 | let last_set = {}; // last settings object 53 | let last_hash = ''; // last settings hash 54 | let jog_val = 0.0; 55 | let jog_speed = 1000; 56 | let input = null; // active input for keypad 57 | let persist = localStorage; 58 | let selected = null; 59 | let mode = null; // for checking against current status 60 | let grbl = false; 61 | let vids_err = 0; 62 | let run_verb = 'print'; 63 | let job_verb = 'print'; 64 | let serial = navigator ? navigator.serial : undefined; 65 | let temphist = JSON.parse(persist.temphist || '[]'); 66 | 67 | function $(id) { 68 | return document.getElementById(id); 69 | } 70 | 71 | function log(msg) { 72 | console.log({msg}); 73 | } 74 | 75 | function zpad(v) { 76 | return v < 10 ? `0${v}` : v; 77 | } 78 | 79 | function elapsed(millis) { 80 | let time = moment.duration(millis); 81 | return `${zpad(time.hours())}:${zpad(time.minutes())}:${zpad(time.seconds())}`; 82 | } 83 | 84 | function alert_on_run() { 85 | if (last_set.print.run && !last_set.print.pause) { 86 | alert(`${job_verb} in progress`); 87 | return true; 88 | } 89 | return false; 90 | } 91 | 92 | function reload() { 93 | document.location = document.location; 94 | } 95 | 96 | function update_code() { 97 | if (confirm("update code?")) { 98 | send("*exec bin/update-code.sh"); 99 | } 100 | } 101 | 102 | function reboot() { 103 | if (confirm("reboot system?")) { 104 | send("*exec sudo reboot"); 105 | } 106 | } 107 | 108 | function shutdown() { 109 | if (confirm("shutdown system?")) { 110 | send("*exec sudo halt -p"); 111 | } 112 | } 113 | 114 | function runbox() { 115 | if (selected && ["n","g"].indexOf(selected.ext) >= 0) { 116 | if (confirm(`run boundary for "${selected.file}" @ ${jog_speed} mm/m`)) { 117 | send(`*runbox ${selected.file} @ ${jog_speed}`); 118 | } 119 | } else { 120 | alert('no gcode file selected'); 121 | } 122 | } 123 | 124 | function print_selected() { 125 | if (selected) { 126 | print(selected.file, selected.ext); 127 | } else { 128 | alert('no gcode file selected'); 129 | } 130 | } 131 | 132 | function download_selected() { 133 | if (selected) { 134 | download(selected.file, selected.ext); 135 | } else { 136 | alert('no gcode file selected'); 137 | } 138 | } 139 | 140 | function delete_selected(yes) { 141 | if (selected) { 142 | remove(selected.file, yes); 143 | } else { 144 | alert('no gcode file selected'); 145 | } 146 | } 147 | 148 | function select(file, ext, ev) { 149 | file = files[file]; 150 | if (file) { 151 | $('file-name').innerText = file.name; 152 | $('file-date').innerText = moment(new Date(file.time)).format('YY/MM/DD HH:mm:ss'); 153 | // add thousand's place commas 154 | $('file-size').innerText = file.size 155 | .toString() 156 | .split('') 157 | .reverse() 158 | .map((v,i,a) => { 159 | return i < a.length - 1 && i % 3 === 2 ? ',' + v : v; 160 | }) 161 | .reverse() 162 | .join('') 163 | ; 164 | if (file.last) { 165 | $('file-print').innerText = elapsed(file.last.end - file.last.start); 166 | $('file-last').style.display = ''; 167 | } else { 168 | $('file-last').style.display = 'none'; 169 | } 170 | $('file-go').innerText = (ext === 'g' ? run_verb : 'install'); 171 | if (file_selected) { 172 | file_selected.classList.remove("file-selected"); 173 | } 174 | file_selected = $(file.uuid); 175 | file_selected.classList.add("file-selected"); 176 | selected = {file: file.name, ext}; 177 | if (ev) { 178 | if (ev.metaKey || ev.ctrlKey) { 179 | if (!ev.shiftKey) { 180 | download_selected() 181 | } else { 182 | delete_selected(true); 183 | } 184 | } 185 | } 186 | } else { 187 | selected = null; 188 | } 189 | } 190 | 191 | function print(file, ext, yes) { 192 | if (!last_set) { 193 | alert('not connected'); 194 | return; 195 | } 196 | if (alert_on_run()) return; 197 | if (ext === "h") { 198 | return firmware_update(file); 199 | } 200 | if (yes || confirm(`start ${job_verb} "${file}"?`)) { 201 | send('*clear'); 202 | send(`*kick ${file}`); 203 | menu_select('home'); 204 | } 205 | } 206 | 207 | function download(file, ext) { 208 | location = `${location.origin}/${file}`; 209 | } 210 | 211 | function remove(file, yes) { 212 | if (yes || confirm(`delete "${file}"?`)) { 213 | send(`*delete ${file}`); 214 | setTimeout(() => { 215 | send('*list'); 216 | }, 250); 217 | } 218 | } 219 | 220 | function clear_files(yes) { 221 | if (yes || confirm('delete all files?')) { 222 | for (let file in files) { 223 | send(`*delete ${file}`); 224 | } 225 | setTimeout(() => { 226 | send('*list'); 227 | }, 500); 228 | } 229 | } 230 | 231 | function center_go() { 232 | let stat = last_set; 233 | send_safe(`G0 X${stat.device.max.X/2} Y${stat.device.max.Y/2} F${jog_speed}`); 234 | } 235 | 236 | function home_go() { 237 | if (mode === 'fdm') { 238 | send_safe('G28'); 239 | } 240 | if (mode === 'cnc') { 241 | origin_go(); 242 | } 243 | } 244 | 245 | function origin_go() { 246 | send_safe(`G0 X0 Y0 F${jog_speed}`); 247 | if (mode === 'fdm') { 248 | send_safe('G0 Z0'); 249 | } 250 | } 251 | 252 | function origin_set() { 253 | if (alert_on_run()) return; 254 | if (mode === 'fdm' && last_set && last_set.pos) { 255 | let pos = last_set.pos; 256 | send(`M206 X-${pos.X} Y-${pos.Y}`); 257 | send('M500'); 258 | } 259 | if (mode === 'cnc') { 260 | send('G92 X0 Y0 Z0'); 261 | if (grbl) { 262 | send('G10 L20 P1 X0 Y0 Z0; ?'); 263 | } 264 | } 265 | } 266 | 267 | function origin_set_axis(axis) { 268 | if (alert_on_run()) return; 269 | axis = axis.toUpperCase(); 270 | send(`G92 ${axis}0`); 271 | if (grbl) { 272 | send(`G10 L20 P1 ${axis}0; ?`); 273 | } else { 274 | send('*status'); 275 | } 276 | } 277 | 278 | function origin_clear() { 279 | if (alert_on_run()) return; 280 | if (!grbl) { 281 | send('M206 X0 Y0 Z0'); 282 | send('M500'); 283 | } 284 | } 285 | 286 | function update_probe_z() { 287 | if (alert_on_run()) return; 288 | let status = last_set; 289 | let settings = status.settings; 290 | let pos = status.pos; 291 | if (!persist.M851) return alert('missing M851'); 292 | if (!pos) return alertn('missing position'); 293 | let newz = settings.M851.Z + pos.Z; 294 | if (isNaN(newz)) return alert(`invalid new z ${newz}`); 295 | if (newz > 5 || newz < -5) return alert(`invalid new z value ${newz}`); 296 | if (confirm(`set new z probe offset to ${newz}`)) { 297 | send(`M851 Z${newz}; M503; *status`); 298 | } 299 | } 300 | 301 | function probe_bed() { 302 | if (alert_on_run()) return; 303 | if (confirm('run bed level probe?')) { 304 | send('G29 P1'); 305 | send('G29 T'); 306 | menu_select('comm'); 307 | } 308 | } 309 | 310 | function calibrate_pid() { 311 | if (alert_on_run()) return; 312 | if (confirm('run hot end PID calibration?')) { 313 | send('M303 S220 C8 U1'); 314 | menu_select('comm'); 315 | } 316 | } 317 | 318 | function update_position() { 319 | send('M114'); 320 | } 321 | 322 | function eeprom_save() { 323 | if (alert_on_run()) return; 324 | if (confirm('save eeprom settings')) { 325 | send('M500'); 326 | } 327 | } 328 | 329 | function eeprom_restore() { 330 | if (alert_on_run()) return; 331 | if (confirm('restore eeprom settings')) { 332 | send('M501'); 333 | send('M503'); 334 | settings_done = false; 335 | } 336 | } 337 | 338 | function bed_toggle() { 339 | let toggle = $('bed_toggle'); 340 | if (toggle.innerText === 'on') { 341 | toggle.innerText = 'off'; 342 | send('M140 S' + bed_temp()); 343 | send('M105'); 344 | } else { 345 | toggle.innerText = 'on'; 346 | send('M140 S0'); 347 | send('M105'); 348 | } 349 | } 350 | 351 | function bed_temp() { 352 | return parseInt($('bed_temp').value || '0'); 353 | } 354 | 355 | function nozzle_toggle() { 356 | let toggle = $('nozzle_toggle'); 357 | if (toggle.innerText === 'on') { 358 | toggle.innerText = 'off'; 359 | send(`M104 S${nozzle2_temp()} T0`); 360 | send('M105'); 361 | } else { 362 | toggle.innerText = 'on'; 363 | send('M104 S0 T0'); 364 | send('M105'); 365 | } 366 | } 367 | 368 | function nozzle_toggle2() { 369 | let toggle = $('nozzle2_toggle'); 370 | if (toggle.innerText === 'on') { 371 | toggle.innerText = 'off'; 372 | send(`M104 S${nozzle2_temp()} T1`); 373 | send('M105'); 374 | } else { 375 | toggle.innerText = 'on'; 376 | send('M104 S0 T1'); 377 | send('M105'); 378 | } 379 | } 380 | 381 | function preheat() { 382 | if (alert_on_run()) return; 383 | send(`M104 S${persist.default_nozzle || 220} T0`); 384 | send(`M140 S${persist.default_bed || 65}`); 385 | send('M105'); 386 | } 387 | 388 | function cooldown() { 389 | if (alert_on_run()) return; 390 | send(`M104 S0 T0`); 391 | send(`M140 S0`); 392 | send('M105'); 393 | } 394 | 395 | function nozzle_temp() { 396 | return parseInt($('nozzle_temp').value || '0'); 397 | } 398 | 399 | function nozzle2_temp() { 400 | return parseInt($('nozzle2_temp').value || '0'); 401 | } 402 | 403 | function filament_load() { 404 | if (alert_on_run()) return; 405 | send('G0 E700 F300'); 406 | } 407 | 408 | function filament_unload() { 409 | if (alert_on_run()) return; 410 | send('G0 E-700 F300'); 411 | } 412 | 413 | function print_next() { 414 | if (alert_on_run()) return; 415 | if (confirm(`start next job?`)) { 416 | send('*clear'); 417 | send('*kick'); 418 | } 419 | } 420 | 421 | function firmware_update(file) { 422 | if (alert_on_run()) return; 423 | if (file) { 424 | if (confirm(`update firmware using "${file}"?`)) { 425 | send(`*update ${file}`); 426 | } 427 | } else { 428 | if (confirm("update firmware?")) { 429 | send('*update'); 430 | } 431 | } 432 | } 433 | 434 | function controller_restart() { 435 | if (alert_on_run()) return; 436 | if (confirm("restart controller?")) { 437 | send('*exit'); 438 | } 439 | } 440 | 441 | function pause() { 442 | if (!last_set) return; 443 | if (!last_set.print) return; 444 | if (!last_set.print.run) return; 445 | if (last_set.print.pause) return; 446 | // if (confirm(`pause ${job_verb}?`)) { 447 | send('*pause'); 448 | // } 449 | } 450 | 451 | function resume() { 452 | if (!last_set) return; 453 | if (!last_set.print) return; 454 | if (!last_set.print.run) return; 455 | if (!last_set.print.pause) return; 456 | if (confirm(`resume ${job_verb}?`)) { 457 | send('*resume'); 458 | } 459 | } 460 | 461 | function cancel() { 462 | if (confirm(`cancel ${job_verb}?`)) { 463 | send('*cancel'); 464 | } 465 | } 466 | 467 | function estop() { 468 | send('*abort'); 469 | } 470 | 471 | function extrude(v) { 472 | if (alert_on_run()) return; 473 | if (mode === 'fdm') { 474 | gr(`E${jog_val} F250`); 475 | } 476 | if (mode === 'cnc') { 477 | jog('Z', 1); 478 | } 479 | } 480 | 481 | function topbar(b) { 482 | if (b) { 483 | persist.topbar = true; 484 | $('hdr_padd').style.display = 'flex'; 485 | $('hdr_devc').style.display = 'flex'; 486 | $('menu').classList.add('mtop'); 487 | $('pages').classList.add('mtop'); 488 | } else { 489 | persist.topbar = false; 490 | $('hdr_padd').style.display = 'none'; 491 | $('hdr_devc').style.display = 'none'; 492 | $('menu').classList.remove('mtop'); 493 | $('pages').classList.remove('mtop'); 494 | } 495 | } 496 | 497 | function retract(v) { 498 | if (alert_on_run()) return; 499 | if (mode === 'fdm') { 500 | gr(`E-${jog_val} F250`); 501 | } 502 | if (mode === 'cnc') { 503 | jog('Z', -1); 504 | } 505 | } 506 | 507 | function set_jog(val, el) { 508 | jog_val = val; 509 | if (last_jog) { 510 | last_jog.classList.remove('bg_yellow'); 511 | } 512 | if (el) { 513 | el.classList.add('bg_yellow'); 514 | last_jog = el; 515 | persist.jog_sel = el.id; 516 | } 517 | persist.jog_val = val; 518 | } 519 | 520 | function set_jog_speed(val, el) { 521 | jog_speed = val; 522 | if (last_jog_speed) { 523 | last_jog_speed.classList.remove('bg_yellow'); 524 | } 525 | el.classList.add('bg_yellow'); 526 | last_jog_speed = el; 527 | persist.jog_speed_sel = el.id; 528 | persist.jog_speed = val; 529 | } 530 | 531 | function jog(axis, dir) { 532 | if (alert_on_run()) return; 533 | gr(`${axis}${dir * jog_val} F${jog_speed}`); 534 | } 535 | 536 | function gr(msg) { 537 | send(`G91; G0 ${msg}; G90`); 538 | } 539 | 540 | function feed_dn() { 541 | send(`*feed ${last_set.feed - 0.05}; *status`); 542 | } 543 | 544 | function feed_up() { 545 | send(`*feed ${last_set.feed + 0.05}; *status`); 546 | } 547 | 548 | function feed_reset() { 549 | send(`*feed 1.0; *status`); 550 | } 551 | 552 | function send_confirm(message, what) { 553 | what = what || `send ${message}`; 554 | if (confirm(`${what}?`)) { 555 | send(message); 556 | } 557 | } 558 | 559 | function send_safe(message) { 560 | if (alert_on_run()) return; 561 | send(message); 562 | } 563 | 564 | function send(message) { 565 | if (ready) { 566 | // log({send: message}); 567 | message.split(";").map(v => v.trim()).forEach(m => sock.send(m)); 568 | } else { 569 | // log({queue: message}); 570 | queue.push(message); 571 | } 572 | } 573 | 574 | function cleanName(rname) { 575 | if (!rname) { 576 | return rname; 577 | } 578 | let name = rname.substring(rname.lastIndexOf("/")+1); 579 | let doti = name.lastIndexOf('.'); 580 | if (doti > 0) { 581 | name = name.substring(0,doti); 582 | } 583 | return name; 584 | } 585 | 586 | function init_filedrop() { 587 | var pages = $("pages"); 588 | var list = $("file-list-wrap"); 589 | 590 | document.addEventListener("dragover", function(evt) { 591 | event.preventDefault(); 592 | }); 593 | 594 | document.addEventListener("dragleave", function(evt) { 595 | event.preventDefault(); 596 | }); 597 | 598 | pages.addEventListener("dragover", function(evt) { 599 | evt.stopPropagation(); 600 | evt.preventDefault(); 601 | evt.dataTransfer.dropEffect = 'copy'; 602 | list.classList.add("bg_red"); 603 | menu_select("file"); 604 | }); 605 | 606 | pages.addEventListener("dragleave", function(evt) { 607 | evt.stopPropagation(); 608 | evt.preventDefault(); 609 | list.classList.remove("bg_red"); 610 | }); 611 | 612 | pages.addEventListener("drop", function(evt) { 613 | evt.stopPropagation(); 614 | evt.preventDefault(); 615 | 616 | list.classList.remove("bg_red"); 617 | 618 | var files = evt.dataTransfer.files; 619 | 620 | for (var i=0; i { 628 | return reply.text(); 629 | }).then(text => { 630 | console.log({text}); 631 | setTimeout(() => { 632 | send('*list'); 633 | }, 250); 634 | }); 635 | }; 636 | read.readAsBinaryString(file); 637 | } 638 | }); 639 | } 640 | 641 | function vids_update() { 642 | if (!last_set.device) { 643 | setTimeout(vids_update, 1000); 644 | return; 645 | } 646 | if (last_set.device.camera > 0) { 647 | let proto = location.protocol; 648 | let host = location.hostname; 649 | let port = last_set.device.camera; 650 | let html = ``; 651 | $('page-vids').innerHTML = html; 652 | return; 653 | } 654 | let time = Date.now(); 655 | let img = new Image(); 656 | // let url = `http://10.10.10.111/camera.jpg?time=${time}`; 657 | let url = `http://${location.hostname}:4080/camera.jpg?time=${time}`; 658 | let now = Date.now(); 659 | let frame = $('page-vids'); 660 | img.onload = () => { 661 | vids_timer = setTimeout(vids_update, 1000); 662 | frame.innerHTML = ''; 663 | frame.appendChild(img); 664 | let rect = frame.getBoundingClientRect(); 665 | let { width, height } = img; 666 | let arr = rect.width / rect.height; 667 | let ari = width / height; 668 | let rat = arr / ari; 669 | if (width > height) { 670 | img.style.height = "100%"; 671 | img.style.width = `${100 * rat}%`; 672 | } else { 673 | img.style.width = "100%"; 674 | img.style.height = `${100 * rat}%`; 675 | } 676 | vids_err = 0; 677 | }; 678 | img.onerror = () => { 679 | if (vids_err++ < 4) { 680 | setTimeout(vids_update, 500); 681 | } 682 | }; 683 | img.src = url; 684 | } 685 | 686 | let menu; 687 | let menu_named; 688 | let menu_selected; 689 | let page_selected; 690 | let vids_timer; 691 | 692 | function menu_select(key) { 693 | let menu = $(`menu-${key}`); 694 | if (menu_selected) { 695 | menu_selected.classList.remove("menu_sel"); 696 | } 697 | menu.classList.add("menu_sel") 698 | menu_selected = menu; 699 | menu_named = key; 700 | 701 | let page = $(`page-${key}`); 702 | if (page_selected) { 703 | page_selected.style.display = 'none'; 704 | } 705 | page.style.display = 'flex'; 706 | page_selected = page; 707 | persist.page = key; 708 | 709 | clearTimeout(vids_timer) 710 | 711 | if (key === 'vids') { 712 | vids_update(); 713 | } else if (last_set.device && last_set.device.camera > 0) { 714 | $('page-vids').innerHTML = ''; 715 | } 716 | if (key === 'comm') { 717 | $('command').focus(); 718 | } 719 | if (key === 'file') { 720 | send('*list'); 721 | } 722 | } 723 | 724 | function set_progress(val) { 725 | $('hdr_prog').innerText = `${val}%`; 726 | $('progress').value = `${val}%`; 727 | let rect = $('progress').getBoundingClientRect(); 728 | let pbar = $('progress-bar'); 729 | let pval = val ? rect.width * (val / 100) : 0; 730 | pbar.style.width = `${pval}px`; 731 | } 732 | 733 | function run_macro(key) { 734 | let macro = last_cfg.macros[key]; 735 | if (macro) { 736 | send(macro); 737 | console.log({run_macro: key, cmd: macro}); 738 | } 739 | } 740 | 741 | function del_macro(key) { 742 | delete last_cfg.macros[key]; 743 | set_config(); 744 | config_update(last_cfg); 745 | } 746 | 747 | function set_macro(key, value) { 748 | last_cfg.macros[key] = value; 749 | set_config(); 750 | config_update(last_cfg); 751 | } 752 | 753 | function add_macro() { 754 | set_macro($('new_macro').value, $('new_macro_value').value); 755 | } 756 | 757 | function set_config() { 758 | send(`*set-config ${encodeURIComponent(JSON.stringify(last_cfg))}`); 759 | } 760 | 761 | function render_temps() { 762 | let max = 50; 763 | for (let point of temphist) { 764 | let { temp } = point; 765 | max = Math.max(max, temp.ext[0] || 0); 766 | max = Math.max(max, temp.bed || 0); 767 | } 768 | let html = []; 769 | for (let point of temphist) { 770 | let { temp } = point; 771 | let bed = temp.bed || 0; 772 | let noz = temp.ext[0] || 0; 773 | let pct_bed = max > 0 ? (bed/max)*100 : 5; 774 | let pct_noz = max > 0 ? (noz/max)*100 : 5; 775 | html.push(`
`) 776 | html.push(`
`) 777 | } 778 | $('temps').innerHTML = html.join(''); 779 | } 780 | 781 | function config_update(config) { 782 | console.log({config}); 783 | // update macros list 784 | let list = Object.entries(config.macros).sort((a,b) => { 785 | return a[0] < b[0] ? -1 : 1; 786 | }); 787 | let pops = []; 788 | let html = []; 789 | for (let [key, val] of list) { 790 | pops.push(``); 791 | html.push(``); 792 | html.push(``); 793 | html.push(``); 794 | } 795 | html.push(``); 796 | html.push(``); 797 | html.push(``); 798 | 799 | $('hdr_macro').innerHTML = pops.join(''); 800 | 801 | $('macros').innerHTML = html.join(''); 802 | for (let inp of [...document.querySelectorAll("[class='tag']")]) { 803 | inp.onkeyup = (ev) => { 804 | if (ev.keyCode === 13) { 805 | set_macro(inp.getAttribute("key"), inp.value); 806 | } 807 | }; 808 | } 809 | } 810 | 811 | function status_update(status) { 812 | if (status.state) { 813 | let state = status.state; 814 | let pause = status.print.pause; 815 | if (pause) { 816 | if (typeof(pause) === 'string') { 817 | state = `${state} (paused ${pause})`; 818 | } else { 819 | state = `${state} (paused)`; 820 | } 821 | } else if (status.print.cancel) { 822 | state = `${state} (cancelled)`; 823 | } else if (status.print.abort) { 824 | state = `${state} (aborted)`; 825 | } 826 | $('state').value = state; 827 | $('hdr_stat').innerText = state; 828 | } 829 | if (status.print) { 830 | $('filename').value = cleanName(status.print.filename); 831 | set_progress(status.print.run ? status.print.progress : 0); 832 | set_progress(status.print.run ? status.print.progress : 0); 833 | if (status.print.clear) { 834 | $('clear-bed').classList.remove('bg_red'); 835 | } else { 836 | $('clear-bed').classList.add('bg_red'); 837 | } 838 | if (status.print.run) { 839 | $('state').classList.add('bg_green'); 840 | } else { 841 | $('state').classList.remove('bg_green'); 842 | } 843 | let duration = 0; 844 | if (status.print.end && status.print.end > status.print.start) { 845 | duration = status.print.end - status.print.start; 846 | } else if (status.print.prep || status.print.start) { 847 | duration = (status.print.mark || Date.now()) - status.print.start; 848 | } 849 | $('elapsed').value = elapsed(duration); 850 | } 851 | if (status.temp && status.now) { 852 | let last = 0; 853 | if (temphist.length) { 854 | last = temphist[temphist.length-1].time || 0; 855 | } 856 | if (status.now - last > 5000) { 857 | temphist.push({time: status.now, temp: status.temp}); 858 | while (temphist.length > 360) { 859 | temphist.shift(); 860 | } 861 | persist.temphist = JSON.stringify(temphist); 862 | render_temps(); 863 | } 864 | } 865 | if (status.temp && status.temp.ext) { 866 | if (status.temp.ext.length < 2) { 867 | $('nozzle2').style.display = 'none'; 868 | $('nozzle_label').innerText = 'Nozzle'; 869 | } else { 870 | $('nozzle2').style.display = ''; 871 | $('nozzle_label').innerText = 'Nozzle 1'; 872 | } 873 | } 874 | if (status.target) { 875 | if (status.target.bed > 0) { 876 | if ($('bed_temp') !== input) { 877 | $('bed_temp').value = status.target.bed; 878 | } 879 | $('bed_temp').classList.add('bg_red'); 880 | $('bed_toggle').innerText = 'off'; 881 | } else { 882 | if ($('bed_temp') !== input) { 883 | $('bed_temp').value = 0; 884 | } 885 | $('bed_temp').classList.remove('bg_red'); 886 | $('bed_toggle').innerText = 'on'; 887 | } 888 | $('bed_at').value = Math.round(status.temp.bed); 889 | $('hdr_bedd').innerText = Math.round(status.temp.bed); 890 | if (status.target.ext[0] > 0) { 891 | if ($('nozzle_temp') !== input) { 892 | $('nozzle_temp').value = status.target.ext[0]; 893 | } 894 | $('nozzle_temp').classList.add('bg_red'); 895 | $('nozzle_toggle').innerText = 'off'; 896 | } else { 897 | if ($('nozzle_temp') !== input) { 898 | $('nozzle_temp').value = 0; 899 | } 900 | $('nozzle_temp').classList.remove('bg_red'); 901 | $('nozzle_toggle').innerText = 'on'; 902 | } 903 | if (status.target.ext[1] > 0) { 904 | if ($('nozzle2_temp') !== input) { 905 | $('nozzle2_temp').value = status.target.ext[1]; 906 | } 907 | $('nozzle2_temp').classList.add('bg_red'); 908 | $('nozzle2_toggle').innerText = 'off'; 909 | } else { 910 | if ($('nozzle2_temp') !== input) { 911 | $('nozzle2_temp').value = 0; 912 | } 913 | $('nozzle2_temp').classList.remove('bg_red'); 914 | $('nozzle2_toggle').innerText = 'on'; 915 | } 916 | $('nozzle_at').value = Math.round(status.temp.ext[0]); 917 | $('nozzle2_at').value = Math.round(status.temp.ext[1] || -1); 918 | $('hdr_nozl').innerText = Math.round(status.temp.ext[0]); 919 | } 920 | if (status.pos) { 921 | $('xpos').value = parseFloat(status.pos.X).toFixed(2); 922 | $('ypos').value = parseFloat(status.pos.Y).toFixed(2); 923 | $('zpos').value = parseFloat(status.pos.Z).toFixed(2); 924 | } 925 | // highlight X,Y,Z pod label when @ origin 926 | if (status.settings && status.settings.offset && status.pos) { 927 | let off = status.settings.offset; 928 | let pos = status.pos; 929 | $('xpos').classList.remove('bg_green'); 930 | $('ypos').classList.remove('bg_green'); 931 | $('zpos').classList.remove('bg_green'); 932 | if (Math.abs(pos.X) + Math.abs(pos.Y) + Math.abs(pos.Z) < 0.1) { 933 | // highlight origin as green 934 | $('xpos').classList.add('bg_green'); 935 | $('ypos').classList.add('bg_green'); 936 | $('zpos').classList.add('bg_green'); 937 | } 938 | } 939 | if (status.estop && status.estop.min) { 940 | $('xpos').classList.remove('bg_yellow'); 941 | $('ypos').classList.remove('bg_yellow'); 942 | $('zpos').classList.remove('bg_yellow'); 943 | let min = status.estop.min; 944 | if (min.x === ' TRIGGERED') $('xpos').classList.add('bg_yellow'); 945 | if (min.y === ' TRIGGERED') $('ypos').classList.add('bg_yellow'); 946 | if (min.z === ' TRIGGERED') $('zpos').classList.add('bg_yellow'); 947 | } 948 | if (status.device) { 949 | let sd = status.device; 950 | if (sd.name) { 951 | let name = sd.name.split('.')[0] || 'GridBot'; 952 | document.title = `${name} | ${status.state}`;; 953 | } 954 | if (sd.grbl !== grbl) { 955 | grbl = sd.grbl; 956 | } 957 | if (sd.mode !== mode) { 958 | set_mode(mode = sd.mode); 959 | } 960 | if (sd.camera > 0) { 961 | // console.log('camera on port', sd.camera); 962 | } else if (sd.camera === true) { 963 | $('menu-vids').style.display = 'flex'; 964 | } else { 965 | $('menu-vids').style.display = 'none'; 966 | } 967 | $('hdr_devc').innerText = `${sd.version} [${sd.addr[0]}] [${sd.mode}] [${sd.name}]`; 968 | } 969 | if (status.feed && input !== $('feedscale')) { 970 | $('feedscale').value = `${Math.round(status.feed * 100)}%`; 971 | } 972 | } 973 | 974 | function set_mode(mode) { 975 | if (mode === 'cnc') { 976 | set_mode_cnc(); 977 | } 978 | if (mode === 'fdm') { 979 | set_mode_fdm(); 980 | } 981 | } 982 | 983 | function set_mode_cnc() { 984 | $('temps').style.display = 'none'; 985 | $('spacer').style.display = 'flex'; 986 | // home 987 | $('heating').style.display = 'none'; 988 | $('feedrate').style.display = ''; 989 | $('clear-bed').style.display = 'none'; 990 | // move 991 | $('zeros').style.display = ''; 992 | $('clear-origin').style.display = 'none'; 993 | $('up-z-probe').style.display = 'none'; 994 | // $('go-center').style.display = 'none'; 995 | $('jog-fdm').style.display = 'none'; 996 | $('jog-cnc').style.display = ''; 997 | $('abl').style.display = 'none'; 998 | // files 999 | run_verb = 'run gcode'; 1000 | job_verb = 'milling'; 1001 | let filego = $('file-go'); 1002 | if (filego.innerText !== 'install') { 1003 | filego.innerText = run_verb; 1004 | } 1005 | $('file-box').style.display = ''; 1006 | } 1007 | 1008 | function set_mode_fdm() { 1009 | $('temps').style.display = 'flex'; 1010 | $('spacer').style.display = 'none'; 1011 | // home 1012 | $('heating').style.display = ''; 1013 | $('feedrate').style.display = 'none'; 1014 | $('clear-bed').style.display = ''; 1015 | // move 1016 | $('zeros').style.display = 'none'; 1017 | $('clear-origin').style.display = ''; 1018 | $('up-z-probe').style.display = ''; 1019 | // $('go-center').style.display = ''; 1020 | $('jog-fdm').style.display = ''; 1021 | $('jog-cnc').style.display = 'none'; 1022 | $('abl').style.display = ''; 1023 | // files 1024 | run_verb = 'print'; 1025 | job_verb = 'print'; 1026 | let filego = $('file-go'); 1027 | if (filego.innerText !== 'install') { 1028 | filego.innerText = run_verb; 1029 | } 1030 | $('file-box').style.display = 'none'; 1031 | } 1032 | 1033 | function bind_arrow_keys() { 1034 | document.addEventListener("keydown", function(evt) { 1035 | if (menu_named === "move" || menu_named === "vids") { 1036 | let shift = evt.shiftKey; 1037 | switch (evt.key) { 1038 | case 'x': 1039 | send_safe("G28 X"); 1040 | break; 1041 | case 'y': 1042 | send_safe("G28 Y"); 1043 | break; 1044 | case "ArrowLeft": 1045 | jog('X', -1); 1046 | break; 1047 | case "ArrowRight": 1048 | jog('X', 1); 1049 | break; 1050 | case "ArrowUp": 1051 | jog(shift ? 'Z' : 'Y', 1); 1052 | break; 1053 | case "ArrowDown": 1054 | jog(shift ? 'Z' : 'Y', -1); 1055 | break; 1056 | } 1057 | } 1058 | }); 1059 | } 1060 | 1061 | function commlog(msg) { 1062 | logmsg.push(`[${moment().format("HH:mm:ss")}] ${msg.trim()}`); 1063 | while (logmsg.length > 200) { 1064 | logmsg.shift(); 1065 | } 1066 | $('comm-log').innerHTML = logmsg.join('
'); 1067 | $('comm-log').scrollTop = $('comm-log').scrollHeight; 1068 | } 1069 | 1070 | async function getPorts() { 1071 | return await serial.getPorts(); 1072 | } 1073 | 1074 | function renderPorts(ports, selected) { 1075 | let html = [ '' ]; 1076 | for (let i=0; iPort ${i+1}`); 1078 | } 1079 | $('serial-port').innerHTML = html.join(''); 1080 | } 1081 | 1082 | function getSelectedPort() { 1083 | let list = $('serial-port'); 1084 | return list.options[list.selectedIndex].value; 1085 | } 1086 | 1087 | function getSelectedBaud() { 1088 | let baud = $('serial-baud'); 1089 | return baud.options[baud.selectedIndex].value; 1090 | } 1091 | 1092 | function init_port() { 1093 | init_port_async() 1094 | .then(() => { 1095 | // console.log('init port'); 1096 | }) 1097 | .catch(err => { 1098 | console.log({err}); 1099 | }); 1100 | } 1101 | 1102 | async function init_port_async() { 1103 | let portnum = getSelectedPort(); 1104 | let ports, port; 1105 | 1106 | if (portnum === 'add') { 1107 | port = await serial.requestPort(); 1108 | if (port) { 1109 | ports = await getPorts(); 1110 | portnum = ports.indexOf(port); 1111 | renderPorts(ports, portnum); 1112 | } 1113 | } else { 1114 | portnum = parseInt(portnum); 1115 | if (portnum >= 0) { 1116 | ports = await getPorts(); 1117 | port = ports[portnum]; 1118 | } 1119 | } 1120 | 1121 | if (port && ports && portnum >= 0) { 1122 | send(`*port ${portnum} ${getSelectedBaud()}`); 1123 | } 1124 | } 1125 | 1126 | function init_work() { 1127 | set_mode('fdm'); 1128 | set_progress(0); 1129 | menu_select('conf'); 1130 | $('menu-vids').style.display = 'none'; 1131 | sock = new Worker("serial.js"); 1132 | sock.onmessage = (msg) => { 1133 | console.log("worker said", msg.data); 1134 | ready = true; 1135 | }; 1136 | sock.send = (data) => { 1137 | sock.postMessage(data); 1138 | }; 1139 | getPorts().then(renderPorts); 1140 | } 1141 | 1142 | function init_sock() { 1143 | let timeout = null; 1144 | sock = new WebSocket(`ws://${document.location.hostname}:4080`); 1145 | sock.onopen = (evt) => { 1146 | if (ready) { 1147 | return; 1148 | } 1149 | // log({wss_open: true}); 1150 | ready = true; 1151 | success = true; 1152 | while (queue.length) { 1153 | send(queue.shift()); 1154 | } 1155 | interval = setInterval(() => { 1156 | send('*status'); 1157 | }, 1000); 1158 | send('*status;*list;*config'); 1159 | }; 1160 | sock.onclose = (evt) => { 1161 | if (!success) { 1162 | return; 1163 | } 1164 | log({wss_close: true}); 1165 | clearInterval(interval); 1166 | if (timeout != null) { 1167 | return; 1168 | } 1169 | sock = null; 1170 | ready = false; 1171 | timeout = setTimeout(init, 1000); 1172 | $('state').value = 'server disconnected'; 1173 | }; 1174 | sock.onerror = (evt) => { 1175 | // if no server-side success, fall back to worker 1176 | if (!success && serial) { 1177 | return init_work(); 1178 | } 1179 | log({wss_error: true}); 1180 | if (timeout != null) { 1181 | return; 1182 | } 1183 | sock = null; 1184 | ready = false; 1185 | timeout = setTimeout(init, 1000); 1186 | $('state').value = 'no server connection'; 1187 | }; 1188 | } 1189 | 1190 | function init() { 1191 | // bind left menu items and select default 1192 | menu = { 1193 | home: $('menu-home'), 1194 | move: $('menu-move'), 1195 | file: $('menu-file'), 1196 | comm: $('menu-comm'), 1197 | vids: $('menu-vids'), 1198 | ctrl: $('menu-ctrl'), 1199 | // conf: $('menu-conf') 1200 | }; 1201 | for (name in menu) { 1202 | let key = name.split('-')[0]; 1203 | menu[name].ontouchstart = menu[name].onmousedown = () => { 1204 | menu_select(key); 1205 | }; 1206 | } 1207 | menu_select(persist.page || 'home'); 1208 | 1209 | init_sock(); 1210 | 1211 | sock.onmessage = (evt) => { 1212 | let msg = unescape(evt.data); 1213 | let spos = msg.indexOf("*** "); 1214 | let epos = msg.lastIndexOf(" ***"); 1215 | if (msg.indexOf("*** {") >= 0) { 1216 | let obj = JSON.parse(msg.substring(spos+4, epos)); 1217 | if (obj.state || obj.update) { 1218 | status_update(last_set = obj); 1219 | } else if (obj.config) { 1220 | config_update(last_cfg = obj.config); 1221 | } else { 1222 | commlog(JSON.stringify(obj)); 1223 | } 1224 | } else if (msg.indexOf("*** [") >= 0) { 1225 | let list = $('file-list'); 1226 | let html = []; 1227 | let trim = msg.trim().substring(spos+4, epos); 1228 | let time = Date.now(); 1229 | files = {}; 1230 | JSON.parse(trim).forEach(file => { 1231 | if (typeof(file) === 'string') { 1232 | if (file.charAt(0) === "/") { 1233 | return; 1234 | } 1235 | let [ name, size ] = file.split(' '); 1236 | let lsi = file.lastIndexOf('/'); 1237 | let lpi = file.lastIndexOf('.'); 1238 | let base = name.substring(lsi + 1, lpi); 1239 | let ext = name.substring(lpi + 1); 1240 | file = { 1241 | name, 1242 | ext, 1243 | time, 1244 | size: parseInt(size), 1245 | loc: "SD" 1246 | }; 1247 | } 1248 | let uuid = (time++).toString(36); 1249 | let ext = file.ext.toLowerCase().charAt(0); 1250 | let name = cleanName(file.name); 1251 | let cname = ext === 'g' ? name : [name,file.ext].join('.'); 1252 | files[name] = file; 1253 | file.uuid = uuid; 1254 | html.push(`
`); 1255 | }); 1256 | list.innerHTML = html.join(''); 1257 | } else if (msg.indexOf("***") >= 0) { 1258 | try { 1259 | log({wss_msg: msg}); 1260 | commlog(msg); 1261 | } catch (e) { 1262 | log({wss_msg: evt, err: e}); 1263 | } 1264 | } else { 1265 | commlog(msg); 1266 | } 1267 | }; 1268 | let setbed = $('bed_temp').onkeyup = ev => { 1269 | if (ev === 42 || ev.keyCode === 13) { 1270 | send('M140 S' + bed_temp()); 1271 | send('M105'); 1272 | $('bed_toggle').innerText = 'off'; 1273 | input_deselect(); 1274 | } 1275 | }; 1276 | let setnozzle = $('nozzle_temp').onkeyup = ev => { 1277 | if (ev === 42 || ev.keyCode === 13) { 1278 | send(`M104 S${nozzle_temp()} T0`); 1279 | send('M105'); 1280 | $('nozzle_toggle').innerText = 'off'; 1281 | input_deselect(); 1282 | } 1283 | }; 1284 | let setnozzle2 = $('nozzle2_temp').onkeyup = ev => { 1285 | if (ev === 42 || ev.keyCode === 13) { 1286 | send(`M104 S${nozzle2_temp()} T1`); 1287 | send('M105'); 1288 | $('nozzle2_toggle').innerText = 'off'; 1289 | input_deselect(); 1290 | } 1291 | }; 1292 | $('feedscale').onclick = ev => { 1293 | input = $('feedscale'); 1294 | input.classList.add('bg_green'); 1295 | ev.stopPropagation(); 1296 | }; 1297 | $('feedscale').onkeyup = ev => { 1298 | if (ev.keyCode === 13) { 1299 | let val = $('feedscale').value.replace('%','').trim(); 1300 | val = Math.min(2,Math.max(0.1,parseInt(val) / 100.0)); 1301 | input_deselect(); 1302 | send(`*feed ${val}; *status`); 1303 | } 1304 | }; 1305 | $('send').onclick = $('command').onkeyup = ev => { 1306 | if (ev.type === 'click' || ev.keyCode === 13) { 1307 | let cmd = $('command').value.trim(); 1308 | if (cmd.indexOf('url ') === 0) { 1309 | window.location = cmd.substring(4); 1310 | } else { 1311 | send(cmd); 1312 | } 1313 | $('command').value = ''; 1314 | } 1315 | }; 1316 | $('clear').onmousedown = () => { 1317 | logmsg = []; 1318 | $('comm-log').innerHTML = ''; 1319 | $('command').focus(); 1320 | }; 1321 | let input_deselect = document.body.onclick = (ev) => { 1322 | if (input) { 1323 | input.classList.remove('bg_green'); 1324 | input = null; 1325 | } 1326 | $('keypad').style.display = 'none'; 1327 | }; 1328 | $('nozzle_temp').onmousedown = (ev) => { 1329 | input_deselect(); 1330 | if (istouch) { 1331 | $('keypad').style.display = ''; 1332 | $('nozzle_temp').setSelectionRange(10, 10); 1333 | } 1334 | input = $('nozzle_temp'); 1335 | input.classList.add('bg_green'); 1336 | if (input.value === '0') { 1337 | input.value = persist.default_nozzle || '220'; 1338 | } 1339 | ev.stopPropagation(); 1340 | }; 1341 | $('nozzle_temp').ondblclick = (ev) => { 1342 | let sel = $('nozzle_temp'); 1343 | if (sel.value !== '0' && confirm('set default nozzle temp')) { 1344 | persist.default_nozzle = sel.value; 1345 | } 1346 | } 1347 | $('nozzle2_temp').onmousedown = (ev) => { 1348 | input_deselect(); 1349 | if (istouch) { 1350 | $('keypad').style.display = ''; 1351 | $('nozzle2_temp').setSelectionRange(10, 10); 1352 | } 1353 | input = $('nozzle2_temp'); 1354 | input.classList.add('bg_green'); 1355 | if (input.value === '0') { 1356 | input.value = persist.default_nozzle || '220'; 1357 | } 1358 | ev.stopPropagation(); 1359 | }; 1360 | $('bed_temp').onmousedown = (ev) => { 1361 | input_deselect(); 1362 | if (istouch) { 1363 | $('keypad').style.display = ''; 1364 | $('bed_temp').setSelectionRange(10, 10); 1365 | } 1366 | input = $('bed_temp'); 1367 | input.classList.add('bg_green'); 1368 | if (input.value === '0') { 1369 | input.value = persist.default_bed || '55'; 1370 | } 1371 | ev.stopPropagation(); 1372 | }; 1373 | $('bed_temp').ondblclick = (ev) => { 1374 | let sel = $('bed_temp'); 1375 | if (sel.value !== '0' && confirm('set default bed temp')) { 1376 | persist.default_bed = sel.value; 1377 | } 1378 | } 1379 | for (let i=0; i<10; i++) { 1380 | $(`kp-${i}`).onmousedown = (ev) => { 1381 | if (input) { 1382 | input.value += i; 1383 | ev.stopPropagation(); 1384 | } 1385 | }; 1386 | } 1387 | $('kp-bs').onmousedown = (ev) => { 1388 | if (input) { 1389 | input.value = input.value.substring(0,input.value.length-1); 1390 | ev.stopPropagation(); 1391 | } 1392 | }; 1393 | $('kp-ok').onmousedown = (ev) => { 1394 | if (input === $('bed_temp')) { 1395 | setbed(42); 1396 | } 1397 | if (input === $('nozzle_temp')) { 1398 | setnozzle(42); 1399 | } 1400 | ev.stopPropagation(); 1401 | }; 1402 | // reload page on status click 1403 | $('page-home').onmousedown = ev => { 1404 | if (ev.target.id === 'state') { 1405 | reload(); 1406 | } 1407 | }; 1408 | // disable autocomplete 1409 | let inputs = document.getElementsByTagName('input'); 1410 | for (let i=0; i { 1421 | topbar(!eval(persist.topbar)); 1422 | }; 1423 | render_temps(); 1424 | } 1425 | -------------------------------------------------------------------------------- /src/web/moment.js: -------------------------------------------------------------------------------- 1 | ../../node_modules/moment/moment.js -------------------------------------------------------------------------------- /src/web/serial.js: -------------------------------------------------------------------------------- 1 | // serial port worker 2 | let serial = self.navigator ? self.navigator.serial : undefined; 3 | let port; 4 | 5 | if (!serial) { 6 | console.log('no serial support'); 7 | } else { 8 | init().catch(err => { 9 | console.log({err}); 10 | }); 11 | } 12 | 13 | async function init() { 14 | console.log('init serial', serial); 15 | } 16 | 17 | function getPorts() { 18 | serial.getPorts() 19 | .then(ports => { 20 | send(ports.length); 21 | }) 22 | .catch(err => { 23 | console.log({err}); 24 | }); 25 | } 26 | 27 | function openPort(portnum, baudRate) { 28 | serial.getPorts() 29 | .then(ports => { 30 | port = ports[portnum]; 31 | return port.open({ baudRate }); 32 | }) 33 | .then(abc => { 34 | send(`*open ${portnum}`); 35 | }) 36 | .catch(err => { 37 | console.log({err}); 38 | }); 39 | } 40 | 41 | function send(msg) { 42 | switch (typeof msg) { 43 | case 'object': 44 | postMessage(JSON.stringify(msg)); 45 | break; 46 | default: 47 | postMessage(msg); 48 | break; 49 | } 50 | } 51 | 52 | self.onmessage = (msg) => { 53 | console.log('index said', msg.data); 54 | let data = msg.data.toString(); 55 | let toks = data.split(' '); 56 | switch (toks[0]) { 57 | case '*ports': 58 | getPorts(); 59 | break; 60 | case '*port': 61 | openPort(parseInt(toks[1]) || 0, parseInt(toks[2]) || 9600); 62 | break; 63 | } 64 | }; 65 | 66 | send('*ready'); 67 | -------------------------------------------------------------------------------- /start-root.sh: -------------------------------------------------------------------------------- 1 | bin/start-root.sh --------------------------------------------------------------------------------