sliceInfo

This commit is contained in:
Rick Companje 2018-01-29 17:12:27 +01:00
parent 13cc1238f1
commit 602b5b35fe
2 changed files with 9 additions and 5 deletions

View File

@ -60,7 +60,10 @@ const styles = {
flexShrink: 0,
},
sliceInfo: {
margin: '10px 0'
margin: '10px 0',
'& p': {
marginBottom: '5px'
}
},
sliceButtons: {
justifyContent: 'flex-end',

View File

@ -155,13 +155,14 @@ export async function slice(target, name, mesh, settings, updateProgress) {
case 'WIFI':
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: 0 };
if (state !== 'idle') throw { message: 'printer is busy', code: 0 };
} else {
wifiBox = new Doodle3DBox(settings.ip);
if (!await wifiBox.checkAlive()) throw { message: `can't connect to printer`, code: 4 }
const { state } = await wifiBox.info.status();
if (state !== 'idle') throw { message: 'printer must be idle before starting a print', code: 0 };
if (state !== 'idle') throw { message: 'printer is busy', code: 0 };
}
steps = 2;
break;
@ -203,7 +204,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
const interval = setInterval(() => {
loaded += 15 * 1024;
updateProgress({
action: 'Uploading',
action: 'Uploading to printer',
percentage: (currentStep + loaded / file.size) / steps
});
}, 1000);
@ -211,7 +212,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
// await fetchProgress(`http://${settings.ip}/set?code=M563 S4`, { method: 'GET' });
await fetch(`http://${settings.ip}/upload`, { method: 'POST', body, mode: 'no-cors' }, (progress) => {
updateProgress({
action: 'Uploading',
action: 'Uploading to printer',
percentage: (currentStep + progress.loaded / progress.total) / steps
});
});