- Added helful info to Video tab
- Changed "Console" tab to "Messages"
- Removed spin up/down velocity options, they don't do anything
+ - Allow RS485 to work when wires are swapped
+ - Allow setting VFD ID
+ - Only show relavant spindle config items
+ - More robust video camera reset
+ - Added help page
+ - Allow upgrade with out Internet
+ - Limit power fault reporting
+ - Added load over temp, load limiting and motor overload power faults
## v0.3.6
- Set max_usb_current=1 in /boot/config.txt from installer #103
HOST=bbctrl.local
endif
+ifndef PASSWORD
+PASSWORD=buildbotics
+endif
+
ifndef DEST
DEST=mnt
endif
update: pkg
http_proxy= curl -i -X PUT -H "Content-Type: multipart/form-data" \
- -F "firmware=@dist/$(PKG_NAME).tar.bz2" \
+ -F "firmware=@dist/$(PKG_NAME).tar.bz2" -F "password=$(PASSWORD)" \
http://$(HOST)/api/firmware/update
mount:
'scripts/update-bbctrl',
'scripts/upgrade-bbctrl',
'scripts/sethostname',
+ 'scripts/reset-video',
],
install_requires = 'tornado sockjs-tornado pyserial pyudev smbus2'.split(),
zip_safe = False,
sent, received, ha.response_length);
}
+ // Try changing pin polarity
+ PINCTRL_PIN(RS485_RO_PIN) ^= PORT_INVEN_bm;
+ PINCTRL_PIN(RS485_DI_PIN) ^= PORT_INVEN_bm;
+
hy_reset();
}
}
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
include ../../build/hashes.jade
li.pure-menu-heading
a.pure-menu-link(href="#admin") Admin
+ li.pure-menu-heading
+ a.pure-menu-link(href="#help") Help
+
#main
.header
.header-content
button.pure-button.pure-button-primary(@click="upgrade_confirmed")
| Upgrade
+ message(:show.sync="confirmUpload")
+ h3(slot="header") Upload Firmware?
+ div(slot="body")
+ p Are you sure you want to upload firmware <em>{{firmwareName}}</em>?
+
+ p.pure-control-group
+ label(for="pass") Password
+ input(name="pass", v-model="password", type="password")
+
+ div(slot="footer")
+ button.pure-button(@click="confirmUpload=false") Cancel
+ button.pure-button.pure-button-primary(@click="upload_confirmed")
+ | Upload
+
message(:show.sync="firmwareUpgrading")
h3(slot="header") Firmware upgrading
p(slot="body") Please wait...
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#admin-view-template(type="text/x-template")
#admin
h2 Firmware
button.pure-button.pure-button-primary(@click="check") Check
button.pure-button.pure-button-primary(@click="upgrade") Upgrade
+ label.pure-button.pure-button-primary.file-upload
+ input(type="file", accept=".tar.bz2", @change="upload")
+ | Upload
p
input(type="checkbox", v-model="autoCheckUpgrade",
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#axis-control-template(type="text/x-template")
svg(xmlns="http://www.w3.org/2000/svg",
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#console-template(type="text/x-template")
.console
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#control-view-template(type="text/x-template")
#control
section#content6.tab-content
.video
- img.reload(src="/images/reload.png", @click="load_video",
+ img.reload(src="/images/reload.png", @click="reload_video",
title="Reload video")
img.mjpeg(:src="video_url")
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#estop-template(type="text/x-template")
svg(version="1.1", xmlns:svg="http://www.w3.org/2000/svg",
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#gcode-view-template(type="text/x-template")
#gcode
--- /dev/null
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
+
+script#help-view-template(type="text/x-template")
+ #help
+ h2 User Manual
+ p
+ | You can find a detailed user manual at <a
+ | href="http://docs.buildbotics.com" target="_blank"
+ | >docs.buildbotics.com</a>.
+
+ h2 Discussion Forum
+ p
+ | If you're having trouble or just want to chat with other Buildbotics
+ | CNC controller owners, head over to the Buildbotics forum at
+ | <a href="http://forum.buildbotics.com" target="_blank"
+ | >forum.buildbotics.com</a>. Register on the site and post a message.
+ | We'll be happy to help.
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#indicators-template(type="text/x-template")
.indicators
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#io-view-template(type="text/x-template")
#io
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#message-template(type="text/x-template")
.modal-mask(v-show="show", transition="modal")
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#motor-view-template(type="text/x-template")
#motor
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#templated-input-template(type="text/x-template")
.pure-control-group(class="tmpl-input-{{name}}",
- title="Default {{template.default}} {{template.unit}}")
+ title="Default {{template.default}} {{template.unit || ''}}")
label(:for="name") {{name}}
select(v-if="template.type == 'enum' || template.values", v-model="model",
-////////////////////////////////////////////////////////////////////////////////
-// //
-// This file is part of the Buildbotics firmware. //
-// //
-// Copyright (c) 2015 - 2018, Buildbotics LLC //
-// All rights reserved. //
-// //
-// This file ("the software") is free software: you can redistribute it //
-// and/or modify it under the terms of the GNU General Public License, //
-// version 2 as published by the Free Software Foundation. You should //
-// have received a copy of the GNU General Public License, version 2 //
-// along with the software. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// The software is distributed in the hope that it will be useful, but //
-// WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
-// Lesser General Public License for more details. //
-// //
-// You should have received a copy of the GNU Lesser General Public //
-// License along with the software. If not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-// For information regarding this software email: //
-// "Joseph Coffland" <joseph@buildbotics.com> //
-// //
-////////////////////////////////////////////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////
+//- //
+//- This file is part of the Buildbotics firmware. //
+//- //
+//- Copyright (c) 2015 - 2018, Buildbotics LLC //
+//- All rights reserved. //
+//- //
+//- This file ("the software") is free software: you can redistribute it //
+//- and/or modify it under the terms of the GNU General Public License, //
+//- version 2 as published by the Free Software Foundation. You should //
+//- have received a copy of the GNU General Public License, version 2 //
+//- along with the software. If not, see <http://www.gnu.org/licenses/>. //
+//- //
+//- The software is distributed in the hope that it will be useful, but //
+//- WITHOUT ANY WARRANTY; without even the implied warranty of //
+//- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
+//- Lesser General Public License for more details. //
+//- //
+//- You should have received a copy of the GNU Lesser General Public //
+//- License along with the software. If not, see //
+//- <http://www.gnu.org/licenses/>. //
+//- //
+//- For information regarding this software email: //
+//- "Joseph Coffland" <joseph@buildbotics.com> //
+//- //
+//-/////////////////////////////////////////////////////////////////////////////
script#tool-view-template(type="text/x-template")
#tool
- h1 Spindle Configuration
+ h1 Tool Configuration
form.pure-form.pure-form-aligned
fieldset
templated-input(v-for="templ in template.tool", :name="$key",
:model.sync="tool[$key]", :template="templ")
+
+ div(v-if="tool['spindle-type'] == 'PWM'")
+ h2 PWM Spindle
+ form.pure-form.pure-form-aligned
+ fieldset
+ templated-input(v-for="templ in template['pwm-spindle']",
+ :name="$key", :model.sync="pwmSpindle[$key]", :template="templ")
+
+ div(v-if="tool['spindle-type'] == 'HUANYANG'")
+ h2 Huanyang VFD Spindle
+ form.pure-form.pure-form-aligned
+ fieldset
+ templated-input(v-for="templ in template['huanyang-spindle']",
+ :name="$key", :model.sync="huanyangSpindle[$key]",
+ :template="templ")
upgrade: function () {this.$dispatch('upgrade')},
+ upload: function (e) {
+ var files = e.target.files || e.dataTransfer.files;
+ if (!files.length) return;
+ this.$dispatch('upload', files[0]);
+ },
+
+
change_auto_check_upgrade: function () {
this.config.admin['auto-check-upgrade'] = this.autoCheckUpgrade;
this.$dispatch('config-changed');
errorShow: false,
errorMessage: '',
confirmUpgrade: false,
+ confirmUpload: false,
firmwareUpgrading: false,
checkedUpgrade: false,
+ firmwareName: '',
latestVersion: '',
password: ''
}
'tool-view': require('./tool-view'),
'io-view': require('./io-view'),
'gcode-view': require('./gcode-view'),
- 'admin-view': require('./admin-view')
+ 'admin-view': require('./admin-view'),
+ 'help-view': {template: '#help-view-template'}
},
},
+ upload: function (firmware) {
+ this.firmware = firmware;
+ this.firmwareName = firmware.name;
+ this.password = '';
+ this.confirmUpload = true;
+ },
+
+
error: function (msg) {
// Honor user error blocking
if (Date.now() - this.errorTimeoutStart < this.errorTimeout * 1000)
},
+ upload_confirmed: function () {
+ this.confirmUpload = false;
+
+ var form = new FormData();
+ form.append('firmware', this.firmware);
+ if (this.password) form.append('password', this.password);
+
+ $.ajax({
+ url: '/api/firmware/update',
+ type: 'PUT',
+ data: form,
+ cache: false,
+ contentType: false,
+ processData: false
+
+ }).success(function () {
+ this.firmwareUpgrading = true;
+
+ }.bind(this)).error(function () {
+ alert('Invalid password or bad firmware');
+ }.bind(this))
+ },
+
+
show_upgrade: function () {
if (!this.latestVersion) return false;
return compare_versions(this.config.version, this.latestVersion) < 0;
load_video: function () {
this.video_url = '//' + document.location.hostname + ':8000/stream/0?=' +
Math.random();
+ },
+
+
+ reload_video: function () {
+ if (typeof this.lastVideoReset != 'undefined' &&
+ Date.now() - this.lastVideoReset < 15000) return;
+
+ this.lastVideoReset = Date.now();
+ api.put('video/reload');
+ setTimeout(this.load_video, 4000);
}
}
}
data: function () {
return {
- tool: {}
+ tool: {},
+ pwmSpindle: {},
+ huanyangSpindle: {}
}
},
},
- ready: function () {
- this.update();
- },
+ ready: function () {this.update()},
methods: {
update: function () {
Vue.nextTick(function () {
+ // Tool
if (this.config.hasOwnProperty('tool'))
this.tool = this.config.tool;
for (var key in template)
if (!this.tool.hasOwnProperty(key))
this.$set('tool["' + key + '"]', template[key].default);
+
+ // PWM
+ if (this.config.hasOwnProperty('pwm-spindle'))
+ this.pwmSpindle = this.config['pwm-spindle'];
+
+ template = this.template['pwm-spindle'];
+ for (key in template)
+ if (!this.pwmSpindle.hasOwnProperty(key))
+ this.$set('pwmSpindle["' + key + '"]', template[key].default);
+
+ // Huanyang
+ if (this.config.hasOwnProperty('huanyang-spindle'))
+ this.huanyangSpindle = this.config['huanyang-spindle'];
+
+ template = this.template['huanyang-spindle'];
+ for (key in template)
+ if (!this.huanyangSpindle.hasOwnProperty(key))
+ this.$set('huanyangSpindle["' + key + '"]', template[key].default);
}.bind(this));
}
}
#define VOLTAGE_MIN 11
#define VOLTAGE_MAX 39
#define CURRENT_MAX 25
+#define LOAD_CURRENT_MAX 10.5
+#define CURRENT_OVERTEMP 14 // Should read ~21A but over 11.86A is faulty
+#define LOAD_LIMIT_TICKS 10
#define VOLTAGE_SETTLE_COUNT 5
#define VOLTAGE_SETTLE_PERIOD 20 // ms
#define VOLTAGE_SETTLE_TOLERANCE 0.01
OVER_CURRENT_FLAG = 1 << 2,
MEASUREMENT_ERROR_FLAG = 1 << 3,
SHUNT_OVERLOAD_FLAG = 1 << 4,
+ MOTOR_OVERLOAD_FLAG = 1 << 5,
+
+ // Non fatal
+ LOAD1_OVERTEMP_FLAG = 1 << 6,
+ LOAD2_OVERTEMP_FLAG = 1 << 7,
+ LOAD1_LIMITING_FLAG = 1 << 8,
+ LOAD2_LIMITING_FLAG = 1 << 9,
};
+
+
+#define FATAL_FLAG_MASK ((1 << 6) - 1)
#include <stdbool.h>
+typedef struct {
+ regs_t reg;
+ uint8_t pin;
+ uint8_t limit;
+ uint8_t count;
+ bool shutdown;
+} load_t;
+
+load_t loads[2] = {
+ {LOAD1_REG, LOAD1_PIN, 0, 0, false},
+ {LOAD2_REG, LOAD2_PIN, 0, 0, false},
+};
+
+
static const uint8_t ch_schedule[] = {
TEMP_ADC, VOUT_ADC,
VIN_ADC, VOUT_ADC,
static volatile uint16_t regs[NUM_REGS] = {0};
static volatile uint64_t time = 0; // ms
+static volatile bool motor_overload = false;
static volatile bool shunt_overload = false;
static volatile float shunt_ms_power = 0;
static volatile float vnom = 0;
}
+static void check_load(load_t *load) {
+ if (load->shutdown) return;
+
+ // Check overtemp
+ if (CURRENT_OVERTEMP * 100 < regs[load->reg]) {
+ IO_PORT_CLR(load->pin); // Lo
+ IO_DDR_SET(load->pin); // Output
+ load->shutdown = true;
+ }
+
+ // Check and adjust limit
+ if (LOAD_CURRENT_MAX * 100 < regs[load->reg]) {
+ if (load->limit < LOAD_LIMIT_TICKS) load->limit++;
+ } else if (load->limit) load->limit--;
+}
+
+
+void limit_load(load_t *load) {
+ if (load->shutdown) return;
+
+ // Limit
+ if (load->count < load->limit) {
+ IO_PORT_CLR(load->pin); // Lo
+ IO_DDR_SET(load->pin); // Output
+
+ } else IO_DDR_CLR(load->pin); // Float
+
+ if (++load->count == LOAD_LIMIT_TICKS) load->count = 0;
+}
+
+
ISR(TIMER0_OVF_vect) {
static uint8_t tick = 0;
+
+ // Calling these too fast disrupts the I2C bus
+ if ((tick & 3) == 0) limit_load(&loads[0]);
+ if ((tick & 3) == 2) limit_load(&loads[1]);
+
if (++tick == 31) {
time++;
tick = 0;
case TEMP_ADC: regs[TEMP_REG] = data; break; // in Kelvin
case VIN_ADC: regs[VIN_REG] = convert_voltage(data); break;
case VOUT_ADC: regs[VOUT_REG] = convert_voltage(data); break;
- case CS1_ADC: regs[MOTOR_REG] = convert_current(data); break;
- case CS2_ADC: regs[VDD_REG] = convert_current(data); break;
- case CS3_ADC: regs[LOAD2_REG] = convert_current(data); break;
- case CS4_ADC: regs[LOAD1_REG] = convert_current(data); break;
+
+ case CS1_ADC:
+ regs[MOTOR_REG] = convert_current(data);
+ if (CURRENT_OVERTEMP * 100 < regs[MOTOR_REG]) motor_overload = true;
+ break;
+
+ case CS2_ADC: regs[VDD_REG] = convert_current(data); break;
+
+ case CS3_ADC:
+ regs[LOAD2_REG] = convert_current(data);
+ check_load(&loads[1]);
+ break;
+
+ case CS4_ADC:
+ regs[LOAD1_REG] = convert_current(data);
+ check_load(&loads[0]);
+ break;
}
}
TCCR0B = TCCR1B = 0;
// Disable outputs
- IO_DDR_CLR(SHUNT_PIN);
- IO_DDR_CLR(MOTOR_PIN);
- IO_PORT_CLR(LOAD1_PIN);
- IO_PORT_CLR(LOAD2_PIN);
- IO_DDR_SET(LOAD1_PIN);
- IO_DDR_SET(LOAD2_PIN);
+ IO_DDR_CLR(SHUNT_PIN); // Input
+ IO_DDR_CLR(MOTOR_PIN); // Input
+ IO_PORT_CLR(LOAD1_PIN); // Lo
+ IO_PORT_CLR(LOAD2_PIN); // Lo
+ IO_DDR_SET(LOAD1_PIN); // Output
+ IO_DDR_SET(LOAD2_PIN); // Output
while (true) continue;
}
if (VOLTAGE_MAX < vin || VOLTAGE_MAX < vout) flags |= OVER_VOLTAGE_FLAG;
if (CURRENT_MAX < get_total_current()) flags |= OVER_CURRENT_FLAG;
if (shunt_overload) flags |= SHUNT_OVERLOAD_FLAG;
+ if (motor_overload) flags |= MOTOR_OVERLOAD_FLAG;
+ if (loads[0].shutdown) flags |= LOAD1_OVERTEMP_FLAG;
+ if (loads[1].shutdown) flags |= LOAD2_OVERTEMP_FLAG;
+ if (loads[0].limit) flags |= LOAD1_LIMITING_FLAG;
+ if (loads[1].limit) flags |= LOAD2_LIMITING_FLAG;
- if (flags) shutdown(flags);
+ if (flags & FATAL_FLAG_MASK) shutdown(flags);
}
return 0;
ctrl.ioloop.READ)
self.i2c_addr = ctrl.args.avr_addr
+ self._queue_command(Cmd.REBOOT)
def _is_busy(self): return self.ctrl.planner.is_running()
continue
+ # AVR logging
+ if 'msg' in msg:
+ level = msg.get('level', 'info')
+ if 'where' in msg: extra = {'where': msg}
+ else: extra = None
+ msg = msg['msg']
+
+ if level == 'info': log.info(msg, extra)
+ elif level == 'debug': log.debug(msg, extra)
+ elif level == 'warning': log.warning(msg, extra)
+ elif level == 'error': log.error(msg, extra)
+
+ continue
+
update.update(msg)
if update:
row += 1
# Show tool, units, feed and speed
- # TODO Units not in state
- if 't' in update: self.lcd_page.text('%2uT' % update['t'], 6, 1)
- if 'u' in update: self.lcd_page.text('%-6s' % update['u'], 0, 1)
- if 'f' in update: self.lcd_page.text('%8uF' % update['f'], 0, 2)
- if 's' in update: self.lcd_page.text('%8dS' % update['s'], 0, 3)
+ if 'tool' in update: self.lcd_page.text('%2uT' % update['tool'], 6, 1)
+ if 'units' in update: self.lcd_page.text('%-6s' % update['units'], 0, 1)
+ if 'feed' in update: self.lcd_page.text('%8uF' % update['feed'], 0, 2)
+ if 'speed' in update: self.lcd_page.text('%8dS' % update['speed'], 0, 3)
def connect(self):
log = logging.getLogger('Cmd')
-# TODO, sync this up with AVR code
-SET = '$'
-SET_SYNC = '#'
-SEEK = 's'
-LINE = 'l'
-REPORT = 'r'
-PAUSE = 'P'
-UNPAUSE = 'U'
-ESTOP = 'E'
-CLEAR = 'C'
-FLUSH = 'F'
-STEP = 'S'
-RESUME = 'c'
+# Keep this in sync with AVR code command.def
+SET = '$'
+SET_SYNC = '#'
+SEEK = 's'
+LINE = 'l'
+DWELL = 'd'
+OUTPUT = 'o'
+OPT_PAUSE = 'p'
+PAUSE = 'P'
+UNPAUSE = 'U'
+JOG = 'j'
+REPORT = 'r'
+REBOOT = 'R'
+RESUME = 'c'
+ESTOP = 'E'
+CLEAR = 'C'
+STEP = 'S'
+FLUSH = 'F'
+DUMP = 'D'
+HELP = 'h'
SEEK_ACTIVE = 1 << 0
SEEK_ERROR = 1 << 1
VDD_REG = 6
FLAGS_REG = 7
+# Must be kept in sync with pwr firmware
UNDER_VOLTAGE_FLAG = 1 << 0
OVER_VOLTAGE_FLAG = 1 << 1
OVER_CURRENT_FLAG = 1 << 2
MEASUREMENT_ERROR_FLAG = 1 << 3
SHUNT_OVERLOAD_FLAG = 1 << 4
+MOTOR_OVERLOAD_FLAG = 1 << 5
+LOAD1_OVERTEMP_FLAG = 1 << 6
+LOAD2_OVERTEMP_FLAG = 1 << 7
+LOAD1_LIMITING_FLAG = 1 << 8
+LOAD2_LIMITING_FLAG = 1 << 9
reg_names = 'temp vin vout motor load1 load2 vdd pwr_flags'.split()
def get_reg(self, i): return self.regs[i]
+ def check_fault(self, var, status):
+ status = bool(status)
+
+ if status != self.ctrl.state.get(var, False):
+ self.ctrl.state.set(var, status)
+ if status: return True
+
+ return False
+
+
def error(self):
flags = self.regs[FLAGS_REG]
- errors = []
- # Decode error flags
- if flags & UNDER_VOLTAGE_FLAG: errors.append('under voltage')
- if flags & OVER_VOLTAGE_FLAG: errors.append('over voltage')
- if flags & OVER_CURRENT_FLAG: errors.append('over current')
- if flags & MEASUREMENT_ERROR_FLAG: errors.append('measurement error')
- if flags & SHUNT_OVERLOAD_FLAG: errors.append('shunt overload')
+ if self.check_fault('under_voltage', flags & UNDER_VOLTAGE_FLAG):
+ log.error('Device under voltage')
+
+ if self.check_fault('over_voltage', flags & OVER_VOLTAGE_FLAG):
+ log.error('Device over voltage')
+
+ if self.check_fault('over_current', flags & OVER_CURRENT_FLAG):
+ log.error('Device total current limit exceeded')
+
+ if self.check_fault('measurement_error',
+ flags & MEASUREMENT_ERROR_FLAG):
+ log.error('Power measurement error')
+
+ if self.check_fault('shunt_overload', flags & SHUNT_OVERLOAD_FLAG):
+ log.error('Power shunt overload')
+
+ if self.check_fault('motor_overload', flags & MOTOR_OVERLOAD_FLAG):
+ log.error('Motor power overload')
+
+ if self.check_fault('load1_overtemp', flags & LOAD1_OVERTEMP_FLAG):
+ log.error('Load 1 over temperature shutdown')
+
+ if self.check_fault('load2_overtemp', flags & LOAD2_OVERTEMP_FLAG):
+ log.error('Load 2 over temperature shutdown')
+
+ if self.check_fault('load1_limiting', flags & LOAD1_LIMITING_FLAG):
+ log.warning('Load 1 limiting active')
- # Report errors
- if errors: log.error('Power fault: ' + ', '.join(errors))
+ if self.check_fault('load2_limiting', flags & LOAD2_LIMITING_FLAG):
+ log.warning('Load 2 limiting active')
def _update(self):
import tarfile
import subprocess
import socket
+import time
from tornado.web import HTTPError
import bbctrl
def put_ok(self):
- # Only allow this function in dev mode
- if not os.path.exists('/etc/bbctrl-dev-mode'):
- raise HTTPError(403, 'Not in dev mode')
+ if not 'password' in self.request.arguments:
+ raise HTTPError(401, 'Missing "password"')
+
+ if not 'firmware' in self.request.files:
+ raise HTTPError(401, 'Missing "firmware"')
+
+ check_password(self.request.arguments['password'][0])
firmware = self.request.files['firmware'][0]
def put_ok(self): self.ctrl.avr.jog(self.json)
+class VideoReloadHandler(bbctrl.APIHandler):
+ def put_ok(self): subprocess.Popen('reset-video').wait()
+
+
# Base class for Web Socket connections
class ClientConnection(object):
def __init__(self, ctrl):
(r'/api/override/feed/([\d.]+)', OverrideFeedHandler),
(r'/api/override/speed/([\d.]+)', OverrideSpeedHandler),
(r'/api/jog', JogHandler),
+ (r'/api/video/reload', VideoReloadHandler),
(r'/(.*)', StaticFileHandler,
{'path': bbctrl.get_resource('http/'),
"default_filename": "index.html"}),
"default": "false",
"code": "sr"
},
+ "tool-enable-mode": {
+ "type": "enum",
+ "values": ["disabled", "lo-hi", "hi-lo", "tri-lo", "tri-hi", "lo-tri",
+ "hi-tri"],
+ "default": "lo-hi",
+ "code": "eom"
+ },
+ "tool-direction-mode": {
+ "type": "enum",
+ "values": ["disabled", "lo-hi", "hi-lo", "tri-lo", "tri-hi", "lo-tri",
+ "hi-tri"],
+ "default": "lo-hi",
+ "code": "dom"
+ }
+ },
+
+ "huanyang-spindle": {
+ "bus-id": {
+ "type": "int",
+ "default": "1",
+ "code": "hi"
+ }
+ },
+
+ "pwm-spindle": {
"max-spin": {
"type": "float",
"unit": "RPM",
"default": 0,
"code": "sm"
},
- "spin-min-duty": {
+ "pwm-inverted": {
+ "type": "bool",
+ "default": "false",
+ "code": "pi"
+ },
+ "pwm-min-duty": {
"type": "float",
"unit": "%",
"min": 0,
"default": 1,
"code": "nd"
},
- "spin-max-duty": {
+ "pwm-max-duty": {
"type": "float",
"unit": "%",
"min": 0,
"max": 65535,
"default": 1000,
"code": "sf"
- },
- "pwm-inverted": {
- "type": "bool",
- "default": "false",
- "code": "pi"
- },
- "tool-enable-mode": {
- "type": "enum",
- "values": ["disabled", "lo-hi", "hi-lo", "tri-lo", "tri-hi", "lo-tri",
- "hi-tri"],
- "default": "lo-hi",
- "code": "eom"
- },
- "tool-direction-mode": {
- "type": "enum",
- "values": ["disabled", "lo-hi", "hi-lo", "tri-lo", "tri-hi", "lo-tri",
- "hi-tri"],
- "default": "lo-hi",
- "code": "dom"
}
},