Skip to content

V0.3 Developer Guide

FormerLurker edited this page May 25, 2020 · 1 revision

Installing OctoPrint

Since Octolapse is an OctoPrint plugin, you'll need OctoPrint to run basically anything. Follow the instructions here to install OctoPrint. Some useful reading about OctoPrint plugins is available here.

Pulling Octolapse source

Clone Octolapse into its own folder.

git clone [email protected]:FormerLurker/Octolapse.git

Pycharm setup

Go to File > Settings > Project > Project Interpreter and change the project interpreter to the one you created during the OctoPrint install (it should point to OctoPrint/venv/bin/python2.7).

In order to standardize formatting across many editors and IDEs, we use EditorConfig. Go to File > Settings > Plugins and install the EditorConfig plugin. This will automatically detect the .editorconfig file at the root level of the repository and load the correct settings.

Configuring and running unit tests

Right click on octoprint_octolapse/test and select Run Twisted Trial in test to run all tests.

Running an OctoPrint server

Go to File > Settings > Plugins and install the BashSupport plugin.

Install Octolapse

Start by setting up a run configuration that will install Octolapse.

Go to Run > Edit Configurations Add a new run configuration for Bash. Fill out the fields as follows:

install octolapse pycharm run configuration

Name: Install Octolapse

Script: octoprint dev plugin:install

Interpreter path: /bin/bash

Interpreter options: --rcfile <path-to-octoprint>/OctoPrint/octoprint_venv/bin/activate -i -c

Working directory: <path-to-octolapse>/Octolapse

Also check the Single instance only checkbox in the top right corner.

You can check your run configuration by running it (Run > Run... > Install Octolapse).

Run OctoPrint

Return to Run > Run... > Edit Configurations. Add another new run configuration for Bash. Again, fill out the fields as follows:

run octoprint locally pycharm run configuration

Name: OctoPrint Server with Octolapse

Script: octoprint serve

Interpreter path: /bin/bash

Interpreter options: --rcfile <path-to-octoprint>/OctoPrint/octoprint_venv/bin/activate -i -c

Before launch: Run another configuration > Install Octolapse

Also check the Single instance only checkbox in the top right corner.

You can check your run configuration by running it (Run > Run... > Run OctoPrint server with Octolapse). You should see a terminal pop up with the OctoPrint server's stdout stream. Open your browser to http://localhost:5000/ to visit the OctoPrint server. Make sure Octolapse is installed as well.

Running on a Raspberry Pi

One time only For your first setup, you'll need to setup SSH access via public/private key.

  1. Generate SSH key. Run ssh-keygen and follow the prompts. It's fine to leave everything as defaults.
  2. Copy to Raspberry Pi. ssh-id-copy pi@<ip-address-of-pi> can be useful for this.
  3. You should now be able to log into the Raspberry Pi without entering a password. Test with ssh pi@<ip-address-of-pi>.

How to run The steps we'll be following to run the local copy of Octolapse on a remote Raspberry Pi is as follows:

  1. Zip the plugin up. zip -FSr /tmp/octolapse-local-dev.zip Octolapse/
  2. sFTP the fle over to the Pi. sftp pi@<ip-address-of-pi>:/tmp <<< $'put /tmp/octolapse-local-dev.zip'
  3. Uninstall/Install/Cleanup. ssh pi@<ip-address-of-pi> "/home/pi/oprint/bin/python -m pip uninstall --yes Octolapse && /home/pi/oprint/bin/python -m pip install /tmp/octolapse-local-dev.zip --no-cache-dir && rm /tmp/octolapse-local-dev.zip"

Integration into Pycharm You guessed it: create a new Run Configuration with the following fields:

install local octolapse to raspberry pi pycharm run configuration

Name: Install local Octolapse to Pi

Script: zip -FSr /tmp/octolapse-local-dev.zip Octolapse/ && sftp pi@<ip-address-of-pi>:/tmp <<< $'put /tmp/octolapse-local-dev.zip' && ssh pi@<ip-address-of-pi> "/home/pi/oprint/bin/python -m pip uninstall --yes Octolapse && /home/pi/oprint/bin/python -m pip install /tmp/octolapse-local-dev.zip --no-cache-dir && rm /tmp/octolapse-local-dev.zip && sudo service octoprint restart"

Interpreter path: /bin/bash

Interpreter options: -c

Working directory: <path-to-octolapse>

Logging

Octolapse uses OctoPrint's logging interfaces where possible. These logs are by default stored in ~/.octoprint/logs/plugin_octolapse.log.

Your browser may also show useful JavaScript errors if you are working on the UI.

Virtual printer/Test mode

OctoPrint includes a virtual printer for testing purposes. Read more here.

Octolapse also includes a test mode in which all heating and extrusion commands are stripped. Documentation on that is available here.

Release cycle

  1. Development is done on the devel branch.
  2. Merge devel into rc/devel - update version number (Vx.x.xrcx-dev) - add a rc/devel pre-release to github
  3. Merge rc/devel into rc/maintenance when ready and remove -dev from version - add an rc/maintenance pre-release to github
  4. Add a github issue for feedback on the rc
  5. Fix any issues on devel branch
  6. Merge fixes into rc/devel and update the version number (vx.x.x.rc(X+1)).dev
  7. Work with the users to test the rc/devel branch, adding an rc/devel release if necessary
  8. When issues are fixed, merge into rc/maintenance and remove -dev and add an rc/maintenance pre-release to github
  9. Create a new github issue for feedback, close the previous issue.
  10. Repeat from step 4 until major issues are solved.
  11. Merge into master and update the version number (vx.x.x) and add a new release to github
Clone this wiki locally