darkspr1te / MKSTFT_Marlin_Touch

A port of the BigTreetech Touchscreen Firmware for Marlin 3d printer boards- Added support for Makerbase MKS TFT28/MKSTFT32, should not be hard to port to other lcd's
34 stars 21 forks source link

MKS WiFi? #4

Open ETE-Design opened 4 years ago

ETE-Design commented 4 years ago

So to understand it correct it is not possible to just insert the MKS WiFi Module in the connector, so have to router RX / TX direct to the board? How well is this working with ESP3D? Know Luo had some problems with letting the MKS WiFi Module accept All gcodes cause MKS TFT blocked for the commands...

luc-github commented 4 years ago

seems ok https://github.com/darkspr1te/MKSTFT_Marlin_Touch/issues/3#issuecomment-572149837

ETE-Design commented 4 years ago

@luc-github Can you write a "How To", would like to test this with your ESP3D

ETE-Design commented 4 years ago

@darkspr1te Is it possible to do 12864 Emulation like BBT TFT Support?

darkspr1te commented 4 years ago

12864 emulation is there, wire your encoder to pb1,pb0 and enable in config, i've not tested much beyond confirming it received text and accepted input.

ETE-Design commented 4 years ago

@darkspr1te Should also be possible without the encoder right? Have Steen screens without encoder emulate it, it just add arrows at the Buttom of the screen...

Uz45 commented 4 years ago

Please tell us more about how you enabled emulation mode. What you need to do in a Marlin and what to do in MKSTFT_Marlin_Touch. I thought this was impossible due to the lack of a hardware SPI connection.

darkspr1te commented 4 years ago

emulation mode is enabled by #define LCD_ENCA_PIN ,LCD_ENCB_PIN,LCD_BTN_PIN which then defines LCD_ENCODER_SUPPORT(variants.h), the device then switches to LCD12864 in nowmode (void menumode in mode.c) but i cannot get it to work currently. Prior attempt was maybe working by hard coding some routines which was done in early days for testing. it's maybe possible to disable SD support on the dispay and use that SPI or use that SPI and another pin for chip select, but it may cause issues when printing via sd. I am currently putting finishing touches to the new TFT bootloader and will return to this project shortly. feedback and testing on the bootloader (inc firmware update features) would be welcome. darkspr1te

ETE-Design commented 4 years ago

@darkspr1te I have the MKS32 V4.0 so can help you test when your ready... Just need a how to for that model :-) Also what features Will a new bootloader give that is not already aviable?

darkspr1te commented 4 years ago

We only have bootloader backups for 3 devices, with a open source one we can port it to any of the stm/lcd combo's. Feature wise is not really crazy, basic read from sd write to flash/eeprom in the basic version and LCD routines in the bloated bootloader version. i will use that repo for adding the planned features like Firmware file select , crc check of firmware , update via ESP (we already have esp flash support but that requires esp to be connected to SWD, am currently adding a boot vector for updating via serial UART2) and there is another esp code snippet that adds uart flashing support. Even though there is esp firmware for OTA of the esp I would like to add a SD to esp bridge flashing (in case of blank esp or issues with wifi link or firmware). So to sum up the current build offers no new feature set over factory that will change to a bootloader that can be tailored to your needs. So any feedback is welcome. darkspr1te

darkspr1te commented 4 years ago

@darkspr1te I have the MKS32 V4.0 so can help you test when your ready... Just need a how to for that model :-) Also what features Will a new bootloader give that is not already aviable?

Repo's

https://github.com/darkspr1te/mksbootloader - This version includes TFT routines https://github.com/darkspr1te/stm32f107vc_sd_bootloader - basic only - supports stm32f107/105 chips currently.

On the how to side, do you have a device able to flash the unit ? like stlink v2/jtag or BMP

darkspr1te commented 4 years ago

@darkspr1te I have the MKS32 V4.0 so can help you test when your ready... Just need a how to for that model :-) Also what features Will a new bootloader give that is not already aviable?

The one good feature this bootloader does have over the factory one, You can mute it, my factory MK4 BL is loud and annoying (even more so if you rebooting every few seconds for testing of code or if you hardfault/watchdog restart) I've also added error 'beeps by error number' which can/will be used in many ways in the future eg crc checks

ETE-Design commented 4 years ago

@darkspr1te Okey, would be a really nice feature if you could find a way to use 12864 Emulation, know a lot of people would like to have this :-)

darkspr1te commented 4 years ago

It's a fair bit of work, it's hard coded to SPI2 &PB12 /CS but i've started a branch for the feature.

Uz45 commented 4 years ago

I have a suggestion for changing the bootloader without using STLink. Use the loader inside MKSTFT_Marlin_Touch to load the bootloader.bin, which is also uploaded as update files from the SD card. I have the code and it works. If it's interesting, I'll post it.

darkspr1te commented 4 years ago

By All means post it , I have a app that does this already but it's dedicated (you have to convert bin to array) but a bootloader in-app-update is a good idea, although it will require some checks to ensure you dont brick device for non stlink/jtag owners. am asuming it would something similar to the font loading routine but with different file/address. As BTT are updating their code quite a lot I have done another fork to do upstream pull requests , https://github.com/darkspr1te/BIGTREETECH-TouchScreenFirmware , I hope to have the mks support code pushed upstream.

Uz45 commented 4 years ago

Yes, I used a slightly modified font file upload section. My added load section is activated when vector_table is set !=0x8000000. But I can't imagine how to make protection against errors when updating the loader and getting a brick. I know for sure about one case of loading this firmware on MKS TFT35, via the standard MKS loader. And man who did it got a brick. Given the number of versions of MKS TFT, this task seems impossible to me, at the software level. I think an automatic backup of an existing bootloader before erasing it and an exact instruction on which bootloader is used with this hardware can partially help solve this problem.

I am very lazy and don't want to disassemble the printer every time for experiments :)

GadgetAngel commented 4 years ago

@darkspr1te I also have a MKS TFT32 V4.0 and an ESP-01 from MakerFocus. I would be a tester too. Can I use an ESP-01 from MakerFocus as my WiFi module on the TFT32 or does it have to be an ESP-01S?

darkspr1te commented 4 years ago

I've added guides and tools to debrick and upload new bootloader , all you need is a 3.3v serial adapter(in a pinch you can use marlin board held in reset so you can use the tx/rx from AUX1). latest f/w here https://github.com/darkspr1te/BIGTREETECH-TouchScreenFirmware works 100% with esp3d wifi and standard cable (AUX1) , i've submitted my patches to the master branch which will mean in most case we will get the features as soon as they are pushed and not have to wait for a patch for mks devices, we wont be lagging behind in that aspect.
darkspr1te

darkspr1te commented 4 years ago

@darkspr1te I also have a MKS TFT32 V4.0 and an ESP-01 from MakerFocus. I would be a tester too. Can I use an ESP-01 from MakerFocus as my WiFi module on the TFT32 or does it have to be an ESP-01S?

ESP-01(NB: with upgraded 4mb flash, 1mb or less wont work) , connect tx to RXD/rx to TXD on wifi plug, 3.3v to JTAG 3.3v, GND to jtag GND. flash with esp3d before hand. use https://github.com/darkspr1te/BIGTREETECH-TouchScreenFirmware build with default_envs = MKS_32_V1_4 set in platformio.ini ,