MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.15k stars 19.21k forks source link

[FR] Gcode Support for BigTreeTech TFT35 and other Serial LCD. #14163

Open dianlight opened 5 years ago

dianlight commented 5 years ago

Description

Background: My configuration consists of a BigTreeTech SKR v.13 motherboard and a BigTreeeTech TFT 35 LCD. The LCD is connected to serial 2 of the card. Currently, the LCD firmware is very limited and only manages printing for gcode coming from its SD reader. I am implementing in a fork of the firmware (dianlight / BIGTREETECH-TFT35-V1.2) the basic functionalities that the screen should have included also the display of the print status if this happens via USB (serial n ° 1).

In order for the LCD screen on Serial 2 to receive the events, some commands (I have identified M117, M118, M31, M78 and M118 for now) respond on both series, perhaps using Action Commands.

I am perfectly able to independently make the necessary changes to the firmware but before proceeding I would like an opinion from the community.

The roads I can take are 2:

  1. Add a new SERIAL_ACTION_COMMAND_BROADCAST configuration (or other name) and insert in the replies of M117, M31, M78 and M118 the replication on both serial lines of the command response.

  2. Create a custom extensible_ui for the LCD in question that, based on the events, sends custom action commands to the TFT32 serial.

The solution 1 to me seems more generic and can also be used by other serial elements (TFT, LCD, Wifi etc etc).

Steps to Reproduce

  1. Use a solution with two serial. Use 1 serial to send command and the other serial to watch status.
  2. Send a GCODE print ( start time, gcode..., set percent etc ) from one serial.
  3. Monitor the print status from the other serial.

Additional Information

govido commented 5 years ago

Hi, I like the idea to have a more versatile touchscreen. The TFT35 only has very generic settings out of the box. I think using the HOST_ACTION_COMMANDS option would be a good thing. Do I understand this correctly, that this only sends M118 etc. to the first serial port (USB)? Or why would a broadcast be necessary? I think a more versatile approach would be nice to for other displays. If you need someone to test, I can offer an SKR 1.3 board with TFT35 and 12864 GLCD with TMC2130 drivers. Sidenote: I can't get the current (05.28) Bugfix 2.0 running, always getting Bed Maxtemp error... Is there currently a 'good' and working Bugfix 2.0 verion for SKR 1.3? I seem to download only on wrong days.

InsanityAutomation commented 5 years ago

As every lcd will be different, the recommended route is Extensible UI so that it does not need to be maintained conjoined with Marlin internals. This sounds like exactly what lulzbot developed it for. Remember most lcd's run their own internal firmware not draw commands from the printer controller so their function cannot necessarily be changed.

govido commented 5 years ago

You're right, I was thinking about the specific open source nature of the TFT35. That way it would be possible to alter the firmware to a 'Marlin standard'. If closed source lcds are used I can see it getting complicated pretty quickly. What I forgot to mention: I use Octoprint on the USB-side and the TFT on the SKR 1.3 + GLCD, just because it seems to work. My current serial settings are these:

define SERIAL_PORT -1

define SERIAL_PORT_2 0

As there is not much documentation available, I tried these settings and both Octoprint and TFT35 can send commands.

dianlight commented 5 years ago

I have the same config. Octoprint on serial -1 ( the USB for SKR 1.3 ) and the TFT35 on the other serial. In my opinion, TFT35's firmware is very basic; is not able to display and command printing status if the gcode come from board SD or from the USB ( Octoprint ). The reverse also does not work: what the TFT35 sends is not seen by Octoprint.


In my initial analysis to add the functionality to the TFT35 firmware (of which I forked), I noticed some oddities about how the 2 serial lines under Marlin are managed:


Other details emerged are just missing features that would be needed to manage everything "transparently" without having a dedicated driver (read extensible_ui module) since they could generally serve any device on the second serial that is an LCD, a Wifi module or other :


I am also available to contribute to the necessary changes to Merlin if they can also be interesting for other projects and hw. The road to implementing an extensible_ui would probably be easier to develop and maintain. The user who would like to use the advanced features of the TFT35 firmware (or my firmware fork if my pull requests are not accepted) would have to add the "driver" for the LCD before compiling the firmware for your printer.

I accept suggestions. In the meantime, I focus on the UI part of the TFT35 as the work is not cheap and being just a hobby, my time for dedication is not much.

Gerggg commented 5 years ago

Hello, I try to do like you, a map skr 1.3 + octoprint + tft35. I saw that you give the ports you use to have 2 serial ports but can you give the speed use? 115200 or 250000? Otherwise I'm in tune with you, Marlin and tft deserve better integration. especially to configure the Z offset, read the information of the steppers, jerk, acceleration, PID, TMC ... there is so much information missing in the tft.

guestisp commented 5 years ago

Any update on this? I'm thinking in buying the same touch screen but as i make use of M117 in my gcodes, a deeply integrated firmware would be useful

dianlight commented 5 years ago

Hello, I try to do like you, a map skr 1.3 + octoprint + tft35. I saw that you give the ports you use to have 2 serial ports but can you give the speed use? 115200 or 250000? ...

@Gerggg I have the two serial at 115200.

Sent with GitHawk

dianlight commented 5 years ago

Any update on this? I'm thinking in buying the same touch screen but as i make use of M117 in my gcodes, a deeply integrated firmware would be useful

@guestisp I’m working on it. Stay tuned. The print from onboard sd is in pull requests. I’m just start the extensible_ui implementation.

Sent with GitHawk

guestisp commented 5 years ago

I’m working on it. Stay tuned. The print from onboard sd is in pull requests. I’m just start the extensible_ui implementation.

Awesome. Any chance to get this merged in official marlin (if marlin changes are needed...) Do you have some screenshots/video of your fork ? Just to see if anything changed from the stock one

OT but very small hint: if you are working on the firmware, please please please add a more modern e professional UI. the stock one is much '90s, i really hate it

guestisp commented 5 years ago

@dianlight Vedo ora che sei italiano. Grandioso :D

dianlight commented 5 years ago

@dianlight Vedo ora che sei italiano. Grandioso :D

@guestisp si ma parliamo in Inglese non è carino per gli altri che leggono i post. Al massimo mandami PM.

You can see and try my work on the my fork of tft35 repository ( dianlight/BIGTREETECH-TFT35-V1.2 ). Look at the wiki for last published status. I work on it on my spare time ( most in train between home and work) so be patient.

Sent with GitHawk

dianlight commented 5 years ago

Hi everyone I publish on my branch the first version of the Marlin integration ( not yet ready for a pull request, the code is dirty and I have some stability issue on the TFT35 side.). Consider all in alpha state it just works!

Link to TFT35 Firmware (use branch: autoconfig / please read the wiki!): TFT 35 Firmware

Link to Marlin Firmware ( use branch: bugfix-2.0.x ): Marlin 2.0.x - TFT35 support

I need beta testers on different HW configurations if some found please open an issue on dianlight/BIGTREETECH-TFT35-V1.2 Github project.

Gerggg commented 5 years ago

hello, good news! I try as much as possible. Thank you for your work.

govido commented 5 years ago

If I find time this weekend I will try SKR 1.3 with tmc2209, new firmware is needed anyway ;). As soon as skr pro arrives and is supported I can test it too. I also ordered the new tft24 with 12864 emulation, I am curious what works better in the end.

guestisp commented 5 years ago

Looks like alfawise has made a touchscreen with standard Marlin LCD menù: https://www.lesimprimantes3d.fr/forum/topic/18260-dev-alfawise-u20x-u30-marlin-2x-firmware-alternatif/

There is also a video on YouTube, the standard Marlin menu is shown on touchscreen and some touch buttons are used as "encoder" replacing the knob

govido commented 5 years ago

Is there any code published on github for this alfawise touchscreen? My french is... and google translate is horrible to read. I could only find shady dropbox downloads...

guestisp commented 5 years ago

I don't know, i've just saw the video

DavidThijs commented 5 years ago

The BigTreeTech tft24 1.1 also has a Marlin 128x64 emulator. You can choose between the two modes (emulator or touchscreen) by burning the correct firmware. I'm very keen to see how they interfaced that, but it won't be over the serial connector, it's likely using SPI or something. The code is public on: https://github.com/bigtreetech/BIGTREETECH-TouchScreenFirmware.git

guestisp commented 5 years ago

I think you have to use two cable, one acting as a standard 12864 and one as touchscreen

DavidThijs commented 5 years ago

