Add HAS_FAN and others

This commit is contained in:
Scott Lahteine
2020-04-27 04:41:18 -05:00
parent 3d45a4bd23
commit 8b3c7dda75
35 changed files with 85 additions and 90 deletions

View File

@ -1072,7 +1072,7 @@ void MarlinUI::draw_status_screen() {
if (TERN0(HAS_HEATED_BED, thermalManager.degTargetBed() > 0)) leds |= LED_A;
if (TERN0(HAS_HOTEND, thermalManager.degTargetHotend(0) > 0)) leds |= LED_B;
#if FAN_COUNT > 0
#if HAS_FAN
if ( TERN0(HAS_FAN0, thermalManager.fan_speed[0])
|| TERN0(HAS_FAN1, thermalManager.fan_speed[1])
|| TERN0(HAS_FAN2, thermalManager.fan_speed[2])
@ -1082,7 +1082,7 @@ void MarlinUI::draw_status_screen() {
|| TERN0(HAS_FAN6, thermalManager.fan_speed[6])
|| TERN0(HAS_FAN7, thermalManager.fan_speed[7])
) leds |= LED_C;
#endif // FAN_COUNT > 0
#endif // HAS_FAN
if (TERN0(HAS_MULTI_HOTEND, thermalManager.degTargetHotend(1) > 0)) leds |= LED_C;

View File

@ -277,7 +277,7 @@ void DGUSScreenVariableHandler::DGUSLCD_SendStringToDisplayPGM(DGUS_VP_Variable
#endif
// Send fan status value to the display.
#if FAN_COUNT > 0
#if HAS_FAN
void DGUSScreenVariableHandler::DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var) {
if (var.memadr) {
DEBUG_ECHOPAIR(" DGUSLCD_SendFanStatusToDisplay ", var.VP);
@ -872,7 +872,7 @@ void DGUSScreenVariableHandler::HandleProbeOffsetZChanged(DGUS_VP_Variable &var,
}
#endif
#if FAN_COUNT
#if HAS_FAN
void DGUSScreenVariableHandler::HandleFanControl(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleFanControl");
*(uint8_t*)var.memadr = *(uint8_t*)var.memadr > 0 ? 0 : 255;

View File

@ -151,7 +151,7 @@ public:
// Hook for live z adjust action
static void HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr);
#endif
#if FAN_COUNT > 0
#if HAS_FAN
// Hook for fan control
static void HandleFanControl(DGUS_VP_Variable &var, void *val_ptr);
#endif
@ -221,7 +221,7 @@ public:
static void DGUSLCD_SendPrintAccTimeToDisplay(DGUS_VP_Variable &var);
static void DGUSLCD_SendPrintsTotalToDisplay(DGUS_VP_Variable &var);
#endif
#if FAN_COUNT > 0
#if HAS_FAN
static void DGUSLCD_SendFanStatusToDisplay(DGUS_VP_Variable &var);
#endif
static void DGUSLCD_SendHeaterStatusToDisplay(DGUS_VP_Variable &var);

View File

@ -56,7 +56,7 @@ const uint16_t VPList_Main[] PROGMEM = {
#if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
#endif
#if FAN_COUNT > 0
#if HAS_FAN
VP_Fan0_Percentage, VP_FAN0_STATUS,
#endif
VP_XPos, VP_YPos, VP_ZPos,
@ -92,7 +92,7 @@ const uint16_t VPList_Status[] PROGMEM = {
#if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set,
#endif
#if FAN_COUNT > 0
#if HAS_FAN
VP_Fan0_Percentage,
#endif
VP_XPos, VP_YPos, VP_ZPos,
@ -192,7 +192,7 @@ const uint16_t VPList_SD_PrintManipulation[] PROGMEM = {
#if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set,
#endif
#if FAN_COUNT > 0
#if HAS_FAN
VP_Fan0_Percentage,
#if FAN_COUNT > 1
VP_Fan1_Percentage,
@ -410,7 +410,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#endif
// Fan Data
#if FAN_COUNT
#if HAS_FAN
#define FAN_VPHELPER(N) \
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \

View File

@ -56,7 +56,7 @@ const uint16_t VPList_Main[] PROGMEM = {
#if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set, VP_BED_STATUS,
#endif
#if FAN_COUNT > 0
#if HAS_FAN
VP_Fan0_Percentage, VP_FAN0_STATUS,
#endif
VP_XPos, VP_YPos, VP_ZPos,
@ -92,7 +92,7 @@ const uint16_t VPList_Status[] PROGMEM = {
#if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set,
#endif
#if FAN_COUNT > 0
#if HAS_FAN
VP_Fan0_Percentage,
#endif
VP_XPos, VP_YPos, VP_ZPos,
@ -191,7 +191,7 @@ const uint16_t VPList_SD_PrintManipulation[] PROGMEM = {
#if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set,
#endif
#if FAN_COUNT > 0
#if HAS_FAN
VP_Fan0_Percentage,
#if FAN_COUNT > 1
VP_Fan1_Percentage,
@ -212,7 +212,7 @@ const uint16_t VPList_SDPrintTune[] PROGMEM = {
VP_T_Bed_Is, VP_T_Bed_Set,
#endif
VP_Feedrate_Percentage,
#if FAN_COUNT > 0
#if HAS_FAN
VP_Fan0_Percentage,
#endif
VP_Flowrate_E0,
@ -409,7 +409,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#endif
// Fan Data
#if FAN_COUNT
#if HAS_FAN
#define FAN_VPHELPER(N) \
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \

View File

@ -73,7 +73,7 @@ const uint16_t VPList_Status[] PROGMEM = {
#if HAS_HEATED_BED
VP_T_Bed_Is, VP_T_Bed_Set,
#endif
#if FAN_COUNT > 0
#if HAS_FAN
VP_Fan0_Percentage,
#endif
VP_XPos, VP_YPos, VP_ZPos,
@ -233,7 +233,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
#endif
// Fan Data
#if FAN_COUNT
#if HAS_FAN
#define FAN_VPHELPER(N) \
VPHELPER(VP_Fan##N##_Percentage, &thermalManager.fan_speed[N], DGUSScreenVariableHandler::DGUSLCD_PercentageToUint8, &DGUSScreenVariableHandler::DGUSLCD_SendPercentageToDisplay), \
VPHELPER(VP_FAN##N##_CONTROL, &thermalManager.fan_speed[N], &DGUSScreenVariableHandler::HandleFanControl, nullptr), \

View File

@ -60,7 +60,7 @@ void TemperatureScreen::onRedraw(draw_mode_t what) {
#if HAS_HEATED_CHAMBER
w.adjuster( 22, GET_TEXT_F(MSG_CHAMBER), getTargetTemp_celsius(CHAMBER));
#endif
#if FAN_COUNT > 0
#if HAS_FAN
w.color(fan_speed).units(GET_TEXT_F(MSG_UNITS_PERCENT));
w.adjuster( 10, GET_TEXT_F(MSG_FAN_SPEED), getTargetFan_percent(FAN0));
#endif
@ -90,7 +90,7 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) {
case 8: UI_DECREMENT(TargetTemp_celsius, E3); break;
case 9: UI_INCREMENT(TargetTemp_celsius, E3); break;
#endif
#if FAN_COUNT > 0
#if HAS_FAN
case 10: UI_DECREMENT(TargetFan_percent, FAN0); break;
case 11: UI_INCREMENT(TargetFan_percent, FAN0); break;
#endif
@ -99,7 +99,7 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) {
REPEAT(HOTENDS, _HOTEND_OFF);
TERN_(HAS_HEATED_BED, setTargetTemp_celsius(0,BED));
TERN_(HAS_HEATED_CHAMBER, setTargetTemp_celsius(0,CHAMBER));
#if FAN_COUNT > 0
#if HAS_FAN
setTargetFan_percent(0,FAN0);
#endif
break;

View File

@ -293,7 +293,7 @@ namespace ExtUI {
}
float getTargetFan_percent(const fan_t fan) {
#if FAN_COUNT > 0
#if HAS_FAN
return thermalManager.fanPercent(thermalManager.fan_speed[fan - FAN0]);
#else
UNUSED(fan);
@ -302,7 +302,7 @@ namespace ExtUI {
}
float getActualFan_percent(const fan_t fan) {
#if FAN_COUNT > 0
#if HAS_FAN
return thermalManager.fanPercent(thermalManager.scaledFanSpeed(fan - FAN0));
#else
UNUSED(fan);
@ -940,7 +940,7 @@ namespace ExtUI {
#endif
#if HAS_HEATED_BED
if (heater == BED)
thermalManager.setTargetBed(LROUND(constrain(value, 0, BED_MAXTEMP - 10)));
thermalManager.setTargetBed(LROUND(constrain(value, 0, BED_MAX_TARGET)));
else
#endif
{
@ -963,7 +963,7 @@ namespace ExtUI {
}
void setTargetFan_percent(const float value, const fan_t fan) {
#if FAN_COUNT > 0
#if HAS_FAN
if (fan < FAN_COUNT)
thermalManager.set_fan_speed(fan - FAN0, map(constrain(value, 0, 100), 0, 100, 0, 255));
#else

View File

@ -522,7 +522,7 @@ void menu_move();
#endif
// First Fan Speed title in "Tune" and "Control>Temperature" menus
#if FAN_COUNT > 0 && HAS_FAN0
#if HAS_FAN && HAS_FAN0
#if FAN_COUNT > 1
#define FAN_SPEED_1_SUFFIX " 1"
#else

View File

@ -334,7 +334,7 @@ void menu_advanced_settings();
EDIT_ITEM(int3, MSG_NOZZLE, &ui.preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15);
#endif
#if HAS_HEATED_BED
EDIT_ITEM(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 10);
EDIT_ITEM(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAX_TARGET);
#endif
#if ENABLED(EEPROM_SETTINGS)
ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings);

View File

@ -47,47 +47,38 @@ uint8_t MarlinUI::preheat_fan_speed[2];
// "Temperature" submenu items
//
void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) {
#if HAS_HOTEND
if (indh >= 0 && ui.preheat_hotend_temp[indh] > 0)
setTargetHotend(_MIN(heater_maxtemp[e] - 15, ui.preheat_hotend_temp[indh]), e);
#else
UNUSED(e);
UNUSED(temph);
#endif
#if HAS_HEATED_BED
if (indb >= 0 && ui.preheat_bed_temp[indb] >= 0) setTargetBed(ui.preheat_bed_temp[indb]);
if (indb >= 0 && ui.preheat_bed_temp[indb] > 0) setTargetBed(ui.preheat_bed_temp[indb]);
#else
UNUSED(indb);
#endif
#if HAS_FAN
set_fan_speed((
#if FAN_COUNT > 1
active_extruder < FAN_COUNT ? active_extruder : 0
#else
0
active_extruder < FAN_COUNT ? active_extruder :
#endif
), fan);
#else
UNUSED(fan);
0), ui.preheat_fan_speed[m]
);
#endif
ui.return_to_status();
}
#if HAS_TEMP_HOTEND
inline void _preheat_end(const uint8_t m, const uint8_t e) {
thermalManager.lcd_preheat(e, m, -1);
}
inline void _preheat_end(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, -1); }
#if HAS_HEATED_BED
inline void _preheat_both(const uint8_t m, const uint8_t e) {
thermalManager.lcd_preheat(e, m, m);
}
inline void _preheat_both(const uint8_t m, const uint8_t e) { thermalManager.lcd_preheat(e, m, m); }
#endif
#endif
#if HAS_HEATED_BED
inline void _preheat_bed(const uint8_t m) {
thermalManager.lcd_preheat(-1, -1, m);
}
inline void _preheat_bed(const uint8_t m) { thermalManager.lcd_preheat(-1, -1, m); }
#endif
#if HAS_TEMP_HOTEND || HAS_HEATED_BED
@ -186,7 +177,7 @@ void menu_temperature() {
// Bed:
//
#if HAS_HEATED_BED
EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAXTEMP - 10, thermalManager.start_watching_bed);
EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed);
#endif
//
@ -199,7 +190,7 @@ void menu_temperature() {
//
// Fan Speed:
//
#if FAN_COUNT > 0
#if HAS_FAN
auto on_fan_update = []{
thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8);
@ -266,7 +257,7 @@ void menu_temperature() {
singlenozzle_item(1);
#endif
#endif // FAN_COUNT > 0
#endif // HAS_FAN
#if HAS_TEMP_HOTEND

View File

@ -132,13 +132,13 @@ void menu_tune() {
// Bed:
//
#if HAS_HEATED_BED
EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAXTEMP - 10, thermalManager.start_watching_bed);
EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed);
#endif
//
// Fan Speed:
//
#if FAN_COUNT > 0
#if HAS_FAN
auto on_fan_update = []{
thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8);
@ -205,7 +205,7 @@ void menu_tune() {
singlenozzle_item(1);
#endif
#endif // FAN_COUNT > 0
#endif // HAS_FAN
//
// Flow:

View File

@ -128,9 +128,9 @@ void _lcd_ubl_build_custom_mesh() {
void _lcd_ubl_custom_mesh() {
START_MENU();
BACK_ITEM(MSG_UBL_BUILD_MESH_MENU);
EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10));
EDIT_ITEM(int3, MSG_UBL_HOTEND_TEMP_CUSTOM, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 15));
#if HAS_HEATED_BED
EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 10));
EDIT_ITEM(int3, MSG_UBL_BED_TEMP_CUSTOM, &custom_bed_temp, BED_MINTEMP, BED_MAX_TARGET);
#endif
ACTION_ITEM(MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
END_MENU();