Coder Social home page Coder Social logo

renaud11232 / octoprint-marlin-flasher Goto Github PK

View Code? Open in Web Editor NEW
38.0 7.0 10.0 774 KB

Arduino/Marlin firmware flasher for OctoPrint

License: MIT License

Python 47.05% JavaScript 23.02% CSS 0.86% Jinja 29.07%
octoprint octoprint-plugin octoprint-marlin-flasher

octoprint-marlin-flasher's People

Contributors

avanosch avatar frozenfoxx avatar masterdomino avatar renaud11232 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

octoprint-marlin-flasher's Issues

i'm getting "board option fetch failed"

I have the sanguino board (core) loaded. I got the installed message. I put up a hex file. Now I'm getting "board option fetch failed". Any idea what could cause this?

Feedback

It would be great to get feedback on what is going on when flashing (compiling, flashing, reading, writing, etc.). Not sure if this is possible.

cannot execute upload tool: fork/exec avrdude: no such file or directory

Running Octoprint on x86 CPU. Here's the full error.
Error during Upload: cannot execute upload tool: fork/exec /root/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/bin/avrdude: no such file or directory

I have verified avrdude is present and executable. I also replaced that executable with one I installed manually from the OS repo, that did not work either. Same error no such file or directory

~/.octoprint # ls -la /root/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/bin/avrdude
-rwxr-xr-x    1 root     root        537192 Mar  1 23:01 /root/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/bin/avrdude
~/.octoprint # ls
arduino-cli      config.yaml      logs             scripts          supervisord.log  translations     watched
avrdude          data             plugins          slicingProfiles  supervisord.pid  uploads
config.backup    generated        printerProfiles  socat.sh         timelapse        virtualSd
~/.octoprint # rm /root/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/bin/avrdude
~/.octoprint # mv avrdude /root/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/bin/

compiling

Just for the sake of clarification, is this the same as the firmware updater but without the added step of compiling a hex file in arduino ide first?

Walk through examples?

I have Tronxy X3A, running 1.0 marlin on a Melzi 2.0 board.
I would like to update the firmware but I'm new to this and having a hard time figuring out how to get this going.
Is there a walk through with examples somewhere? I looked at the wiki but did not add much beyond the readme and seems targeted at folks who already own this process... I have installed the other packages but I'm left with a big now what?
Thanks

Improve README

Add a step by step how to use/configure. Maybe create a wiki ?

Related to #8

Server stops responding during compilation

Compilation can be very long and the way it seems to be implemented, the server only answers 1 request at a time, so it block everything.

It would be nice to make all requests async and get the return statuses using plugin_messages

Remember last used board

Just a little suggest for enhancement to avoid the needs to select every time octopi reboots the board/processor
immagine

Plugin is not enabled after an update

Sometimes, an error occurs during octoprint startup.

2020-03-28 14:52:47,438 - octoprint.server.views - ERROR - Error while retrieving template data for plugin marlin_flasher, ignoring it
Traceback (most recent call last):
  File "/home/renaud/OctoPrint/venv/local/lib/python2.7/site-packages/octoprint/server/views.py", line 686, in fetch_template_data
    wizard_required = implementation.is_wizard_required()
  File "/home/renaud/OctoPrint/venv/local/lib/python2.7/site-packages/octoprint_marlin_flasher/__init__.py", line 87, in is_wizard_required
    if self.__flasher.check_setup_errors():
AttributeError: 'MarlinFlasherPlugin' object has no attribute '_MarlinFlasherPlugin__flasher

While waiting for a fix, just restart Octoprint once more and the plugin should now be enabled

Use newer pyduinocli

pyduinocli will be updated soon.
When released, use the new version, no functionnal change, but it's way prettier

Donations

TLDR: Do you accept donations / where can I tip you?

Long story: I'm rebuilding my first self-built 3d printer into a ultra-low-duty CNC, which requires a lot of firmware tweaking right now. Not having to replug the board all the time is really a godsend. For the amount of time you save me I'd love to give you a small tip and probably others feel the same way, too.

Really Cool

So I have used this and it is really cool. The ONLY thing I would love is the ability to edit the sketch (configuration.h in my case) ON the Pi, somehow. Still a PITA to load the sketch on my Windows box make an edit, save it, zip it, upload it, flash it...

Nonetheless, this is a cool plugin for a cool package. Thank you!

Please add support for uploading precompiled .hex

