Skip to content

Commit 68d52ba

Browse files
committed
Enable hitting Done for AMS-free operation
1 parent 89805ce commit 68d52ba

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

bambu/src/main/java/com/tfyre/bambu/printer/BambuPrinter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public interface BambuPrinter {
4040

4141
void commandFullStatus(final boolean force);
4242

43+
void commandDone();
44+
4345
void commandClearPrinterError();
4446

4547
void commandLight(BambuConst.LightMode lightMode);

bambu/src/main/java/com/tfyre/bambu/printer/BambuPrinterImpl.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,19 @@ public void commandSystemReboot() {
368368
toJson(message).ifPresent(this::sendData);
369369
}
370370

371+
@Override
372+
public void commandDone() {
373+
logUser("%s: commandDone".formatted(name));
374+
final BambuMessage message = BambuMessage.newBuilder()
375+
.setPrint(
376+
com.tfyre.bambu.model.Print.newBuilder()
377+
.setSequenceId("%d".formatted(counter.incrementAndGet()))
378+
.setCommand("done")
379+
)
380+
.build();
381+
toJson(message).ifPresent(this::sendData);
382+
}
383+
371384
@Override
372385
public void commandFilamentUnload() {
373386
logUser("%s: commandFilamentUnload".formatted(name));

bambu/src/main/java/com/tfyre/bambu/view/dashboard/DashboardPrinter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ private Div buildName() {
408408
newButton("Show SD Card", VaadinIcon.ARCHIVE, l -> UI.getCurrent().navigate(SdCardView.class, printer.getName())),
409409
newButton("Request full status", VaadinIcon.REFRESH, l -> printer.commandFullStatus(true)),
410410
newButton("Clear Print Error", VaadinIcon.WARNING, l -> printer.commandClearPrinterError()),
411+
newButton("Send Done", VaadinIcon.ENTER, l -> printer.commandDone()),
411412
newButton("Resume Print", VaadinIcon.PLAY, l -> doConfirm(BambuConst.CommandControl.RESUME)),
412413
newButton("Pause Print", VaadinIcon.PAUSE, l -> doConfirm(BambuConst.CommandControl.PAUSE)),
413414
newButton("Stop Print", VaadinIcon.STOP, l -> doConfirm(BambuConst.CommandControl.STOP))

0 commit comments

Comments
 (0)