mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 03:23:48 +01:00
concat doodle3d printer and the doodle3d wifi box into one target
This commit is contained in:
parent
de2acfe6be
commit
56929c6af7
@ -152,7 +152,6 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
steps = 1;
|
steps = 1;
|
||||||
break;
|
break;
|
||||||
case 'WIFI':
|
case 'WIFI':
|
||||||
case 'DOODLE3D-WIFI-BOX':
|
|
||||||
if (settings.printer === 'doodle3d_printer') {
|
if (settings.printer === 'doodle3d_printer') {
|
||||||
const { state } = await getMalyanStatus(settings.ip);
|
const { state } = await getMalyanStatus(settings.ip);
|
||||||
if (state !== 'idle') throw { message: 'printer must be idle before starting a print', code: 1 };
|
if (state !== 'idle') throw { message: 'printer must be idle before starting a print', code: 1 };
|
||||||
@ -187,6 +186,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'WIFI': {
|
case 'WIFI': {
|
||||||
|
if (settings.printer === 'doodle3d_printer') {
|
||||||
const body = new FormData();
|
const body = new FormData();
|
||||||
const file = new File([gcode], 'doodle.gcode', { type: 'plain/text' });
|
const file = new File([gcode], 'doodle.gcode', { type: 'plain/text' });
|
||||||
body.append('file', file);
|
body.append('file', file);
|
||||||
@ -198,13 +198,11 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
percentage: currentStep / steps + progress.loaded / progress.total / steps
|
percentage: currentStep / steps + progress.loaded / progress.total / steps
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
currentStep ++;
|
|
||||||
await fetchProgress(`http://${settings.ip}/set?code=M566 ${name}.gcode`, { method: 'GET' });
|
await fetchProgress(`http://${settings.ip}/set?code=M566 ${name}.gcode`, { method: 'GET' });
|
||||||
await fetchProgress(`http://${settings.ip}/set?code=M565`, { method: 'GET' });
|
await fetchProgress(`http://${settings.ip}/set?code=M565`, { method: 'GET' });
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'DOODLE3D-WIFI-BOX': {
|
currentStep ++;
|
||||||
|
} else {
|
||||||
// upload G-code file to AWS S3
|
// upload G-code file to AWS S3
|
||||||
const { data: { reservation, id } } = await fetch(`${GCODE_SERVER_URL}/upload`, { method: 'POST' })
|
const { data: { reservation, id } } = await fetch(`${GCODE_SERVER_URL}/upload`, { method: 'POST' })
|
||||||
.then(response => response.json());
|
.then(response => response.json());
|
||||||
@ -235,6 +233,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
const url = `${CONNECT_URL}?uuid=${id}`;
|
const url = `${CONNECT_URL}?uuid=${id}`;
|
||||||
const popup = window.open(url, '_blank');
|
const popup = window.open(url, '_blank');
|
||||||
if (!popup) throw { message: 'popup was blocked by browser', code: 3, url };
|
if (!popup) throw { message: 'popup was blocked by browser', code: 3, url };
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user