Skip to content

Commit 4701289

Browse files
committed
Add AMS options
1 parent e4fcb51 commit 4701289

File tree

9 files changed

+652
-20
lines changed

9 files changed

+652
-20
lines changed

firmware/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ clean:
1717
esphome clean lolin_s2_mini.yaml
1818
esphome clean lolin_s3_mini.yaml
1919
esphome clean esp32-s3-devkitc-1.yaml
20+
esphome clean esp32_s3_super_mini.yaml
2021
rm -rf .esphome/idedata/*
2122
rm -rf ~/.platformio/penv
2223
# build-esp32s2-mini:
@@ -71,4 +72,7 @@ lolin_s3_mini:
7172
run lolin_s3_mini.yaml --device $(USB_ADDRESS)
7273
devkit:
7374
esphome \
74-
run esp32-s3-devkitc-1.yaml --device $(USB_ADDRESS)
75+
run esp32-s3-devkitc-1.yaml --device $(USB_ADDRESS)
76+
s3_super_mini_manual_ams:
77+
esphome \
78+
run esp32-s3-super-mini-manual-ams.yaml --device $(USB_ADDRESS)

firmware/common-manual-ams.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
substitutions:
3+
name: openspool
4+
esphome:
5+
name: ${name}
6+
name_add_mac_suffix: true
7+
project:
8+
name: spuder.openspool
9+
version: ${version}
10+
min_version: 2024.11.0
11+
platformio_options:
12+
build_unflags: -std=gnu++11
13+
build_flags:
14+
- -std=gnu++14
15+
- -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"
16+
on_boot:
17+
then:
18+
#TODO: breahting blue studders a little bit
19+
- light.turn_on:
20+
id: neopixel_light
21+
effect: Breathing Blue
22+
brightness: 100%
23+
- wait_until:
24+
condition:
25+
wifi.connected:
26+
- delay: 100ms
27+
- light.turn_on:
28+
id: neopixel_light
29+
effect: none
30+
- delay: 100ms
31+
- light.turn_on:
32+
id: neopixel_light
33+
effect: Rainbow
34+
- delay: 1s
35+
- light.turn_off:
36+
id: neopixel_light
37+
- delay: 500ms
38+
- script.execute: update_leds
39+
- if:
40+
condition:
41+
lambda: |-
42+
return !id(bambu_lan_access_code).state.empty() &&
43+
!id(bambu_ip_address).state.empty() &&
44+
!id(bambu_serial_number).state.empty();
45+
then:
46+
- logger.log:
47+
level: info
48+
format: "Connecting to Bambu printer"
49+
- mqtt.enable:
50+
id: bambu_mqtt
51+
else:
52+
- logger.log:
53+
level: info
54+
format: "Missing Bambu Credentials, skipping mqtt connect"
55+
- mqtt.disable:
56+
id: bambu_mqtt
57+
# - script.execute: set_all_leds_white
58+
# - lambda: |-
59+
# //TODO: this appears to have broken and no longer blinks blue
60+
# if (!wifi::global_wifi_component->is_connected() &&
61+
# wifi::global_wifi_component->wifi_soft_ap_ip().str() == "192.168.4.1") {
62+
# id(set_led_breathing_blue).execute();
63+
# }
64+
# - lambda: |-
65+
# id(my_ota).set_auth_password("New password");
66+
on_shutdown:
67+
then:
68+
- script.execute: set_leds_off
69+
esp32:
70+
framework:
71+
type: esp-idf
72+
version: 5.3.1
73+
platform_version: 6.9.0 # https://github.com/platformio/platform-espressif32/releases/
74+
sdkconfig_options:
75+
CONFIG_MBEDTLS_HKDF_C: y # Needed for bambu KDF
76+
CONFIG_MBEDTLS_MD_C: y # Needed for bambu KDF
77+
# version: recommended
78+
# sdkconfig_options:
79+
# MBEDTLS_CERTIFICATE_BUNDLE: y
80+
# MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL: y
81+
82+
#TODO: uncomment when ready for bambu support
83+
# external_components:
84+
# - source:
85+
# type: local
86+
# path: components
87+
# components: [pn532, nfc]
88+
89+
packages:
90+
version: !include conf.d/version.yaml
91+
uptime: !include conf.d/uptime.yaml
92+
wifi: !include conf.d/wifi.yaml
93+
web_server: !include conf.d/web_server.yaml
94+
debug: !include conf.d/debug.yaml
95+
# time: !include conf.d/time.yaml
96+
mqtt_bambu_lan: !include conf.d/mqtt_bambu_lan.yaml
97+
filament: !include conf.d/filament.yaml
98+
bambu_printer: !include conf.d/bambu_printer.yaml
99+
automation: !include conf.d/automation.yaml
100+
led-external: !include conf.d/led-external.yaml
101+
ota: !include conf.d/ota.yaml
102+
#update: !include conf.d/update.yaml
103+
api: !include conf.d/api.yaml
104+
logger: !include conf.d/logger.yaml

firmware/conf.d/bambu_ams.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
select:
2+
- platform: template
3+
name: "Number of AMS units"
4+
id: ams_units
5+
optimistic: false
6+
restore_value: true
7+
icon: mdi:printer-3d-nozzle
8+
options:
9+
- "1"
10+
- "2"
11+
- "3"
12+
- "4"
13+
initial_option: "1"
14+
set_action:
15+
then:
16+
- lambda: |-
17+
if (id(bambu_model).state == "A1Mini" || id(bambu_model).state == "A1") {
18+
id(ams_units).publish_state("1");
19+
} else {
20+
id(ams_units).publish_state(x);
21+
}
22+
on_value:
23+
then:
24+
- lambda: |-
25+
ESP_LOGD("AMS", "AMS units set: %s", x.c_str());
26+
web_server:
27+
sorting_group_id: sorting_group_printer_settings
28+
sorting_weight: 100
29+
30+
- platform: template
31+
name: "AMS Number"
32+
id: ams_number
33+
optimistic: false
34+
restore_value: true
35+
icon: mdi:printer-3d-nozzle
36+
options:
37+
- "0"
38+
- "1"
39+
- "2"
40+
- "3"
41+
- "4"
42+
initial_option: "1"
43+
set_action:
44+
then:
45+
- lambda: |-
46+
if (id(bambu_model).state == "A1Mini" || id(bambu_model).state == "A1") {
47+
id(ams_number).publish_state("1");
48+
} else {
49+
if (x == "0") {
50+
id(slot_number).publish_state("1");
51+
}
52+
id(ams_number).publish_state(x);
53+
}
54+
on_value:
55+
then:
56+
- lambda: |-
57+
ESP_LOGD("AMS", "AMS selected: %s", x.c_str());
58+
web_server:
59+
sorting_group_id: sorting_group_ams
60+
61+
- platform: template
62+
name: "Slot Number"
63+
id: slot_number
64+
optimistic: false
65+
restore_value: true
66+
icon: mdi:printer-3d-nozzle
67+
options:
68+
- "1"
69+
- "2"
70+
- "3"
71+
- "4"
72+
initial_option: "1"
73+
set_action:
74+
then:
75+
- lambda: |-
76+
if (id(ams_number).state == "0") {
77+
// Only force to 1 if manually selecting through UI, not from encoder
78+
if (x != id(slot_number).state) {
79+
id(slot_number).publish_state("1");
80+
ESP_LOGD("AMS", "Forcing slot to 1 because AMS is 0");
81+
}
82+
} else {
83+
id(slot_number).publish_state(x);
84+
}
85+
on_value:
86+
then:
87+
- lambda: |-
88+
ESP_LOGD("AMS", "Slot selected: %s", x.c_str());
89+
web_server:
90+
sorting_group_id: sorting_group_ams

0 commit comments

Comments
 (0)