It is actually more work to: (having installed Arduino CLI)
-zip the sketch directory,
-upload it

than:
(I am very much likely to have Marlin sketch already open for editing)
-hit Ctrl-R (build it, on much more powerful computer)
-upload /tmp/arduino/marlin.ino.hex

PlatformIO install instructions

I am not a linux user but should we us "which" instead of "where" in linux?

Current Instructions:

Once it is installed, you will need to know where it got installed. To do this you can do (Linux and Windows' cmd) :

where platformio

Proposed:

Once it is installed, you will need to know where it got installed. To do this you can do (Linux) :

which platformio

octoprint stuck on Marlin Flash

Hi, I have my octoprint main page stuck on Marlin Flasher wizard page, the note on it says that I should be able to continue by clicking finish but I have tried nothing I still on the wizard page thus can't use octoprint at the moment.

How I can disable or uninstall Marlin Flash maybe through command line so I can at least access my octoprint? I have attached a picture so you can see where I'm stuck. Any help will be appreciated.

Screen Shot 2019-11-30 at 3 33 19 PM

I'm lost

The plugin UI on my octoprint doesn't seem to match anything shown in the readme for this repo. This is what I see ...

Marlin Flasher Settings
Path to arduino-cli
Sketch .ino
Maximum sketch size 20 MB  *requires restart

[FR] PlatformIO: Get -e parameter from pins.h

There is a way for the plugin to automatically select the correct environment for a PlatformIO build and not require users to edit their platformio.ini file and change the default environment.

If you read the MOTHERBOARD value in Marlin/Configuration.h and then search for the corresponding MB(...) line in pins/pins.h, the end of the following #include line contains one or more env: designations. When there's only one, that can be stuck into the -e parameter. When there's more than one then the plugin can display a selector.

The basis of this has already been implemented as part of the auto_build.py script that comes with Marlin. I'm in the process of porting over the behavior handled by that Python script directly into the "Auto Build Marlin" extension for VSCode, so then there will be a working Javascript implementation and UI possibly more transportable to an OctoPrint plugin.

Exception when searching for Cores

After installing the plugin and setting up arduino-cli, I'm unable to search for cores.
The search button remains greyed out showing "Searching" indefinitely. The following exception shows up in the OctoPrint log:

octoprint - ERROR - Exception on /plugin/marlin_flasher/cores/search [GET]
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 1149, in decorated_view
    return no_firstrun_access(flask_login.login_required(func))(*args, **kwargs)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 1168, in decorated_view
    return func(*args, **kwargs)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/flask_login.py", line 758, in decorated_view
    return func(*args, **kwargs)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/flask_principal/__init__.py", line 198, in _decorated
    rv = f(*args, **kw)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_marlin_flasher/__init__.py", line 112, in search_cores
    return flask.make_response(flask.jsonify(result), 200)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/json.py", line 237, in jsonify
    return current_app.response_class(dumps(dict(*args, **kwargs),
ValueError: dictionary update sequence element #0 has length 7; 2 is required
2019-11-02 21:13:25,382 - tornado.access - ERROR - 500 GET /plugin/marlin_flasher/cores/search?query=arduino (::ffff:192.168.1.17) 18776.28ms

Running OctoPrint 1.3.10, tested on a Raspberry Pi 3B and RPi Zero W.

Arduino-Cli 0.14.x support

arduino-cli 0.11.0 and 0.12 are out but introduce breaking changes for the .hex files and will be skipped
0.15 will be supported.
This will drop support for previous versions

user: Current not implemented on linux/arm

There might be an issue with arduino-cli I've opened an issue.

While waiting for official help on their part, I've found a workaround :

On Linux: open the /etc/init.d/octoprint with your favorite editor. Find the following lines :

       start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \
       --exec $DAEMON --chuid $OCTOPRINT_USER --user $OCTOPRINT_USER --umask $UMASK --nicelevel=$NICELEVEL \
       -- serve $COMMAND_ARGS $DAEMON_ARGS

and change it for

       start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \
       --exec /usr/bin/env USER=$OCTOPRINT_USER $DAEMON --chuid $OCTOPRINT_USER --user $OCTOPRINT_USER --umask $UMASK --nicelevel=$NICELEVEL \
       -- serve $COMMAND_ARGS $DAEMON_ARGS

Then try to restart octoprint.
The issue does not appear on windows afaik

/dev/ttyACM0/firmware.bin: Not a directory - Failed.

I have followed the instructions and installed the Marlin Flasher as well as the platformio components. When I drop the zip file into the Marlin Flasher in Octoprint, it takes a moment to compile. It says Uploading and gets about half way through the progress bar and then says - /dev/ttyACM0/firmware.bin: Not a directory - Failed. I have tried looking around but am drawing a blank.

BIG refactoring needed

In order to ease the maintainability, the code should be split in more than 1 single file

Update wiki

Big changed happened under the hood
Document those

Some error messages need improvements

"Board option fetch failed"
There might be other cases of unclear messages.

This is due to the fact that arduino-cli does not (yet) have an sound error output. (Sometimes on stdout, sometimes stderr, sometimes both, or even none).

The error output of the plugin needs to have all these cases in mind, which it currently doesn't.

This is linked to #37

panic: runtime error: invalid memory address or nil pointer dereference

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x34 pc=0x37c600]
 
goroutine 1 [running]:
github.com/arduino/arduino-cli/arduino/cores.(*PlatformRelease).GetLibrariesDir(0x0, 0x3)
    /__w/arduino-cli/arduino-cli/arduino/cores/cores.go:210 +0x2c
github.com/arduino/arduino-cli/arduino/libraries/librariesmanager.(*LibrariesManager).AddPlatformReleaseLibrariesDir(0x2913d60, 0x0, 0x2)
    /__w/arduino-cli/arduino-cli/arduino/libraries/librariesmanager/librariesmanager.go:143 +0x20
github.com/arduino/arduino-cli/legacy/builder.(*LibrariesLoader).Run(0xcd429c, 0x1040960, 0xcd429c, 0x0)
    /__w/arduino-cli/arduino-cli/legacy/builder/libraries_loader.go:62 +0x444
github.com/arduino/arduino-cli/legacy/builder.(*ContainerSetupHardwareToolsLibsSketchAndProps).Run(0xcd429c, 0x1040960, 0xcd429c, 0x10)
    /__w/arduino-cli/arduino-cli/legacy/builder/container_setup.go:60 +0x1f0
github.com/arduino/arduino-cli/legacy/builder.runCommands(0x1040960, 0x130f960, 0x20, 0x20, 0xda201, 0x72f2b0, 0x130f8bc)
    /__w/arduino-cli/arduino-cli/legacy/builder/builder.go:210 +0xb8
github.com/arduino/arduino-cli/legacy/builder.(*Builder).Run(0x130fa88, 0x1040960, 0x801c70, 0x26f26d0)
    /__w/arduino-cli/arduino-cli/legacy/builder/builder.go:117 +0xa98
github.com/arduino/arduino-cli/legacy/builder.RunBuilder(...)
    /__w/arduino-cli/arduino-cli/legacy/builder/builder.go:226
github.com/arduino/arduino-cli/commands/compile.Compile(0x7ff7b0, 0x1030040, 0x130fe74, 0x7f8f48, 0x10100d0, 0x7f8f48, 0x10100d8, 0x1027810, 0x55bc00, 0x1, ...)
    /__w/arduino-cli/arduino-cli/commands/compile/compile.go:172 +0x10e4
github.com/arduino/arduino-cli/cli/compile.run(0x10cbcc0, 0x112d340, 0x1, 0x7)
    /__w/arduino-cli/arduino-cli/cli/compile/compile.go:96 +0x208
github.com/spf13/cobra.(*Command).execute(0x10cbcc0, 0x112d2c0, 0x7, 0x8, 0x10cbcc0, 0x112d2c0)
    /github/home/go/pkg/mod/github.com/spf13/[email protected]/command.go:830 +0x204
github.com/spf13/cobra.(*Command).ExecuteC(0xcbdfa8, 0x407b8, 0x5dc5ec, 0x10000e0)
    /github/home/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x234
github.com/spf13/cobra.(*Command).Execute(...)
    /github/home/go/pkg/mod/github.com/spf13/[email protected]/command.go:864
main.main()
    /__w/arduino-cli/arduino-cli/main.go:28 +0x24

=> In cores, search for avr and install the arduino:avr core.

This problem has already been reported on the arduino-cli GitHub.

Display the date/time of the uploaded sketch when flashing

It would be quite nice to simply see the timestamp of when the sketch was uploaded before flashing, just for being able to double-check the upload worked. Especially when repeatedly flashing firmare I had situations where I was not sure if I did already (successfully) upload the new sketch and had no way to validate that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.