Skip to content

Commit

Permalink
Prepare custom filament temperatures
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Jan 21, 2024
1 parent 1ca74d7 commit 406f05b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gui/custom_filament_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace custom_filament_tools {

int8_t currentslot = 1;
int8_t currentslot;

void SetCurrentSlot(int8_t slot) {
currentslot = slot;
Expand Down
19 changes: 18 additions & 1 deletion src/marlin_stubs/pause/M701_2_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,24 @@ void GcodeSuite::M703() {
++text_begin; // move pointer from '"' to first letter
const char *text_end = strchr(text_begin, '"');
if (text_end) {
strlcpy(slotname, text_begin, sizeof(slotname));
size_t length = text_end - text_begin;
strlcpy(slotname, text_begin, min(length + 1, sizeof(slotname)));
switch (slot) {
case 1:
config_store().filament_name_1.set(slotname);
break;
case 2:
config_store().filament_name_2.set(slotname);
break;
case 3:
config_store().filament_name_3.set(slotname);
break;
case 4:
config_store().filament_name_4.set(slotname);
break;
default:
break;
}
}
}
}
Expand Down

0 comments on commit 406f05b

Please sign in to comment.