I have to correct myself, you can attach all the cables and switch the mode by pushing the encoder button while resetting the printer. So there is only one firmware file which contains code for both modes. I got the 128x64 emulation working with some issues (USB needs to be plugged in for whatever reason). The TFT touch screen still indicates no printer attached.

InsanityAutomation commented 5 years ago

Didnt know how to switch modes on this! Ill test here later tonight.

thisiskeithb commented 5 years ago

For BigTreeTech’s combo TFT24, you should be able to just hold down the encoder to switch modes using the latest firmware.

Mine’s still stuck in customs, so I can’t confirm.

InsanityAutomation commented 5 years ago

I got a hold of one from another local user on Saturday who handed it to me. I spend about half an hour messing with it but never saw how to get into the other mode.

thisiskeithb commented 5 years ago

The old firmware didn't allow live switching, so you'll have to update it to the latest version. I'm hoping to confirm this week assuming no issues on the customs clearance side.

DavidThijs commented 4 years ago

Ok,heads up. Marlin works with the 128x64 emulation mode and both EXP1,EXP2 and the serial connection attached. However, when switching modes (long press knob), I keep getting a "no printer attached" message in the mode with the icons. We'll figure it out.

hapklaar commented 4 years ago

Ok,heads up. Marlin works with the 128x64 emulation mode and both EXP1,EXP2 and the serial connection attached. However, when switching modes (long press knob), I keep getting a "no printer attached" message in the mode with the icons. We'll figure it out.

Had the same, be sure to set one of the SERIAL_PORT(_2) to 0 and baudrate to 115200 in Configuration.h. Mine is as follows (SKR1.3 has USB assigned to -1): #define SERIAL_PORT -1 // USB Serial #define SERIAL_PORT_2 0 // TFT Serial

On my side the emulation mode isn't working. Just a blank screen with EXP1 and EXP2 correctly attached and running latest precompiled firmware. Going to try the manual configure and compile route.

Edit: Had to enable #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER instead of #define REPRAP_DISCOUNT_SMART_CONTROLLER

msutas commented 4 years ago

Old topic but just noticed it. The main problem of the serial TFT lcds is missing the notices thrown by Marlin such as wait for user feedback events and thermal runaway. Using the extensible_ui structure and host actions for sending notices to the LCD and responding to these actions on the LCD side would be a neat solution. I will also have a look at this.

InsanityAutomation commented 4 years ago

Yup, but that is totally on the LCD side. Nothing more we can do for it. As a raw gcode streamer, host prompt is more suitable.

msutas commented 4 years ago

@InsanityAutomation I have also ordered a TFT35. It is also open source, I believe I can also add the necessary responses also to TFT35. That way TFT35 can work flawlessly with Marlin.

CRCinAU commented 4 years ago

Just wondering... I got a TFT35 V2 + SKR Mini E3. Looking at this, I guess I #define SERIAL_PORT_3 0...

Then what? :)

ipatch commented 4 years ago

did this every materialize to anything substantial?

I have a BTT TFT35v2 the touch screen by bigtreetech without the encoder wheel, and would love to be able to switch to the traditional marline menu that's used with the 12864 lcd, as there are certain features of the marlin FW that can't be changed / done / updated using a touch screen, the first feature that comes to mind is filling in the missing points using UBL.

mobilinkd commented 4 years ago

I too am interested in this. The main issue that I am seeing is that important notices such as Thermal Runaway Protection and other errors such as "TMC CONNECTION ERROR" that are displayed on the 12864 screen do not appear on the TFT35. We need a good communication infrastructure for sending this sort of information back to a controller.

What happens when using OctoPrint and a TRP event occurs? Is there any indication that a specific problem occurred, or is the printer just "dead" after kill() is called?

sadbass commented 3 years ago

I have a similar problem, with skr 1.4 and TFT 35 V2 I cannot see the SD onboard, I have abilitated the SDSUPPORT

ellensp commented 3 years ago

@sadbass your issue has absolutely nothing to do with this feature request. This is not a support forum.

l31g0n commented 3 years ago

Hey all... been working with this for a while and found that if you swap the 0 and -1 serial ports in marlin to #define SERIAL_PORT -1

define SERIAL_PORT_2 0. it wont open a printing dialog on tft so pause and change filament might be a problem, but it will display the status messages. Has anyone figured this out ?