Compare commits
No commits in common. "a55cce854edff4059cfde4682fbd232cf478a48e" and "d4348944fc93d481b0eeb53929c5fedf757a11ba" have entirely different histories.
a55cce854e
...
d4348944fc
68
create_combined_binary.py
Normal file
68
create_combined_binary.py
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
Import("env")
|
||||||
|
from os.path import join, exists
|
||||||
|
import shutil
|
||||||
|
import os
|
||||||
|
|
||||||
|
def combine_binaries(source, target, env):
|
||||||
|
# Define paths for binary files
|
||||||
|
build_dir = env.subst("$BUILD_DIR")
|
||||||
|
project_dir = env.subst("$PROJECT_DIR")
|
||||||
|
combined_bin = join(build_dir, "combined.bin")
|
||||||
|
firmware_bin = join(build_dir, "firmware.bin")
|
||||||
|
spiffs_bin = join(build_dir, "spiffs.bin")
|
||||||
|
|
||||||
|
# Define target firmware path
|
||||||
|
firmware_dir = join(project_dir, "firmware")
|
||||||
|
target_firmware = join(firmware_dir, "filaman.bin")
|
||||||
|
|
||||||
|
# Build firmware if it doesn't exist
|
||||||
|
if not exists(firmware_bin):
|
||||||
|
print("Building firmware...")
|
||||||
|
env.Execute("pio run -t buildprog")
|
||||||
|
|
||||||
|
# Build SPIFFS if it doesn't exist
|
||||||
|
if not exists(spiffs_bin):
|
||||||
|
print("Building SPIFFS image...")
|
||||||
|
env.Execute("pio run -t buildfs")
|
||||||
|
|
||||||
|
# Check if files exist after build attempts
|
||||||
|
if not exists(firmware_bin):
|
||||||
|
raise Exception("Firmware binary not found at: " + firmware_bin)
|
||||||
|
|
||||||
|
if not exists(spiffs_bin):
|
||||||
|
raise Exception("SPIFFS binary not found at: " + spiffs_bin)
|
||||||
|
|
||||||
|
print("Found firmware at:", firmware_bin)
|
||||||
|
print("Found SPIFFS at:", spiffs_bin)
|
||||||
|
|
||||||
|
# Command to merge firmware and SPIFFS
|
||||||
|
merge_command = (
|
||||||
|
"esptool.py --chip esp32 merge_bin -o {combined_bin} "
|
||||||
|
"--flash_mode dio --flash_freq 40m --flash_size 4MB "
|
||||||
|
"0x10000 {firmware_bin} 0x310000 {spiffs_bin}"
|
||||||
|
).format(
|
||||||
|
combined_bin=combined_bin,
|
||||||
|
firmware_bin=firmware_bin,
|
||||||
|
spiffs_bin=spiffs_bin
|
||||||
|
)
|
||||||
|
|
||||||
|
print("Executing merge command:", merge_command)
|
||||||
|
env.Execute(merge_command)
|
||||||
|
|
||||||
|
# Create firmware directory if it doesn't exist
|
||||||
|
if not exists(firmware_dir):
|
||||||
|
os.makedirs(firmware_dir)
|
||||||
|
|
||||||
|
# Move combined binary to target location
|
||||||
|
print(f"Moving combined binary to {target_firmware}")
|
||||||
|
shutil.copy2(combined_bin, target_firmware)
|
||||||
|
print(f"Binary successfully moved to {target_firmware}")
|
||||||
|
|
||||||
|
# Register the custom target with explicit dependencies
|
||||||
|
env.AddCustomTarget(
|
||||||
|
name="combine_binaries",
|
||||||
|
dependencies=["buildfs", "buildprog"],
|
||||||
|
actions=[combine_binaries],
|
||||||
|
title="Combine Firmware & SPIFFS",
|
||||||
|
description="Combines firmware.bin and spiffs.bin into a single binary"
|
||||||
|
)
|
@ -293,8 +293,7 @@ function displayAmsData(amsData) {
|
|||||||
const trayProperties = [
|
const trayProperties = [
|
||||||
{ key: 'tray_sub_brands', label: 'Sub Brands' },
|
{ key: 'tray_sub_brands', label: 'Sub Brands' },
|
||||||
{ key: 'tray_info_idx', label: 'Filament IDX' },
|
{ key: 'tray_info_idx', label: 'Filament IDX' },
|
||||||
{ key: 'setting_id', label: 'Setting ID' },
|
{ key: 'setting_id', label: 'Setting ID' }
|
||||||
{ key: 'cali_idx', label: 'Calibration IDX' } // Add new property
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Nur gültige Felder anzeigen
|
// Nur gültige Felder anzeigen
|
||||||
@ -418,8 +417,7 @@ function handleSpoolIn(amsId, trayId) {
|
|||||||
nozzle_temp_max: parseInt(maxTemp),
|
nozzle_temp_max: parseInt(maxTemp),
|
||||||
type: selectedSpool.filament.material,
|
type: selectedSpool.filament.material,
|
||||||
brand: selectedSpool.filament.vendor.name,
|
brand: selectedSpool.filament.vendor.name,
|
||||||
tray_info_idx: selectedSpool.filament.extra.bambu_idx.replace(/['"]+/g, '').trim(),
|
tray_info_idx: selectedSpool.filament.extra.bambu_idx.replace(/['"]+/g, '').trim()
|
||||||
cali_idx: selectedSpool.filament.extra.bambu_setting_id.replace(/['"]+/g, '').trim()
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@ function populateVendorDropdown(data, selectedSmId = null) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Nach der Schleife: Formatierung der Gesamtlänge
|
// Nach der Schleife: Formatierung der Gesamtlänge
|
||||||
console.log("Total Lenght: ", totalLength);
|
|
||||||
const formattedLength = totalLength > 1000
|
const formattedLength = totalLength > 1000
|
||||||
? (totalLength / 1000).toFixed(2) + " km"
|
? (totalLength / 1000).toFixed(2) + " km"
|
||||||
: totalLength.toFixed(2) + " m";
|
: totalLength.toFixed(2) + " m";
|
||||||
|
6
partitions.csv
Normal file
6
partitions.csv
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
nvs, data, nvs, 0x9000, 0x4000,
|
||||||
|
otadata, data, ota, 0xd000, 0x2000,
|
||||||
|
app0, app, ota_0, 0x10000, 0x180000,
|
||||||
|
app1, app, ota_1, 0x190000,0x180000,
|
||||||
|
spiffs, data, spiffs, 0x310000,0x0F0000,
|
|
@ -27,7 +27,9 @@ lib_deps =
|
|||||||
digitaldragon/SSLClient @ ^1.3.2
|
digitaldragon/SSLClient @ ^1.3.2
|
||||||
|
|
||||||
; Enable SPIFFS upload
|
; Enable SPIFFS upload
|
||||||
|
board_build.partitions = partitions.csv
|
||||||
board_build.filesystem = spiffs
|
board_build.filesystem = spiffs
|
||||||
|
board_upload.flash_size = 4MB
|
||||||
board_build.spiffs_create = yes
|
board_build.spiffs_create = yes
|
||||||
board_build.spiffs.partition = 2M
|
board_build.spiffs.partition = 2M
|
||||||
board_build.spiffs.upload_size = 2M
|
board_build.spiffs.upload_size = 2M
|
||||||
@ -42,3 +44,14 @@ build_flags =
|
|||||||
extra_scripts =
|
extra_scripts =
|
||||||
pre:gzip_files.py
|
pre:gzip_files.py
|
||||||
pre:extra_script.py
|
pre:extra_script.py
|
||||||
|
post:$PROJECT_DIR/create_combined_binary.py
|
||||||
|
|
||||||
|
# Add custom target for combining binaries
|
||||||
|
custom_targets =
|
||||||
|
combine_binaries
|
||||||
|
|
||||||
|
# Define the build sequence
|
||||||
|
targets =
|
||||||
|
buildfs # Build SPIFFS image
|
||||||
|
buildprog # Build firmware
|
||||||
|
#combine_binaries # Combine both binaries
|
||||||
|
@ -195,7 +195,6 @@ bool setBambuSpool(String payload) {
|
|||||||
String brand = doc["brand"].as<String>();
|
String brand = doc["brand"].as<String>();
|
||||||
String tray_info_idx = doc["tray_info_idx"].as<String>();
|
String tray_info_idx = doc["tray_info_idx"].as<String>();
|
||||||
if (tray_info_idx == "") tray_info_idx = (brand != "" && type != "") ? findFilamentIdx(brand, type) : "";
|
if (tray_info_idx == "") tray_info_idx = (brand != "" && type != "") ? findFilamentIdx(brand, type) : "";
|
||||||
String setting_id = doc["cali_idx"].as<String>();
|
|
||||||
|
|
||||||
doc.clear();
|
doc.clear();
|
||||||
|
|
||||||
@ -207,7 +206,7 @@ bool setBambuSpool(String payload) {
|
|||||||
doc["print"]["nozzle_temp_min"] = minTemp;
|
doc["print"]["nozzle_temp_min"] = minTemp;
|
||||||
doc["print"]["nozzle_temp_max"] = maxTemp;
|
doc["print"]["nozzle_temp_max"] = maxTemp;
|
||||||
doc["print"]["tray_type"] = type;
|
doc["print"]["tray_type"] = type;
|
||||||
doc["print"]["setting_id"] = (setting_id != "") ? setting_id : "";
|
doc["print"]["setting_id"] = "";
|
||||||
doc["print"]["tray_info_idx"] = tray_info_idx;
|
doc["print"]["tray_info_idx"] = tray_info_idx;
|
||||||
|
|
||||||
// Serialize the JSON
|
// Serialize the JSON
|
||||||
@ -331,7 +330,7 @@ void mqtt_callback(char* topic, byte* payload, unsigned int length) {
|
|||||||
ams_data[i].trays[j].tray_color = trayObj["tray_color"].as<String>();
|
ams_data[i].trays[j].tray_color = trayObj["tray_color"].as<String>();
|
||||||
ams_data[i].trays[j].nozzle_temp_min = trayObj["nozzle_temp_min"].as<int>();
|
ams_data[i].trays[j].nozzle_temp_min = trayObj["nozzle_temp_min"].as<int>();
|
||||||
ams_data[i].trays[j].nozzle_temp_max = trayObj["nozzle_temp_max"].as<int>();
|
ams_data[i].trays[j].nozzle_temp_max = trayObj["nozzle_temp_max"].as<int>();
|
||||||
ams_data[i].trays[j].setting_id = trayObj["cali_idx"].as<String>();
|
ams_data[i].trays[j].setting_id = trayObj["setting_id"].as<String>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Serial.println("----------------");
|
//Serial.println("----------------");
|
||||||
@ -369,7 +368,7 @@ void mqtt_callback(char* topic, byte* payload, unsigned int length) {
|
|||||||
ams_data[extIdx].trays[0].tray_color = vtTray["tray_color"].as<String>();
|
ams_data[extIdx].trays[0].tray_color = vtTray["tray_color"].as<String>();
|
||||||
ams_data[extIdx].trays[0].nozzle_temp_min = vtTray["nozzle_temp_min"].as<int>();
|
ams_data[extIdx].trays[0].nozzle_temp_min = vtTray["nozzle_temp_min"].as<int>();
|
||||||
ams_data[extIdx].trays[0].nozzle_temp_max = vtTray["nozzle_temp_max"].as<int>();
|
ams_data[extIdx].trays[0].nozzle_temp_max = vtTray["nozzle_temp_max"].as<int>();
|
||||||
ams_data[extIdx].trays[0].setting_id = vtTray["cali_idx"].as<String>();
|
ams_data[extIdx].trays[0].setting_id = vtTray["setting_id"].as<String>();
|
||||||
ams_count++; // Erhöhe ams_count für die externe Spule
|
ams_count++; // Erhöhe ams_count für die externe Spule
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +395,7 @@ void mqtt_callback(char* topic, byte* payload, unsigned int length) {
|
|||||||
trayObj["tray_color"] = ams_data[i].trays[j].tray_color;
|
trayObj["tray_color"] = ams_data[i].trays[j].tray_color;
|
||||||
trayObj["nozzle_temp_min"] = ams_data[i].trays[j].nozzle_temp_min;
|
trayObj["nozzle_temp_min"] = ams_data[i].trays[j].nozzle_temp_min;
|
||||||
trayObj["nozzle_temp_max"] = ams_data[i].trays[j].nozzle_temp_max;
|
trayObj["nozzle_temp_max"] = ams_data[i].trays[j].nozzle_temp_max;
|
||||||
trayObj["cali_idx"] = ams_data[i].trays[j].setting_id;
|
trayObj["setting_id"] = ams_data[i].trays[j].setting_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user