Add HAS_FAN and others
This commit is contained in:
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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), \
|
||||
|
@ -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), \
|
||||
|
@ -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), \
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user