That is totally correct! But: for people like me or other users in this thread it would be easier to "fix" such issues.
Current approach for the new comm layer are (plugin extendable) protocol layers that hold the strings and other stuff ...
Ah okay that sounds to me there is some heavy refactoring going on? To use plugins that hold everything that is required to handle communication with different flavors (printers?) is something I totally agree with.
You can take a look at the current implementation here
You really want me to do that? I am a very hard coder reviewer
Yeah, that refactoring has been going on for a long time actually. I originally wanted to get it into 1.4.0, but that caused issues with the timeline due to the pending py2 EOL. It's still in the process of being worked on (though on hold while I take care of 1.4.0rc stuff - once again, which is another source of frustration). With that in mind, knock yourself out, if you want to look over it I'd be thankful, as long as you keep in mind that it's not final The whole octoprint.comm tree is actually new.
Sorry to rake this up again but I can't get this to work, wonder if you might have any pointers. Quite ok with linux so I'm at a loss as to what is wrong.
Octoprint 1.3.12
I've created the file in the ~/.octoprint/plugins directory from a cut/paste of the code above, into mcedit - unix editor. File is named 'convert_TF_SD.py' and python has built a corres .pyc file beside it so I'm assuming it's being found OK. I note it's been variously named 'convert..' and 'Convert..' in the discussions above. The file is chmod 777.
Rebooted the pi but still the 'Upload to SD' button is disabled. M21 still says 'TF card OK'. Plugin doesn't appear in the Plugins list.
I don't really need the functionality but would be nice to get it working and know why.
I have the same issue, same version and I used the file in the ZIP from an earlier reply. I even tried the suggestion to disable the options under Firmware, but that still makes no difference.
Both M20 and M21 return valid results as far I can tell:
Send: M20
Recv: Begin file list
Recv: CAT-35~1.GCO 34432620
Recv: DOG-25~1.GCO 12449184
Recv: PIG-4H~1.GCO 19126652
Recv: ENDER3~1.GCO 151321
Recv: End file list
Recv: ok
[...]
Send: M21
Recv: echo:TF card ok
Recv: Init power off infomation.
Recv: size:
Recv: 585
Recv: init valid:
Recv: 0
Recv: 0
Recv: ok
It worked for me if I turned on "Always assume SD card is present- Repetier" as discussed but in the end I made the changes in the comm.py file as per @siochs suggestion. Worked straight away too and I'm OK editing files in linux.
I don't really need to use the SD from octoprint - but it should be working so I patched it!!
Worked like a charm for me! I will try to recomplile Marlin "any day" and that will hopefully resolve it in a cleaner way for me.
The easy and quite ugly way of installing the plugin is to just connect to octopi via SSH (or login as the effective octoprint user on your machine) copy this snippet (which is just @b-morgan s code) and paste it straight into the terminal:
cat > /home/pi/.octoprint/plugins/convert_TF_SD.py << EOF
# coding=utf-8
from __future__ import absolute_import
def convert_TF_SD(comm, line, *args, **kwargs):
if "TF" not in line:
return line
goodline = line.replace("TF","SD")
return goodline
__plugin_name__ = "Convert TF to SD"
__plugin_version__ = "1.0.0"
__plugin_description__ = "Convert TF to SD in printer responses"
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.received": convert_TF_SD
}
EOF
sudo service octoprint restart
I found this thread because I was having the same issue. Copied the script in post #6 over, unchecked "Enable automatic firmware detection," and then checked "Always assume SD card is present," and all is well.
This seems to be working solution for me. to get here and see this option, you should uncheck the automatically detect printer firmware checkbox if selected. I didn't had to change anything else and SD card is active on my ender 3 from octopi !! Thanks for this solution...
I'll just quote @zinob because that way you don't have to scroll back too far. This assumes that you have figured out how to SSH into your RPi using PuTTY (on Windows), ssh (on Linux), or something else on macOS.
The easy and quite ugly way of installing the plugin is to just connect to octopi via SSH (or login as the effective octoprint user on your machine) copy this snippet (which is just @b-morgan s code) and paste it straight into the terminal:
cat > /home/pi/.octoprint/plugins/convert_TF_SD.py << EOF
# coding=utf-8
from __future__ import absolute_import
def convert_TF_SD(comm, line, *args, **kwargs):
if "TF" not in line:
return line
goodline = line.replace("TF","SD")
return goodline
__plugin_name__ = "Convert TF to SD"
__plugin_version__ = "1.0.0"
__plugin_description__ = "Convert TF to SD in printer responses"
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.received": convert_TF_SD
}
EOF
sudo service octoprint restart
Thank for the clarification. I get no file listing in OctoPi unless I type M20 in the OctoPi terminal window and the list is only visible in the terminal window.
First of all, thanks a lot for the code, I've just installed OctoPrint 1.3.12 a week ago and this issue is one of those I had left to resolve for later.
Hardware: Omega2
OS: OpenWRT
I made a simple enhancement by removing the temporal variable 'goodline' and just returning the resulting replaced string:
# coding=utf-8
from __future__ import absolute_import
def convert_TF_SD(comm, line, *args, **kwargs):
if "TF" not in line:
return line
return line.replace("TF","SD")
__plugin_name__ = "Convert TF to SD"
__plugin_version__ = "1.0.0"
__plugin_description__ = "Convert TF to SD in printer responses"
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.received": convert_TF_SD
}
The same is happening to me, I have and ender 3 pro (BTW open to test stuff), and my results are the same as yours. I even wen to the pulgin manager and saw the plugin listed there. I enabled it and restarted octoprint, nothing happened.
Edit: Just went to plugin manager to check out the plugin, it's listed as "disabled" and even if i enable it, it ends up that way. I don't know what is happening but I'm all ears to solutions and testing.
Thanks for great solution, @b-morgan, but it seems that the code needs an update, because of some defaults at latest 1.4.2 version. I had an issue running that as is (docker octoprint/octoprint:latest), system deactivated it at start as incompatible with Python version (3.8 for container), so I had to add this to make it work:
You will find the plugin (actually a bash script) below. I have updated it with all the suggestions in this thread.
The easy and quite ugly way of installing the plugin is to just connect to octopi via SSH (or login as the effective octoprint user on your machine) copy this snippet and paste it straight into the terminal:
cat > /home/pi/.octoprint/plugins/convert_TF_SD.py << EOF
# coding=utf-8
from __future__ import absolute_import
def convert_TF_SD(comm, line, *args, **kwargs):
if "TF" not in line:
return line
return line.replace("TF","SD")
__plugin_name__ = "Convert TF to SD"
__plugin_version__ = "1.0.1"
__plugin_description__ = "Convert TF to SD in printer responses"
__plugin_pythoncompat__ = ">=2.7,<4"
__plugin_hooks__ = {
"octoprint.comm.protocol.gcode.received": convert_TF_SD
}
EOF
chmod +x /home/pi/.octoprint/plugins/convert_TF_SD.py
sudo service octoprint restart
Since OctoPrint 1.5.0 you can also install single file plugins (.py) via the plugin manager, even from an URL. I just threw your plugin into a gist at
Anyone who needs it should be able to install it by entering https://gist.github.com/foosel/9ca02e8a3ea0cb748f4b220981eab12d/raw/convert_TF_SD.py into the plugin manager's "from URL" field in the "Get more..." dialog: