mulcmu / esphome-marlin-uart

Custom ESPhome device
MIT License
1 stars 2 forks source link

WOW brilliant did it support any printer running marlin 2.0 #1

Open GamerClassN7 opened 2 years ago

GamerClassN7 commented 2 years ago

Would be possible to use it with Carlity Ender 3 With board 4.2.7 which have exposed 5v gnd rx tx pins ?

Maybe would be nice to have button to auto home printer right or to send costume gcode for example to turn off fans and geating by automation after printer finished the print :)

I am open to co-operation in development if possible :)

P.S. Would be nice to convert this repo to officinal ESP external component standard, so it is more easy accessible to other users :) https://esphome.io/components/external_components.html

mulcmu commented 11 months ago

My configuration was pretty similar to yours.

#define HOST_ACTION_COMMANDS     
#if ENABLED(HOST_ACTION_COMMANDS)
  #define HOST_PAUSE_M76                // Tell the host to pause in response to M76
  #define HOST_PROMPT_SUPPORT           // Initiate host prompts to get user feedback
  #if BOTH(HOST_PROMPT_SUPPORT, TFT_BTT_UI) || BOTH(HOST_PROMPT_SUPPORT, MOD_BTT_UI)
    #define HOST_STATUS_NOTIFICATIONS   // Send some status messages to the host as notifications
  #endif
  //#define HOST_START_MENU_ITEM          // Add a menu item that tells the host to start
  //#define HOST_SHUTDOWN_MENU_ITEM       // Add a menu item that tells the host to shut down
#endif

Is EMERGENCY_PARSER and/or SERIAL_PORT_2 defined?

Can you send the M118 command in gcode or via terminal and see the output in the ESPHOME logs?

fran6120 commented 11 months ago

My configuration was pretty similar to yours.

#define HOST_ACTION_COMMANDS     
#if ENABLED(HOST_ACTION_COMMANDS)
  #define HOST_PAUSE_M76                // Tell the host to pause in response to M76
  #define HOST_PROMPT_SUPPORT           // Initiate host prompts to get user feedback
  #if BOTH(HOST_PROMPT_SUPPORT, TFT_BTT_UI) || BOTH(HOST_PROMPT_SUPPORT, MOD_BTT_UI)
    #define HOST_STATUS_NOTIFICATIONS   // Send some status messages to the host as notifications
  #endif
  //#define HOST_START_MENU_ITEM          // Add a menu item that tells the host to start
  //#define HOST_SHUTDOWN_MENU_ITEM       // Add a menu item that tells the host to shut down
#endif

Is EMERGENCY_PARSER and/or SERIAL_PORT_2 defined?

Yes, both EMERGENCY_PARSER and SERIAL_PORT_2 are defined.

"SERIAL_PORT_2 2" (pins 16, 17)

Can you send the M118 command in gcode or via terminal and see the output in the ESPHOME logs?

Sending "M118 E1 P0 TEST" in esphome log I receive an empty message and in the LCD notifications "echo: TEST"

By empty I mean this:

[11:43:59][D][component.MarlinUART:262]:  T:17.77 /0.00 B:17.62 /0.00 @:0 B@:0

[11:43:59][D][sensor:094]: 'Genius Temperatura Extrusor': Sending state 17.77000 C with 1 decimals of accuracy
[11:43:59][D][sensor:094]: 'Genius Setpoint Extrusor': Sending state 0.00000 C with 1 decimals of accuracy
[11:43:59][D][sensor:094]: 'Genius Temperatura Cama': Sending state 17.62000 C with 1 decimals of accuracy
[11:43:59][D][sensor:094]: 'Genius Setpoint Cama': Sending state 0.00000 C with 1 decimals of accuracy
[11:43:59][D][component.MarlinUART:262]: X:-3.0000 Y:-3.0000 Z:0.0000 E:0.0000 Count X:-300 Y:-300 Z:0

[11:44:01][D][component.MarlinUART:262]: 

[11:44:01][D][component.MarlinUART:262]:  T:17.73 /0.00 B:17.77 /0.00 @:0 B@:0

[11:44:01][D][sensor:094]: 'Genius Temperatura Extrusor': Sending state 17.73000 C with 1 decimals of accuracy
[11:44:01][D][sensor:094]: 'Genius Setpoint Extrusor': Sending state 0.00000 C with 1 decimals of accuracy
[11:44:01][D][sensor:094]: 'Genius Temperatura Cama': Sending state 17.77000 C with 1 decimals of accuracy
[11:44:01][D][sensor:094]: 'Genius Setpoint Cama': Sending state 0.00000 C with 1 decimals of accuracy
[11:44:01][D][component.MarlinUART:262]: X:-3.0000 Y:-3.0000 Z:0.0000 E:0.0000 Count X:-300 Y:-300 Z:0

just in the midle.

On the other hand, while the esphome log is running, if I restart tft/marlin, I receive this:

[11:43:15][D][component.MarlinUART:262]: start

[11:43:15][D][component.MarlinUART:262]: Marlin 2.1.2

[11:43:15][D][component.MarlinUART:262]: echo: Last Updated: 2022-12-17 | Author: (DIGA-Tech, ASWX1 v1.0)

[11:43:15][D][component.MarlinUART:262]: echo: Compiled: Nov 22 2023

[11:43:15][D][component.MarlinUART:262]: echo: Free Memory: 2359  PlannerBufferBytes: 1280

[11:43:15][D][component.MarlinUART:262]: echo:V87 stored settings retrieved (642 bytes; crc 11303)

[11:43:15][D][component.MarlinUART:262]: //action:notification Stored settings retrieved

[11:43:15][D][component.MarlinUART:262]: Unified Bed Leveling System v1.01 inactive

[11:43:15][D][component.MarlinUART:262]: UBL reset

[11:43:15][D][component.MarlinUART:262]: //action:prompt_end
mulcmu commented 11 months ago

Are you able to make the change to M118.cpp from this post and retest the M118 commands? I ran into this problem before but thought it was something unique to my setup/machine.

fran6120 commented 11 months ago

Replacing SERIAL_ECHOLN(p); with SERIAL_ECHO(p); SERIAL_EOL(); It compiles correctly but after flashing it there is no serial communication on any port.

GamerClassN7 commented 3 months ago

@mulcmu any news on reading the Time remaining and progress ?

GamerClassN7 commented 3 months ago

It seams they are read correctly but esp home sets them as unknown for some reason :/ image

GamerClassN7 commented 3 months ago

i also manage to add soem debug messages to code maybe it can help image

GamerClassN7 commented 3 months ago

image

how ever i dont see any messages with time elapsed whitch is parsed in this section pf custom component image

GamerClassN7 commented 3 months ago

could this bee and issue that new version of marlin are not returning elapsed time correctly ?

mulcmu commented 3 months ago

I migrated my printer to Klipper so don't have a way to test this any longer.

The code sends M27 command to get remaining time.
https://github.com/mulcmu/esphome-marlin-uart/blob/e4e13a94faaf5f44fe52af80595c3a97e9b69c18/esphome-marlin-uart.h#L95

The reply from this command needs to activate the logic to process the current print time: https://github.com/mulcmu/esphome-marlin-uart/blob/e4e13a94faaf5f44fe52af80595c3a97e9b69c18/esphome-marlin-uart.h#L336-L358

So you could try to tweak check on line 338 to match what you printer replies to M27 and line 342 based on how long the prefix is before the hour/min/seconds.

GamerClassN7 commented 3 months ago

@mulcmu thank you for advice