Clon1998 / mobileraker

A Flutter mobile app for Klipper/Moonraker
Other
479 stars 52 forks source link

Black page with when T0 macro is defined #397

Closed noobydp closed 1 month ago

noobydp commented 1 month ago

S## Bug Report

Description

I use the toolchange extension: https://github.com/viesturz/klipper-toolchanger with 2 tools defined and I noticed when I add the [gcode_macro T0] (or T1, T2 etc) section to my config, the extruder section in the app shows a grey screen.

Removing the section and restarting the app allows it to show the controls, with the option to swap between extruders.

This isnt high priority for me as I'm able to remove that section from my config, but I was half way through writing this ticket when I figured out what exactly was causing the bug so I figured I'd submit anyway.

[tool T0]
tool_number: 0
extruder: extruder
gcode_x_offset: 0.0
gcode_y_offset: 0.0
gcode_z_offset: 0.0
# # params_servo_angle: 100
params_park_x: 199
params_park_y: -63
# params_park_retract_mm: 5
# params_park_retract_speed: 20
# # params_input_shaper_freq_x:
# # params_input_shaper_freq_y:
# # params_shaper_type_x:
# # params_shaper_type_y:

# [gcode_macro T0]
# variable_color: ""
# gcode:
#   SELECT_TOOL T=0

config_with_tool.txt

Steps to Reproduce

  1. add the [gcode_macro T0] to config, firmware restart and kill app
  2. go to the second tab
  3. scroll to the extruder section

Expected Behavior

The extruder controls should appear

Screenshots

Grey box (error) IMG_1173

Expected controls IMG_1175

Version Information

Debug Logs

Logs.zip

Additional Context

Add any other relevant context about the problem here.


Checklist

To help us diagnose the issue, please ensure you've completed the following steps:

Clon1998 commented 1 month ago

Hey there, thanks for informing me. I recently added the tool selection feature, but I was never able to verify if it works with a real tool changer. Instead, I implemented it based on fluids/mainsail's implementation. I will look into this either later today or next week.

noobydp commented 1 month ago

That's awesome, thank you.

Clon1998 commented 1 month ago

I have reviewed the provided logs. Unfortunately, due to an error on my part, UI errors are not currently being logged. It appears that you have disabled crashalytics reporting, as I was unable to find anything in my dashboard. Could you kindly do me a favor and either enable temporary crashalytics logging or provide me with the output of the following Moonraker-API endpoint of your printer?

<YOUR-Printer-IP>/printer/objects/query?gcode_macro%20T0

noobydp commented 1 month ago

I have analytics enabled since I reinstalled the app yesterday. If this still doesn't work I can probably look at compiling the app from source over the weekend and directly debugging... or just send anything else you need.

{ "result": { "eventtime": 218024.23440438, "status": { "gcode_macro T0": { "color": "" } } } }

The actual cfg file has the macro defined like this. I copied it from an example, I dont actually use the variable anywhere. [gcode_macro T0] variable_color: "" gcode: SELECT_TOOL T=0

Edit: facepalm removing the variable_color line makes the app work. The example I used was from here: https://github.com/viesturz/klipper-toolchanger/blob/main/examples/tapchanger%2Btrident/toolhead_n.cfg I'm not sure what its actually used for.

Clon1998 commented 1 month ago

Thank you, that was already helpful. The variable is set to an empty string, which leads to an error on my end. I am attempting to retrieve the integer from the hex color, but because it's empty, an error occurs. I'll commit a fix asap

Clon1998 commented 1 month ago

I'm not sure what its actually used for. I believe it is used to facilitate the identification of your tools if the toolhead supports it. I have just implemented the fix that should address that issue. As you have already noticed, for the time being, you can leave it empty or set the color variable to an actual hex value to prevent the app from displaying the gray screen until I deploy the fix.