mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-07-19 04:37:49 -06:00
🐛 Fix Configuration Embedding (#25688)
This commit is contained in:
parent
78bdf34b7b
commit
cc35cb3876
2 changed files with 14 additions and 5 deletions
|
@ -66,11 +66,19 @@ void GcodeSuite::M502() {
|
||||||
|
|
||||||
#if ENABLED(CONFIGURATION_EMBEDDING)
|
#if ENABLED(CONFIGURATION_EMBEDDING)
|
||||||
if (parser.seen_test('C')) {
|
if (parser.seen_test('C')) {
|
||||||
SdBaseFile file;
|
MediaFile file;
|
||||||
const uint16_t size = sizeof(mc_zip);
|
|
||||||
// Need to create the config size on the SD card
|
// Need to create the config size on the SD card
|
||||||
if (file.open(card.getroot(), "mc.zip", O_WRITE|O_CREAT) && file.write(pgm_read_ptr(mc_zip), size) != -1 && file.close())
|
MediaFile root = card.getroot();
|
||||||
SERIAL_ECHO_MSG("Configuration saved as 'mc.zip'");
|
if (file.open(&root, "mc.zip", O_WRITE|O_CREAT)) {
|
||||||
|
bool success = true;
|
||||||
|
for (uint16_t i = 0; success && i < sizeof(mc_zip); ++i) {
|
||||||
|
const uint8_t c = pgm_read_byte(&mc_zip[i]);
|
||||||
|
file.write(c);
|
||||||
|
}
|
||||||
|
success = file.close() && success;
|
||||||
|
|
||||||
|
if (success) SERIAL_ECHO_MSG("Configuration saved as 'mc.zip'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,13 +56,14 @@ def compute_build_signature(env):
|
||||||
files_to_keep = [ 'Marlin/Configuration.h', 'Marlin/Configuration_adv.h' ]
|
files_to_keep = [ 'Marlin/Configuration.h', 'Marlin/Configuration_adv.h' ]
|
||||||
|
|
||||||
build_path = Path(env['PROJECT_BUILD_DIR'], env['PIOENV'])
|
build_path = Path(env['PROJECT_BUILD_DIR'], env['PIOENV'])
|
||||||
|
build_path_relative = Path('.pio', 'build', env['PIOENV'])
|
||||||
|
|
||||||
# Check if we can skip processing
|
# Check if we can skip processing
|
||||||
hashes = ''
|
hashes = ''
|
||||||
for header in files_to_keep:
|
for header in files_to_keep:
|
||||||
hashes += get_file_sha256sum(header)[0:10]
|
hashes += get_file_sha256sum(header)[0:10]
|
||||||
|
|
||||||
marlin_json = build_path / 'marlin_config.json'
|
marlin_json = build_path_relative / 'marlin_config.json'
|
||||||
marlin_zip = build_path / 'mc.zip'
|
marlin_zip = build_path / 'mc.zip'
|
||||||
|
|
||||||
# Read existing config file
|
# Read existing config file
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue