Start setting up for filament; sizes as scheduling constraints

This commit is contained in:
Reid 'arrdem' McKenzie 2023-07-06 23:55:03 -06:00
parent c218bade5c
commit 76996ccd84
4 changed files with 138 additions and 19 deletions

View file

@ -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. A priority penalty may be called for.
## Notes ## 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?

View file

@ -157,10 +157,124 @@ CREATE TABLE IF NOT EXISTS email_spool (
, FOREIGN KEY(user_id) REFERENCES users(id) , 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 -- 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'); 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 -- Users
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
@ -428,6 +542,8 @@ SET
, url = :url , url = :url
, stream_url = :stream_url , stream_url = :stream_url
, api_key = :api_key , api_key = :api_key
, filament_load = :filament_load
, enabled = (CASE WHEN LOWER(:enabled) = 'true' THEN 1 ELSE 0)
WHERE WHERE
id = :id id = :id
; ;

View file

@ -88,3 +88,7 @@ label {
padding-right: 0px; padding-right: 0px;
} }
} }
input[type='text'], select {
width: 100%;
}

View file

@ -27,6 +27,23 @@
<input type="text" name="api_key" value="{{ printer.api_key }}" /> <input type="text" name="api_key" value="{{ printer.api_key }}" />
</div> </div>
</div> </div>
<div class"row">
<div class="six columns">
<label for="filament_load">Filament load</label>
<select name="filament_load">
<option value="pla" {% if printer.filament_load == "pla"%}selected{%endif%}>PLA</option>
<option value="petg" {% if printer.filament_load == "petg" %}selected{%endif%}>PETG</option>
<option value="abs" {% if printer.filament_load == "abs" %}selected{%endif%}>ABS</option>
</select>
</div>
<div class="six columns">
<label for="enabled">Printing enabled</label>
<select name="enabled">
<option value="true" {% if printer.enabled %}selected{%endif%}>Enabled</option>
<option value="false" {% if not printer.enabled %}selected{%endif%}>Disabled</option>
</select>
</div>
</div>
<div class="row"> <div class="row">
<input type="hidden" name="id" value="{{ printer.id }}" /> <input type="hidden" name="id" value="{{ printer.id }}" />
<input id="submit" type="submit" value="Submit" /> <input id="submit" type="submit" value="Submit" />