Skip to content

Commit

Permalink
Fix lambda, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 18, 2022
1 parent 122bb48 commit 97e3720
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
4 changes: 3 additions & 1 deletion Marlin/src/gcode/temp/M306.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ void GcodeSuite::M306_report(const bool forReplay/*=true*/) {
SERIAL_ECHOPAIR_F(" C", constants.block_heat_capacity, 2);
SERIAL_ECHOPAIR_F(" R", constants.sensor_responsiveness, 4);
SERIAL_ECHOPAIR_F(" A", constants.ambient_xfer_coeff_fan0, 4);
SERIAL_ECHOLNPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4);
#if ENABLED(MPC_INCLUDE_FAN)
SERIAL_ECHOLNPAIR_F(" F", constants.ambient_xfer_coeff_fan0 + constants.fan255_adjustment, 4);
#endif
}
}

Expand Down
28 changes: 10 additions & 18 deletions Marlin/src/lcd/menu/menu_advanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,6 @@ void menu_backlash();
#define MPC_EDIT_DEFS(N) \
MPC_t &c = thermalManager.temp_hotend[N].constants; \
TERN_(MPC_INCLUDE_FAN, editable.decimal = c.ambient_xfer_coeff_fan0 + c.fan255_adjustment)
#if HAS_MULTI_HOTEND
static uint8_t current_mpc_hotend = 0;
void mpc_edit_hotend(const uint8_t e);
#endif
#endif

void menu_advanced_temperature() {
Expand Down Expand Up @@ -356,14 +352,21 @@ void menu_backlash();
#define MPC_EDIT_ITEMS(N) \
_MPC_EDIT_ITEMS(N); \
EDIT_ITEM_FAST_N(float43, N, MSG_MPC_AMBIENT_XFER_COEFF_FAN255_E, &editable.decimal, 0, 1, []{ \
thermalManager.temp_hotend[N].constants.fan255_adjustment = editable.decimal - thermalManager.temp_hotend[N].constants.ambient_xfer_coeff_fan0; \
});
c.fan255_adjustment = editable.decimal - c.ambient_xfer_coeff_fan0; \
})
#else
#define MPC_EDIT_ITEMS _MPC_EDIT_ITEMS
#endif

#if HAS_MULTI_HOTEND
#define MPC_ENTRY(N) SUBMENU_N(N, MSG_MPC_EDIT, []{ mpc_edit_hotend(MenuItemBase::itemIndex); });
auto mpc_edit_hotend = [&](const uint8_t e) {
MPC_EDIT_DEFS(e);
START_MENU();
BACK_ITEM(MSG_TEMPERATURE);
MPC_EDIT_ITEMS(e);
END_MENU();
};
#define MPC_ENTRY(N) SUBMENU_N(N, MSG_MPC_EDIT, [&]{ mpc_edit_hotend(MenuItemBase::itemIndex); });
#else
#define MPC_ENTRY MPC_EDIT_ITEMS
#endif
Expand Down Expand Up @@ -397,17 +400,6 @@ void menu_backlash();
END_MENU();
}

#if ENABLED(MPC_EDIT_MENU) && HAS_MULTI_HOTEND
void mpc_edit_hotend(const uint8_t e) {
current_mpc_hotend = e;
MPC_EDIT_DEFS(e);
START_MENU();
BACK_ITEM(MSG_TEMPERATURE);
MPC_EDIT_ITEMS(current_mpc_hotend);
END_MENU();
}
#endif

#endif // SHOW_MENU_ADVANCED_TEMPERATURE

#if DISABLED(SLIM_LCD_MENUS)
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/BIGTREE_GTR_V1_0
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ opt_set MOTHERBOARD BOARD_BTT_GTR_V1_0 SERIAL_PORT -1 \
MPC_SENSOR_RESPONSIVENESS '{ 0.22f, 0.22f, 0.22f }' \
MPC_AMBIENT_XFER_COEFF '{ 0.068f, 0.068f, 0.068f }' \
MPC_AMBIENT_XFER_COEFF_FAN255 '{ 0.097f, 0.097f, 0.097f }'
opt_enable SWITCHING_TOOLHEAD TOOL_SENSOR MPCTEMP
opt_enable SWITCHING_TOOLHEAD TOOL_SENSOR MPCTEMP MPC_EDIT_MENU MPC_AUTOTUNE_MENU
opt_disable PIDTEMP
exec_test $1 $2 "BigTreeTech GTR | MPC | Switching Toolhead | Tool Sensors" "$3"

Expand Down

0 comments on commit 97e3720

Please sign in to comment.