Skip to content

Commit 97e3720

Browse files
committed
Fix lambda, add test
1 parent 122bb48 commit 97e3720

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

Marlin/src/gcode/temp/M306.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ void GcodeSuite::M306_report(const bool forReplay/*=true*/) {
6969
SERIAL_ECHOPAIR_F(" C", constants.block_heat_capacity, 2);
7070
SERIAL_ECHOPAIR_F(" R", constants.sensor_responsiveness, 4);
7171
SERIAL_ECHOPAIR_F(" A", constants.ambient_xfer_coeff_fan0, 4);
72-
SERIAL_ECHOLNPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4);
72+
#if ENABLED(MPC_INCLUDE_FAN)
73+
SERIAL_ECHOLNPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4);
74+
#endif
7375
}
7476
}
7577

Marlin/src/lcd/menu/menu_advanced.cpp

+10-18
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,6 @@ void menu_backlash();
257257
#define MPC_EDIT_DEFS(N) \
258258
MPC_t &c = thermalManager.temp_hotend[N].constants; \
259259
TERN_(MPC_INCLUDE_FAN, editable.decimal = c.ambient_xfer_coeff_fan0 + c.fan255_adjustment)
260-
#if HAS_MULTI_HOTEND
261-
static uint8_t current_mpc_hotend = 0;
262-
void mpc_edit_hotend(const uint8_t e);
263-
#endif
264260
#endif
265261

266262
void menu_advanced_temperature() {
@@ -356,14 +352,21 @@ void menu_backlash();
356352
#define MPC_EDIT_ITEMS(N) \
357353
_MPC_EDIT_ITEMS(N); \
358354
EDIT_ITEM_FAST_N(float43, N, MSG_MPC_AMBIENT_XFER_COEFF_FAN255_E, &editable.decimal, 0, 1, []{ \
359-
thermalManager.temp_hotend[N].constants.fan255_adjustment = editable.decimal - thermalManager.temp_hotend[N].constants.ambient_xfer_coeff_fan0; \
360-
});
355+
c.fan255_adjustment = editable.decimal - c.ambient_xfer_coeff_fan0; \
356+
})
361357
#else
362358
#define MPC_EDIT_ITEMS _MPC_EDIT_ITEMS
363359
#endif
364360

365361
#if HAS_MULTI_HOTEND
366-
#define MPC_ENTRY(N) SUBMENU_N(N, MSG_MPC_EDIT, []{ mpc_edit_hotend(MenuItemBase::itemIndex); });
362+
auto mpc_edit_hotend = [&](const uint8_t e) {
363+
MPC_EDIT_DEFS(e);
364+
START_MENU();
365+
BACK_ITEM(MSG_TEMPERATURE);
366+
MPC_EDIT_ITEMS(e);
367+
END_MENU();
368+
};
369+
#define MPC_ENTRY(N) SUBMENU_N(N, MSG_MPC_EDIT, [&]{ mpc_edit_hotend(MenuItemBase::itemIndex); });
367370
#else
368371
#define MPC_ENTRY MPC_EDIT_ITEMS
369372
#endif
@@ -397,17 +400,6 @@ void menu_backlash();
397400
END_MENU();
398401
}
399402

400-
#if ENABLED(MPC_EDIT_MENU) && HAS_MULTI_HOTEND
401-
void mpc_edit_hotend(const uint8_t e) {
402-
current_mpc_hotend = e;
403-
MPC_EDIT_DEFS(e);
404-
START_MENU();
405-
BACK_ITEM(MSG_TEMPERATURE);
406-
MPC_EDIT_ITEMS(current_mpc_hotend);
407-
END_MENU();
408-
}
409-
#endif
410-
411403
#endif // SHOW_MENU_ADVANCED_TEMPERATURE
412404

413405
#if DISABLED(SLIM_LCD_MENUS)

buildroot/tests/BIGTREE_GTR_V1_0

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \
3838
MPC_SENSOR_RESPONSIVENESS '{ 0.22f, 0.22f, 0.22f }' \
3939
MPC_AMBIENT_XFER_COEFF '{ 0.068f, 0.068f, 0.068f }' \
4040
MPC_AMBIENT_XFER_COEFF_FAN255 '{ 0.097f, 0.097f, 0.097f }'
41-
opt_enable SWITCHING_TOOLHEAD TOOL_SENSOR MPCTEMP
41+
opt_enable SWITCHING_TOOLHEAD TOOL_SENSOR MPCTEMP MPC_EDIT_MENU MPC_AUTOTUNE_MENU
4242
opt_disable PIDTEMP
4343
exec_test $1 $2 "BigTreeTech GTR | MPC | Switching Toolhead | Tool Sensors" "$3"
4444

0 commit comments

Comments
 (0)