Color UI Move Screen for 320x240 TFT (#21708)

This commit is contained in:
David
2021-04-28 11:08:21 +02:00
committed by GitHub
parent f7f88b7187
commit 2e0a1f1aff
11 changed files with 526 additions and 96 deletions

View File

@@ -170,6 +170,13 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
}
#endif
#if HAS_TEMP_COOLER
else if (Heater == H_COOLER) {
if (currentTemperature <= 26) Color = COLOR_COLD;
if (currentTemperature > 26) Color = COLOR_RED;
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
}
#endif
tft.add_image(8, 28, image, Color);
@@ -234,6 +241,9 @@ void MarlinUI::draw_status_screen() {
#ifdef ITEM_CHAMBER
case ITEM_CHAMBER: draw_heater_status(x, y, H_CHAMBER); break;
#endif
#ifdef ITEM_COOLER
case ITEM_COOLER: draw_heater_status(x, y, H_COOLER); break;
#endif
#ifdef ITEM_FAN
case ITEM_FAN: draw_fan_status(x, y, blink); break;
#endif
@@ -543,7 +553,6 @@ struct MotionAxisState {
float currentStepSize = 10.0;
int z_selection = Z_SELECTION_Z;
uint8_t e_selection = 0;
bool homming = false;
bool blocked = false;
char message[32];
};
@@ -608,16 +617,11 @@ static void drawMessage(const char *msg) {
tft.add_text(0, 0, COLOR_YELLOW, msg);
}
static void drawAxisValue(AxisEnum axis) {
const float value =
#if HAS_BED_PROBE
axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ?
probe.offset.z :
#endif
NATIVE_TO_LOGICAL(
ui.manual_move.processing ? destination[axis] : SUM_TERN(IS_KINEMATIC, current_position[axis], ui.manual_move.offset),
axis
);
static void drawAxisValue(const AxisEnum axis) {
const float value = (
TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :)
ui.manual_move.axis_value(axis)
);
xy_int_t pos;
uint16_t color;
switch (axis) {
@@ -633,7 +637,7 @@ static void drawAxisValue(AxisEnum axis) {
tft.add_text(0, 0, color, tft_string);
}
static void moveAxis(AxisEnum axis, const int8_t direction) {
static void moveAxis(const AxisEnum axis, const int8_t direction) {
quick_feedback();
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
@@ -699,23 +703,11 @@ static void moveAxis(AxisEnum axis, const int8_t direction) {
#endif
// Get the new position
const bool limited = ui.manual_move.apply_diff(axis, diff, min, max);
#if IS_KINEMATIC
ui.manual_move.offset += diff;
if (direction < 0)
NOLESS(ui.manual_move.offset, min - current_position[axis]);
else
NOMORE(ui.manual_move.offset, max - current_position[axis]);
UNUSED(limited);
#else
current_position[axis] += diff;
const char *msg = NUL_STR; // clear the error
if (direction < 0 && current_position[axis] < min) {
current_position[axis] = min;
msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
}
else if (direction > 0 && current_position[axis] > max) {
current_position[axis] = max;
msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
}
PGM_P const msg = limited ? GET_TEXT(MSG_LCD_SOFT_ENDSTOPS) : NUL_STR;
drawMessage(msg);
#endif
@@ -913,7 +905,4 @@ void MarlinUI::move_axis_screen() {
TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
}
#undef BTN_WIDTH
#undef BTN_HEIGHT
#endif // HAS_UI_480x320