Skip to content

Commit

Permalink
Merge pull request #196 from TFyre/fsteyn/x1e
Browse files Browse the repository at this point in the history
feat: add x1e support
  • Loading branch information
TFyre authored Dec 11, 2024
2 parents 8483392 + 143e070 commit d367027
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 14 additions & 7 deletions bambu/src/main/java/com/tfyre/bambu/printer/BambuConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,25 +279,32 @@ public String getHtmlColor() {
}

public enum PrinterModel {
UNKNOWN("unknown"),
A1("a1"),
A1MINI("a1mini"),
P1P("p1p"),
P1S("p1s"),
X1C("x1c");
UNKNOWN("unknown", false),
A1("a1", false),
A1MINI("a1mini", false),
P1P("p1p", false),
P1S("p1s", false),
X1C("x1c", true),
X1E("x1e", true);

private static final Map<String, PrinterModel> MAP = EnumSet.allOf(PrinterModel.class).stream().collect(Collectors.toMap(PrinterModel::getModel, Function.identity()));

private final String model;
private final boolean temperature;

private PrinterModel(final String model) {
private PrinterModel(final String model, final boolean temperature) {
this.model = model;
this.temperature = temperature;
}

public String getModel() {
return model;
}

public boolean isTemperature() {
return temperature;
}

public static Optional<PrinterModel> fromModel(final String model) {
return Optional.ofNullable(MAP.get(model));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ private FlexLayout buildStatus() {
wrapTemperature(getBadge("Bed", bedImage, bed, bedTarget), () -> (int) temperatureBed, BambuConst.TEMPERATURE_MAX_BED, BambuConst::gcodeTargetTemperatureBed)
);

if (printer.getModel() == BambuConst.PrinterModel.X1C) {
if (printer.getModel().isTemperature()) {
result.add(getBadge("Frame", frameImage, frame));
}

Expand All @@ -632,7 +632,7 @@ private Div buildAmsHeader(final AmsHeader header) {
new Span(header.id()),
newSpan("filler")
);
if (printer.getModel() == BambuConst.PrinterModel.X1C) {
if (printer.getModel().isTemperature()) {
result.add(header.temperature());
}
result.add(header.humidity());
Expand Down

0 comments on commit d367027

Please sign in to comment.