concat doodle3d printer and the doodle3d wifi box into one target

This commit is contained in:
casperlamboo 2018-01-24 16:06:39 +01:00
parent de2acfe6be
commit 56929c6af7

View File

@ -152,7 +152,6 @@ export async function slice(target, name, mesh, settings, updateProgress) {
steps = 1;
break;
case 'WIFI':
case 'DOODLE3D-WIFI-BOX':
if (settings.printer === 'doodle3d_printer') {
const { state } = await getMalyanStatus(settings.ip);
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': {
if (settings.printer === 'doodle3d_printer') {
const body = new FormData();
const file = new File([gcode], 'doodle.gcode', { type: 'plain/text' });
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
});
});
currentStep ++;
await fetchProgress(`http://${settings.ip}/set?code=M566 ${name}.gcode`, { 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
const { data: { reservation, id } } = await fetch(`${GCODE_SERVER_URL}/upload`, { method: 'POST' })
.then(response => response.json());
@ -235,6 +233,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
const url = `${CONNECT_URL}?uuid=${id}`;
const popup = window.open(url, '_blank');
if (!popup) throw { message: 'popup was blocked by browser', code: 3, url };
}
break;
}