Skip to content

Commit a65d9ee

Browse files
GMagicianernisv
authored andcommitted
🐛 Fix Configuration Embedding (MarlinFirmware#25688)
1 parent 1dd7b95 commit a65d9ee

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Marlin/src/gcode/eeprom/M500-M504.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,19 @@ void GcodeSuite::M502() {
6666

6767
#if ENABLED(CONFIGURATION_EMBEDDING)
6868
if (parser.seen_test('C')) {
69-
SdBaseFile file;
70-
const uint16_t size = sizeof(mc_zip);
69+
MediaFile file;
7170
// Need to create the config size on the SD card
72-
if (file.open(card.getroot(), "mc.zip", O_WRITE|O_CREAT) && file.write(pgm_read_ptr(mc_zip), size) != -1 && file.close())
73-
SERIAL_ECHO_MSG("Configuration saved as 'mc.zip'");
71+
MediaFile root = card.getroot();
72+
if (file.open(&root, "mc.zip", O_WRITE|O_CREAT)) {
73+
bool success = true;
74+
for (uint16_t i = 0; success && i < sizeof(mc_zip); ++i) {
75+
const uint8_t c = pgm_read_byte(&mc_zip[i]);
76+
file.write(c);
77+
}
78+
success = file.close() && success;
79+
80+
if (success) SERIAL_ECHO_MSG("Configuration saved as 'mc.zip'");
81+
}
7482
}
7583
#endif
7684
}

buildroot/share/PlatformIO/scripts/signature.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,14 @@ def compute_build_signature(env):
5656
files_to_keep = [ 'Marlin/Configuration.h', 'Marlin/Configuration_adv.h' ]
5757

5858
build_path = Path(env['PROJECT_BUILD_DIR'], env['PIOENV'])
59+
build_path_relative = Path('.pio', 'build', env['PIOENV'])
5960

6061
# Check if we can skip processing
6162
hashes = ''
6263
for header in files_to_keep:
6364
hashes += get_file_sha256sum(header)[0:10]
6465

65-
marlin_json = build_path / 'marlin_config.json'
66+
marlin_json = build_path_relative / 'marlin_config.json'
6667
marlin_zip = build_path / 'mc.zip'
6768

6869
# Read existing config file

0 commit comments

Comments
 (0)