CrealityOfficial / K1_Series_Annex

GNU General Public License v2.0
156 stars 25 forks source link

Camera with Mailsail? #3

Open Kaelum opened 11 months ago

Kaelum commented 11 months ago

Is it possible to get the camera to work in Mainsail or fluidd w/o crowsnest? If so, how? The standard Creality Web interface has it, so I would think that there should be a way for this to work with both of them.

Protomosh commented 11 months ago

edit Too fast reading and didnt notice mentioning about crowsnest. i'm not familiar with crowsnest. if its not part of default fluidd install then creality's image has it already as camera did work in fluidd dashboard without any other installation.

for me it did not show up either at first but when i added new camera from fluidd settings. then it did show up working without any problem. see attachment for default settings that i used to add new camera. kuva

Kaelum commented 11 months ago

Ok, it apparently works with fluidd, but it doesn't work with Mainsail. Mainsail won't let you enable the camera either, which is probably part of the reason. I only use fluidd for the editor, as I like the Mailsail UI much better. I guess I won't be able to use the camera until they fix it.

DnG-Crafts commented 11 months ago

i have forked the repo and modified the mainsail package to include the camera stream on the dashboard

https://github.com/DnG-Crafts/K1_Series_Annex

here is a video of me installing the modified mainsail

https://youtu.be/7CcSahW-cR0?t=259

Kaelum commented 11 months ago

I'm gonna hold off, as I don't like adding a 4th column to Mainsail. There is also a problem with Moonraker, as it seems that Creality used a fairly old version and it is no longer compatible with the version of Mainsail that they provided. Since everything is custom, I haven't tried experimenting with using the latest versions of components, as I have no idea which components that Creality has modified and deviate from the base code. When I have some time, I'll take a look at exactly what they changed, and go from there.

In the mean time, I am hoping that Creality will bring all of the components up-to-date and fix whatever it was that they broke with the Mainsail camera. It would be nice if everything was merged into the main original branches as well. The thing that scares me the most is the fact that the current layer and total layers shown in both fluidd and Mainsail, are wrong. If that's solely because of Moonraker is out-of-date, then it's not as much of a concern.

DnG-Crafts commented 11 months ago

ok i have made some progress to getting the update manager to work and camera to work but the setup method is a bit technical so i am trying to find a way to simplify it.

dash sys

DnG-Crafts commented 11 months ago

i have packaged it up and it runs on my k1 max so if anyone wants to try it you can get it here

https://github.com/DnG-Crafts/K1_Series_Annex/tree/main/mainsail_updated

Kaelum commented 11 months ago

I'll take a look at it tomorrow. I was trying to get the Update Manager at least partially working myself, but I didn't really take it very far, as I was realizing that it would take a deep look into what changes they made. Nice work!

Kaelum commented 11 months ago

It looks like the update is incomplete. In the UI it is still not possible to enable the camera.

image

DnG-Crafts commented 11 months ago

make sure you uninstall the previous one before installing the update. once you have crowsnest on the machine it will allow you to enable it

the port needs to be 8080 too, not 4409. port 8080 is the camera stream created by the creality frontend.

cam

also there is still an issue with the layer reporting from klippy to moonraker. the moonraker api "print_stats" key has 0 for the layers but the "virtual_sdcard" key still has the correct layer info so whatever creality changed has broken the moonraker api for the layer which is why it is "0 of 0" in mainsail. i have been trying to find the issue but no luck so far.

Kaelum commented 11 months ago

I changed the port, and I can see the camera in the setup page, but it still won't let me enable the camera. I deleted the old camera settings, and created a new one, but the enable button is still disabled.

Kaelum commented 11 months ago

The other difference that I see is that the Update Manager isn't working like it is for you:

image

And crowsnest does not appear to be running.

DnG-Crafts commented 11 months ago

ahh the repos need recovery, i thought that could be an issue

you need to try a soft recovery.

but first update your time on the printer because they are stuck on 2020

i run this in putty then use update manager

date -s "2023-10-11 14:59:00"

croswnest does not need to run, it only needs to be there to enable that button

DnG-Crafts commented 11 months ago

your moonraker.conf should have this for the update manager, mine does not have klipper too. i did include the moonraker.conf in the tar, strange how you have klipper in the update manager.


[update_manager]
refresh_interval: 168

[update_manager mainsail]
type: web
channel: stable
repo: mainsail-crew/mainsail
path: /usr/data/mainsail

[update_manager crowsnest]
type: git_repo
path: /usr/data/crowsnest
origin: https://github.com/mainsail-crew/crowsnest.git
install_script: tools/install.sh
Kaelum commented 11 months ago

I remember seeing something about soft recovery, but I don't remember where I saw it.

I found it, but it's failing:

image

DnG-Crafts commented 11 months ago

check the moonraker.conf that has the update url for crowsnest and make sure your printers time is correct or the ssl cert will fail when you try to pull the repo

Kaelum commented 11 months ago

crowsnest it up-to-date, but you didn't provide a configuration for moonraker, which is what is failing.

