MPCNC BTT TouchScreenFirmware for TFT35 2.0

Thanks. I will take a look when I get a moment. There are a few people that have changed the default firmware to do what they want, and in different ways. I’d like to converge on something a new person can pick up and run with. That means we won’t be able to incorporate everyone’s changes. But code like this, where you didn’t see the other solutions first, and you went in your own direction, are really valuable to mix into the solution. I particularly like the focus on the “standard” features of the MPCNC. The others are very focused on lasers and spindle control (which is great too), but I bet you at least 9/10 machines don’t have either.

Thanks for sharing. I’m not sure I will get to this soon, I am drowning in projects ATM, but I will take a look.

I wonder if adding a “Z-Probe” type button on the homescreen would be feasible. Jog the bit to where you need, clip the probe wire in place and tap the button. Alternatively, this with a second Z-probe button that does the same thing, only also adds edge detection.

Am I just wishlisting, or are these things possible?

2 Likes

Currently the Home Z button will do this. Also has an option in config.ini to set the touchplate offset as well.

In the case of the Lowrider, the Home Z button will bring the gantry up to the uppermost height of travel from what I can tell. I’m still waiting on my steppers to arrive so I can get the gantry built.

How does this work for the touchplate in this regard?

Endstops on the LR are non standard. One of the reasons is that it is more complicated to home up and probe down. It can be done, but it needs some specific thought.

Z probe, and home Z both belong in the home menu (IMO). I would love to be at a state where you can answer a few questions in the .ini file and have the right buttons available to you, but we aren’t there yet.

2 Likes

would you mind sharing the step file for your case, i’d love to mod it to fit a tft 35 v3 the stl’s crash fusion constantly when I try to edit them :frowning:

1 Like

Hi! Does anyone know how to enable M0 commands to show up correctly in the TFT mode? In the simulation mode it works as intended, but in TFT - the popup window appears with the default pause message “Paused for user continue” without the custom string, say “Turn spindle on” or “Attach probe”. Is it even a software bug or the TFT cannot do that? It seems strange, because M117 shows the custom text both in Marlin and TFT modes.

And second issue, In Marlin mode, after cancelling the print with a “Stop print” menu item, the gantry homes X and Y automatically. My display setup file only includes M5 code on cancel print to stop the spindle and works as intended in TFT. Miracles!

1 Like

The config.ini only controls the tft mode. In marlin mode, the skr is deciding what each pixel should be and how to handle button presses. So if it homes on stop, that has something to do with marlin config, not the tft.

I can’t answer the other parts. I am not sure what gets transmitted with M0. Are you running the job with the M0 from the TFT?

Jeff, ok, I will search for the cancellation code in the Marlin firmware.

For the second part, the milling operation is generated by the Guffy post-processor in Fusion 360 and the gcode is loaded to a USB-stick, then inserted in the BTT TFT 35 v3 USB slot and run in the TFT mode.

The starting gcode is as follows:

; *** START begin ***
G90
G21
M84 S0
G92 X0 Y0 Z0
; *** START end ***

; *** SECTION begin ***
;2D Contour1 - Milling - Tool: 1 - flat end mill
; X Min: -122.608 - X Max: 120.195
; Y Min: -62.896 - Y Max: 74.104
; Z Min: -2 - Z Max: 15
; COMMAND_START_SPINDLE
; COMMAND_SPINDLE_CLOCKWISE
M0 Turn ON 5000RPM
; COMMAND_COOLANT_ON
M117 2D Contour1
; MOVEMENT_CUTTING
G1 X0.374 Y-0.517 Z15 F1000
G1 Z5
; MOVEMENT_PLUNGE
G1 Z1
G1 Z-2
; MOVEMENT_FINISH_CUTTING
G1 X-13.813 Y15.784
G1 X4.786 Y26.219
etc…

So the milling and everything goes correctly, M117 results in a floating window with the current operation name (contour name), but what I get right in the start with M0 is a floating window saying “Paused for user continue” and waiting for a button press, instead of “Turn ON 5000RPM”. I don’t know why it is interpreted incorrectly.
However, in Marlin mode, “Turn ON 5000RPM” is displayed in the bottom line of the screen and waiting for the user responce normally. So, the issue is with displaying of the M0 custom string in the TFT mode.

Guys, I’ve tried everything I could to compile the TFT Firmware anew, but i get the following error in VSCode:

> Executing task: pio run <

Processing BIGTREE_TFT35_E3_V3_0 (platform: ststm32; framework: stm32cube; board: STM32F103VC)
-------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/STM32F103VC.html
PLATFORM: ST STM32 (11.0.0) > STM32F103VC (48k RAM. 256k Flash)
HARDWARE: STM32F103VCT6 72MHz, 48KB RAM, 256KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES: 
 - framework-stm32cubef1 1.8.3 
 - tool-ldscripts-ststm32 0.1.0 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
AssertionError: Missing MCU or Product Line field:
  File "/Users/valeryosipov/.platformio/penv/lib/python3.8/site-packages/platformio/builder/main.py", line 177:
    env.SConscript("$BUILD_SCRIPT")
  File "/Users/valeryosipov/.platformio/packages/tool-scons/scons-local-4.1.0/SCons/Script/SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/Users/valeryosipov/.platformio/packages/tool-scons/scons-local-4.1.0/SCons/Script/SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/Users/valeryosipov/.platformio/platforms/ststm32/builder/main.py", line 99:
    target_elf = env.BuildProgram()
  File "/Users/valeryosipov/.platformio/packages/tool-scons/scons-local-4.1.0/SCons/Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "/Users/valeryosipov/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 61:
    env.ProcessProgramDeps()
  File "/Users/valeryosipov/.platformio/packages/tool-scons/scons-local-4.1.0/SCons/Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "/Users/valeryosipov/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 127:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "/Users/valeryosipov/.platformio/packages/tool-scons/scons-local-4.1.0/SCons/Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "/Users/valeryosipov/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 342:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "/Users/valeryosipov/.platformio/packages/tool-scons/scons-local-4.1.0/SCons/Script/SConscript.py", line 654:
    return method(*args, **kw)
  File "/Users/valeryosipov/.platformio/packages/tool-scons/scons-local-4.1.0/SCons/Script/SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/Users/valeryosipov/.platformio/packages/tool-scons/scons-local-4.1.0/SCons/Script/SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/Users/valeryosipov/.platformio/platforms/ststm32/builder/frameworks/stm32cube.py", line 43:
    assert PRODUCT_LINE, "Missing MCU or Product Line field"
================================== [FAILED] Took 0.47 seconds ==================================

Environment            Status    Duration
---------------------  --------  ------------
BIGTREE_TFT35_E3_V3_0  FAILED    00:00:00.468
============================= 1 failed, 0 succeeded in 00:00:00.468 =============================
The terminal process "pio 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Have you ever encountered this? I can buid the official firmware, but cannot any custom release for the MPCNC. Please help!

Are you making any edits to the firmware (or the platform.ini file)? I’m not sure if it has been built more recently. I wonder if one of the dependencies broke.

Shoot. I am getting the same error.

Try changing the platform to add in this version number:

 # BIGTREE TFT35 E3 V3.0
 #
 [env:BIGTREE_TFT35_E3_V3_0]
-platform      = ststm32
+platform      = ststm32@9.0.0
 framework     = stm32cube
 board         = STM32F103VC
 upload_protocol = cmsis-dap

Make sure you get the right env for what you are building.

3 Likes

Success, thank you, Jeff!

1 Like

So I’ve found the G28 XY end gcode in configuration_adv.h which was causing homing in Marlin mode after stopping the print.

