From c1e02eb4f448c68d879ed04cb3557446b778c157 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Thu, 6 Jul 2023 23:55:03 -0600 Subject: [PATCH] Start setting up for filament; sizes as scheduling constraints --- projects/tentacles/README.md | 18 --- .../tentacles/src/python/tentacles/schema.sql | 118 +++++++++++++++++- .../python/tentacles/static/css/style.scss | 4 + .../tentacles/templates/edit_printer.html.j2 | 17 +++ 4 files changed, 138 insertions(+), 19 deletions(-) diff --git a/projects/tentacles/README.md b/projects/tentacles/README.md index 1dc95fa..3b25cb7 100644 --- a/projects/tentacles/README.md +++ b/projects/tentacles/README.md @@ -27,21 +27,3 @@ Running Runs are polled to detect loss/failure. Lost or failed Runs are deleted, A priority penalty may be called for. ## Notes - -Checking bed status on a printer - - $ curl 'http://10.0.0.6/api/plugin/bedready' \ - -X POST \ - -H 'Accept: application/json' \ - -H 'Content-Type: application/json; charset=UTF-8' \ - -H 'Authorization: Bearer ...No creds -' \ - --data-raw '{"command":"check_bed","reference":"reference_2023-05-11T05:22:40.212Z.jpg"}' \ - | jq . - -Uploading a file and starting to print it -- https://github.com/prusa3d/PrusaSlicer/blob/0384d631d6ef1aaadcb68da031eba9a586b102ed/src/slic3r/Utils/OctoPrint.cpp#L936 -- https://docs.octoprint.org/en/master/api/files.html#upload-file-or-create-folder -- &print=true - -Doesn't appear possible to execute request/response g-code through the API? Can't detect when the printer's offsets aren't calibrated? diff --git a/projects/tentacles/src/python/tentacles/schema.sql b/projects/tentacles/src/python/tentacles/schema.sql index a2921b3..e5c1561 100644 --- a/projects/tentacles/src/python/tentacles/schema.sql +++ b/projects/tentacles/src/python/tentacles/schema.sql @@ -157,10 +157,124 @@ CREATE TABLE IF NOT EXISTS email_spool ( , FOREIGN KEY(user_id) REFERENCES users(id) ); --- name: migration-0002-create-occupied-state +-- name: migration-0002-create-occupied-state# -- Create a state representing that the printer needs to be unloaded after a print INSERT OR IGNORE INTO printer_statuses (id, name) VALUES (5, 'occupied'); +-- name: migration-0003-create-printer-chassis# +CREATE TABLE IF NOT EXISTS chassis ( + id INTEGER PRIMARY KEY AUTOINCREMENT + , name TEXT + , limit_x INTEGER + , limit_y INTEGER + , limit_z INTEGER + , limit_bed INTEGER + , limit_hotend INTEGER + , limit_tools INTEGER +); + +INSERT INTO chassis ( + id + , name + , limit_x + , limit_y + , limit_z + , limit_bed + , limit_hotend + , limit_tools +) VALUES ( + 0 + , 'Creality CR-10v3' + , 300 + , 300 + , 400 + , 100 + , 260 + , 1 +); + +ALTER TABLE printers ADD chassis_id INTEGER REFERENCES chassis(id) DEFAULT 1; + +--- name: migration-0004-create-printer-filament# +CREATE TABLE IF NOT EXISTS filament ( + id INTEGER PRIMARY KEY AUTOINCREMENT + , name TEXT + , UNIQUE(name) +); + +INSERT OR IGNORE INTO filament (name) VALUES ('pla'); +INSERT OR IGNORE INTO filament (name) VALUES ('abs'); +INSERT OR IGNORE INTO filament (name) VALUES ('petg'); + +ALTER TABLE printers ADD filament_id INTEGER REFERENCES filament(id) DEFAULT 1; + +-- name: migration-0005-create-printer-properties# +ALTER TABLE printers ADD enabled BOOLEAN default true; +ALTER TABLE printers ADD nozzle_diameter INTEGER default 4; + +-- name: migration-0006-prusa-mini# +INSERT INTO chassis ( + id + , name + , limit_x + , limit_y + , limit_z + , limit_bed + , limit_hotend + , limit_tools +) VALUES ( + 1 + , 'Prusa Mini' + , 180 + , 180 + , 180 + , 100 + , 280 + , 1 +); + +-- name: migration-0007-prusa-i3# +INSERT INTO chassis ( + id + , name + , limit_x + , limit_y + , limit_z + , limit_bed + , limit_hotend + , limit_tools +) VALUES ( + 2 + , 'Prusa i3' + , 250 + , 210 + , 210 + , 120 + , 300 + , 1 +); + +-- name: migration-0008-prusa-xl# +INSERT INTO chassis ( + id + , name + , limit_x + , limit_y + , limit_z + , limit_bed + , limit_hotend + , limit_tools +) VALUES ( + 3 + , 'Prusa XL' + , 360 + , 360 + , 360 + , 120 + , 300 + , 5 +); + ---------------------------------------------------------------------------------------------------- -- Users ---------------------------------------------------------------------------------------------------- @@ -428,6 +542,8 @@ SET , url = :url , stream_url = :stream_url , api_key = :api_key + , filament_load = :filament_load + , enabled = (CASE WHEN LOWER(:enabled) = 'true' THEN 1 ELSE 0) WHERE id = :id ; diff --git a/projects/tentacles/src/python/tentacles/static/css/style.scss b/projects/tentacles/src/python/tentacles/static/css/style.scss index e33a329..b89e6ca 100644 --- a/projects/tentacles/src/python/tentacles/static/css/style.scss +++ b/projects/tentacles/src/python/tentacles/static/css/style.scss @@ -88,3 +88,7 @@ label { padding-right: 0px; } } + +input[type='text'], select { + width: 100%; +} diff --git a/projects/tentacles/src/python/tentacles/templates/edit_printer.html.j2 b/projects/tentacles/src/python/tentacles/templates/edit_printer.html.j2 index 1f3b8f1..0dd1a03 100644 --- a/projects/tentacles/src/python/tentacles/templates/edit_printer.html.j2 +++ b/projects/tentacles/src/python/tentacles/templates/edit_printer.html.j2 @@ -27,6 +27,23 @@ +
+
+ + +
+
+ + +
+