root@creality /root [#] date -s "2023-10-11 02:16:00"
Wed Oct 11 02:16:00 CST 2023

The date is correct, though the time zone is off.

DnG-Crafts commented 11 months ago

the .tar has the moonraker.conf but if you dont do a clean install moonraker wont overwrite it

in the tar its in moonraker/moonraker/moonraker.conf

and it will contain this


[server]
host: 0.0.0.0
port: 7125
klippy_uds_address: /tmp/klippy_uds
max_upload_size: 1024
#enable_debug_logging: False

[file_manager]
queue_gcode_uploads: False
enable_object_processing: False
enable_inotify_warnings: True

[database]
#enable_database_debug: False

[data_store]
temperature_store_size: 600
gcode_store_size: 1000

[machine]
provider: none
validate_service: False
validate_config: False

[authorization]
force_logins: False
cors_domains:
  *.local
  *.lan
  *://app.fluidd.xyz

trusted_clients:
  10.0.0.0/8
  127.0.0.0/8
  169.254.0.0/16
  172.16.0.0/12
  192.168.0.0/16
  FE80::/10
  ::1/128

# enables partial support of Octoprint API
[octoprint_compat]

# enables moonraker to track and store print history.
[history]

[update_manager]
refresh_interval: 168

[update_manager mainsail]
type: web
channel: stable
repo: mainsail-crew/mainsail
path: /usr/data/mainsail

[update_manager crowsnest]
type: git_repo
path: /usr/data/crowsnest
origin: https://github.com/mainsail-crew/crowsnest.git
install_script: tools/install.sh
Kaelum commented 11 months ago

Mine is the same with just a couple additions:

[server]
host: 0.0.0.0
port: 7125
klippy_uds_address: /tmp/klippy_uds
# The maximum size allowed for a file upload (in MiB).  Default 1024 MiB
max_upload_size: 1024
#enable_debug_logging: False
# Path to klippy Unix Domain Socket

[file_manager]
queue_gcode_uploads: False
enable_object_processing: True
enable_inotify_warnings: True

[authorization]
force_logins: False
cors_domains:
  *.local
  *.lan
  *://app.fluidd.xyz

trusted_clients:
  10.0.0.0/8
  127.0.0.0/8
  169.254.0.0/16
  172.16.0.0/12
  192.168.0.0/16
  FE80::/10
  ::1/128

# enables partial support of Octoprint API
[octoprint_compat]

# enables moonraker to track and store print history.
[history]

[database]
#enable_database_debug: False

[data_store]
temperature_store_size: 600
gcode_store_size: 1000

[machine]
provider: none
validate_service: False
validate_config: False

# this enables moonraker's update manager
[update_manager]
refresh_interval: 168
enable_auto_refresh: True

[update_manager mainsail]
type: web
channel: stable
repo: mainsail-crew/mainsail
path: /usr/data/mainsail

[update_manager crowsnest]
type: git_repo
path: /usr/data/crowsnest
origin: https://github.com/mainsail-crew/crowsnest.git
install_script: tools/install.sh
Kaelum commented 11 months ago

In fluidd I am seeing the following warning message:

Moonraker warnings found.
Unable to initialize System Update Provider for distribution: buildroot
DnG-Crafts commented 11 months ago

yeah there does not seem to be a distro for buildroot which is something creality might need to provide in the future.

i am installing it onto a blank k1 motherboard to try and see what is happening because when i try with my printer it just works.

Kaelum commented 11 months ago

I need to head to bed as I have an 8AM meeting. I'll check back in the morning.

DnG-Crafts commented 11 months ago

well it has me beat, i have a brand new mainboard on the desk here.

i installed the root firmware and then the mainsail_updated package and it works, the board is not even inside a printer and it has no camera but the button is enabled.

wtf

wtf2

wtf3

Kaelum commented 11 months ago

Well, that was EZ. I simply did an uninstall, and then an install, and everything worked. In fact, I didn't lose any of my configuration either, which is even more weird.

Thanks a lot for fixing this. I am now seeing exactly what you are.

DnG-Crafts commented 11 months ago

yeah i found with this when i did not uninstall before i installed a new package it caused issues so i always run the uninstall command through putty and then install the new one. you would do the same if you were to switch from mainsail to fluidd.

you wont lose the configs or gcodes uninstalling because they are stored in different directories.

the next step is to figure out why the current printing layer is broken in the api.

if you ever decide you want to disable the creality web portal and replace it with mainsail i have made a version that will do that. again you need to uninstall then copy both the .tar and .sh from this version as both files play a part in disabling and replacing the official web portal. you can restore the creality web portal by using the uninstall command.

https://github.com/DnG-Crafts/K1_Series_Annex/tree/main/mainsail_replace

using this one just sets it up so you do not need to use port 4409 and the camera operates with the default settings so you do not need to add IP:8080 etc. it disables the web-server process used for the creality web portal to free up resources because mainsail uses nginx

nop2 nop1