Now, I really have not enough brain to figure out how to let M0 show its real string in TFT mode. Now after successful compilation of the V1 generic BTT TFT firmware (from Github) two messages appear on the TFT screen one after the other on "M0 Turn on spindle 25000rpm" command:

  1. Paused by M0 command; and in a second
  2. Paused for user continue?

I’ve searched through the TFT source files and found at least two blocks of code containing these strings:

language_en.h

#define EN_M0_PAUSE “Paused by M0 command”

parseACK.c

// Parse pause message
else if(ack_seen(“paused for user”))
{
showDialog(DIALOG_TYPE_QUESTION, (u8*)“Printer is Paused”,(u8*)“Paused for user\ncontinue?”,
textSelect(LABEL_CONFIRM), NULL, breakAndContinue, NULL,NULL);
}

I think if we change the TFT code similarly to the original Marlin firmware (which still applies correctly to the Marlin mode), we will finally have a nice pause menu waiting for user for probe on start, change tool, probe after toolchange, etc. in the TFT mode as well.

Otherwise, it still works but not obvious what each pause is for.

You might check the latest firmware and see if they have fixed that or not yet. I had to change a lot of code, so I am not looking forward to updating. So our code was forked from a while ago.

You need to pick up the pause message from the M0 command and store it where the dialog creation can use it.

1 Like

I’m far from being a programmer, maybe someone with coding skills could implement that change? Call for help))
There’s a new btt tft firmware out there, but after upgrade to test the M0 command I’ve got a “no printer connected” message. Although, the communication is on - all axes move from the tft menu, the coordinates shown on display are always 0,0,0. I’ve decided to revert to the “original” V1 CNC build for now.

Someday. But I don’t have time now.

After a couple weeks of surfing, researching, playing with source code, etc… I finally landed on this topic that pretty much gave me my “ah ha!” moment!! :slight_smile: Thanks, Loki, for shedding light on it. If my understanding is correct, and changes I want to make to the Bigtree Touch Screen (i.e. new buttons/commands) will have to be done to the Bigtree TFT src code… not the marlin code! I’m still struggling with how/why those are/seem completely separate. At the very least, I would have thought that they would have to be in “sync” kinda. My first impression as the the TFT was simply a screen, and the Marlin(SKR 1.3) was the computer… like a PC monitor and motherboard…

Last night, after a couple trials/errors, I did my first customization to the MOVE menu, allowing me to move 100mm at a time (only had 0.1, 1, and 10mm before) - allowing me to click only 4 times to move my router over 400mm instead of 40times! I’m betting MOST of us are making big CNC tables, right? Who wouldn’t want that!?

For my next trick, I’d like to add buttons for using my Z touch plate. The Z-home button doesn’t work the way I want. Or, I need to figure out how to change it’s command. Sure would be nice the get that double touch thing working that I’ve seen in various videos! Anyway, in the meantime, I was able to add a custom command in config.ini for it. It’s a little kludgey (sp?) kloooogy… having to go through several menus just to get to CUSTOM. Would be nice to have it right there in the HOME menu.

I’m no programmer. Been a UNIX/LINUX admin for ~30 years, so I’m real good at scripting. Coding HTML and javascript is also pretty cake… Hacking all this C++ isn’t so bad, but due to my lack, I’m slow. I’ll figure it out eventually, and then hopefully get to contribute back to this great project. I’ve already done some amazing things on my LOWRIDER2!

Would be great to see some videos or more discussions on this exact topic. Adding menus, adding buttons, etc. And how the TFT screen relates to the SKR (or whatever controller)… I’m not likely to use MARLIN mode (or so it seems this point in time) so maybe I will want to do everything in the TFT src.

Feel free to shed more light and thanks to all you guys/gals who got it all this far. I’m really excited and have wanted to bring my wood working hobby and my computer geekness together for a LONG time now. I’m finally there!

2 Likes

Sorry - that was long! I type real fast! :wink: