Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/20657
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 4, 2021
2 parents 3f11fc2 + 8ca70a7 commit bb4b4c9
Show file tree
Hide file tree
Showing 24 changed files with 206 additions and 194 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2021-01-03"
#define STRING_DISTRIBUTION_DATE "2021-01-04"
#endif

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ namespace FTDI {

while (has_more_notes()) {
onIdle();
#ifdef EXTENSIBLE_UI
ExtUI::yield();
#endif
TERN_(TOUCH_UI_FTDI_EVE, ExtUI::yield());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using namespace Theme;

void AlertDialogBox::onEntry() {
BaseScreen::onEntry();
sound.play(screen_data.AlertDialogBox.isError ? sad_trombone : twinkle, PLAY_ASYNCHRONOUS);
sound.play(screen_data.AlertDialog.isError ? sad_trombone : twinkle, PLAY_ASYNCHRONOUS);
}

void AlertDialogBox::onRedraw(draw_mode_t what) {
Expand All @@ -45,15 +45,15 @@ template<typename T>
void AlertDialogBox::show(const T message) {
drawMessage(message);
storeBackground();
screen_data.AlertDialogBox.isError = false;
screen_data.AlertDialog.isError = false;
GOTO_SCREEN(AlertDialogBox);
}

template<typename T>
void AlertDialogBox::showError(const T message) {
drawMessage(message);
storeBackground();
screen_data.AlertDialogBox.isError = true;
screen_data.AlertDialog.isError = true;
GOTO_SCREEN(AlertDialogBox);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ void BaseNumericAdjustmentScreen::widgets_t::_button(CommandProcessor &cmd, uint

BaseNumericAdjustmentScreen::widgets_t &BaseNumericAdjustmentScreen::widgets_t::precision(uint8_t decimals, precision_default_t initial) {
_decimals = decimals;
if (screen_data.BaseNumericAdjustmentScreen.increment == 0) {
screen_data.BaseNumericAdjustmentScreen.increment = 243 + (initial - DEFAULT_LOWEST) - _decimals;
if (screen_data.BaseNumericAdjustment.increment == 0) {
screen_data.BaseNumericAdjustment.increment = 243 + (initial - DEFAULT_LOWEST) - _decimals;
}
return *this;
}
Expand Down Expand Up @@ -154,7 +154,7 @@ void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) {
void BaseNumericAdjustmentScreen::widgets_t::_draw_increment_btn(CommandProcessor &cmd, uint8_t, const uint8_t tag) {
const char *label = PSTR("?");
uint8_t pos;
uint8_t & increment = screen_data.BaseNumericAdjustmentScreen.increment;
uint8_t & increment = screen_data.BaseNumericAdjustment.increment;

if (increment == 0) {
increment = tag; // Set the default value to be the first.
Expand Down Expand Up @@ -358,7 +358,7 @@ void BaseNumericAdjustmentScreen::widgets_t::home_buttons(uint8_t tag) {
}

void BaseNumericAdjustmentScreen::onEntry() {
screen_data.BaseNumericAdjustmentScreen.increment = 0; // This will force the increment to be picked while drawing.
screen_data.BaseNumericAdjustment.increment = 0; // This will force the increment to be picked while drawing.
BaseScreen::onEntry();
CommandProcessor cmd;
cmd.set_button_style_callback(nullptr);
Expand All @@ -367,14 +367,14 @@ void BaseNumericAdjustmentScreen::onEntry() {
bool BaseNumericAdjustmentScreen::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: GOTO_PREVIOUS(); return true;
case 240 ... 245: screen_data.BaseNumericAdjustmentScreen.increment = tag; break;
case 240 ... 245: screen_data.BaseNumericAdjustment.increment = tag; break;
default: return current_screen.onTouchHeld(tag);
}
return true;
}

float BaseNumericAdjustmentScreen::getIncrement() {
switch (screen_data.BaseNumericAdjustmentScreen.increment) {
switch (screen_data.BaseNumericAdjustment.increment) {
case 240: return 0.001;
case 241: return 0.01;
case 242: return 0.1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::
}

if (opts & USE_HIGHLIGHT) {
const uint8_t tag = screen_data.BedMeshScreen.highlightedTag;
const uint8_t tag = screen_data.BedMesh.highlightedTag;
uint8_t x, y;
if (tagToPoint(tag, x, y)) {
cmd.cmd(COLOR_A(128))
Expand All @@ -221,16 +221,16 @@ bool BedMeshScreen::tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y) {
}

void BedMeshScreen::onEntry() {
screen_data.BedMeshScreen.highlightedTag = 0;
screen_data.BedMeshScreen.count = GRID_MAX_POINTS;
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE;
screen_data.BedMesh.highlightedTag = 0;
screen_data.BedMesh.count = GRID_MAX_POINTS;
screen_data.BedMesh.message = screen_data.BedMesh.MSG_NONE;
BaseScreen::onEntry();
}

float BedMeshScreen::getHightlightedValue() {
if (screen_data.BedMeshScreen.highlightedTag) {
if (screen_data.BedMesh.highlightedTag) {
xy_uint8_t pt;
tagToPoint(screen_data.BedMeshScreen.highlightedTag, pt.x, pt.y);
tagToPoint(screen_data.BedMesh.highlightedTag, pt.x, pt.y);
return ExtUI::getMeshPoint(pt);
}
return NAN;
Expand All @@ -253,9 +253,9 @@ void BedMeshScreen::drawHighlightedPointValue() {
.tag(1).button(OKAY_POS, GET_TEXT_F(MSG_BUTTON_OKAY))
.tag(0);

switch (screen_data.BedMeshScreen.message) {
case screen_data.BedMeshScreen.MSG_MESH_COMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); break;
case screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE)); break;
switch (screen_data.BedMesh.message) {
case screen_data.BedMesh.MSG_MESH_COMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); break;
case screen_data.BedMesh.MSG_MESH_INCOMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE)); break;
default: break;
}
}
Expand All @@ -277,11 +277,11 @@ void BedMeshScreen::onRedraw(draw_mode_t what) {

if (what & FOREGROUND) {
constexpr float autoscale_max_amplitude = 0.03;
const bool gotAllPoints = screen_data.BedMeshScreen.count >= GRID_MAX_POINTS;
const bool gotAllPoints = screen_data.BedMesh.count >= GRID_MAX_POINTS;
if (gotAllPoints) {
drawHighlightedPointValue();
}
const float levelingProgress = sq(float(screen_data.BedMeshScreen.count) / GRID_MAX_POINTS);
const float levelingProgress = sq(float(screen_data.BedMesh.count) / GRID_MAX_POINTS);
BedMeshScreen::drawMesh(INSET_POS(MESH_POS), ExtUI::getMeshArray(),
USE_POINTS | USE_HIGHLIGHT | USE_AUTOSCALE | (gotAllPoints ? USE_COLORS : 0),
autoscale_max_amplitude * levelingProgress
Expand All @@ -290,7 +290,7 @@ void BedMeshScreen::onRedraw(draw_mode_t what) {
}

bool BedMeshScreen::onTouchStart(uint8_t tag) {
screen_data.BedMeshScreen.highlightedTag = tag;
screen_data.BedMesh.highlightedTag = tag;
return true;
}

Expand Down Expand Up @@ -323,29 +323,29 @@ bool BedMeshScreen::isMeshComplete(ExtUI::bed_mesh_t data) {
void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) {
switch (state) {
case ExtUI::MESH_START:
screen_data.BedMeshScreen.count = 0;
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_NONE;
screen_data.BedMesh.count = 0;
screen_data.BedMesh.message = screen_data.BedMesh.MSG_NONE;
break;
case ExtUI::MESH_FINISH:
if (screen_data.BedMeshScreen.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray()))
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_COMPLETE;
if (screen_data.BedMesh.count == GRID_MAX_POINTS && isMeshComplete(ExtUI::getMeshArray()))
screen_data.BedMesh.message = screen_data.BedMesh.MSG_MESH_COMPLETE;
else
screen_data.BedMeshScreen.message = screen_data.BedMeshScreen.MSG_MESH_INCOMPLETE;
screen_data.BedMeshScreen.count = GRID_MAX_POINTS;
screen_data.BedMesh.message = screen_data.BedMesh.MSG_MESH_INCOMPLETE;
screen_data.BedMesh.count = GRID_MAX_POINTS;
break;
case ExtUI::PROBE_START:
screen_data.BedMeshScreen.highlightedTag = pointToTag(x, y);
screen_data.BedMesh.highlightedTag = pointToTag(x, y);
break;
case ExtUI::PROBE_FINISH:
screen_data.BedMeshScreen.count++;
screen_data.BedMesh.count++;
break;
}
BedMeshScreen::onMeshUpdate(x, y, 0);
}

void BedMeshScreen::startMeshProbe() {
GOTO_SCREEN(BedMeshScreen);
screen_data.BedMeshScreen.count = 0;
screen_data.BedMesh.count = 0;
injectCommands_P(PSTR(BED_LEVELING_COMMANDS));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,17 @@ void ChangeFilamentScreen::drawTempGradient(uint16_t x, uint16_t y, uint16_t w,

void ChangeFilamentScreen::onEntry() {
BaseScreen::onEntry();
screen_data.ChangeFilamentScreen.e_tag = ExtUI::getActiveTool() + 10;
screen_data.ChangeFilamentScreen.t_tag = 0;
screen_data.ChangeFilamentScreen.repeat_tag = 0;
screen_data.ChangeFilamentScreen.saved_extruder = getActiveTool();
screen_data.ChangeFilament.e_tag = ExtUI::getActiveTool() + 10;
screen_data.ChangeFilament.t_tag = 0;
screen_data.ChangeFilament.repeat_tag = 0;
screen_data.ChangeFilament.saved_extruder = getActiveTool();
#if FILAMENT_UNLOAD_PURGE_LENGTH > 0
screen_data.ChangeFilamentScreen.need_purge = true;
screen_data.ChangeFilament.need_purge = true;
#endif
}

void ChangeFilamentScreen::onExit() {
setActiveTool(screen_data.ChangeFilamentScreen.saved_extruder, true);
setActiveTool(screen_data.ChangeFilament.saved_extruder, true);
}

void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
Expand Down Expand Up @@ -170,7 +170,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {

const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10;

if (screen_data.ChangeFilamentScreen.t_tag && !t_ok) {
if (screen_data.ChangeFilament.t_tag && !t_ok) {
cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING));
} else if (getActualTemp_celsius(e) > 100) {
cmd.cmd(COLOR_RGB(0xFF0000))
Expand All @@ -181,12 +181,12 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {

#define TOG_STYLE(A) colors(A ? action_btn : normal_btn)

const bool tog2 = screen_data.ChangeFilamentScreen.t_tag == 2;
const bool tog3 = screen_data.ChangeFilamentScreen.t_tag == 3;
const bool tog4 = screen_data.ChangeFilamentScreen.t_tag == 4;
const bool tog10 = screen_data.ChangeFilamentScreen.e_tag == 10;
const bool tog2 = screen_data.ChangeFilament.t_tag == 2;
const bool tog3 = screen_data.ChangeFilament.t_tag == 3;
const bool tog4 = screen_data.ChangeFilament.t_tag == 4;
const bool tog10 = screen_data.ChangeFilament.e_tag == 10;
#if HAS_MULTI_HOTEND
const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11;
const bool tog11 = screen_data.ChangeFilament.e_tag == 11;
#endif

cmd.TOG_STYLE(tog10)
Expand All @@ -200,8 +200,8 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {

if (!t_ok) reset_menu_timeout();

const bool tog7 = screen_data.ChangeFilamentScreen.repeat_tag == 7;
const bool tog8 = screen_data.ChangeFilamentScreen.repeat_tag == 8;
const bool tog7 = screen_data.ChangeFilament.repeat_tag == 7;
const bool tog8 = screen_data.ChangeFilament.repeat_tag == 8;

{
char str[30];
Expand All @@ -228,7 +228,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
}

uint8_t ChangeFilamentScreen::getSoftenTemp() {
switch (screen_data.ChangeFilamentScreen.t_tag) {
switch (screen_data.ChangeFilament.t_tag) {
case 2: return LOW_TEMP;
case 3: return MED_TEMP;
case 4: return HIGH_TEMP;
Expand All @@ -237,7 +237,7 @@ uint8_t ChangeFilamentScreen::getSoftenTemp() {
}

ExtUI::extruder_t ChangeFilamentScreen::getExtruder() {
switch (screen_data.ChangeFilamentScreen.e_tag) {
switch (screen_data.ChangeFilament.e_tag) {
case 13: return ExtUI::E3;
case 12: return ExtUI::E2;
case 11: return ExtUI::E1;
Expand All @@ -248,8 +248,8 @@ ExtUI::extruder_t ChangeFilamentScreen::getExtruder() {
void ChangeFilamentScreen::doPurge() {
#if FILAMENT_UNLOAD_PURGE_LENGTH > 0
constexpr float purge_distance_mm = FILAMENT_UNLOAD_PURGE_LENGTH;
if (screen_data.ChangeFilamentScreen.need_purge) {
screen_data.ChangeFilamentScreen.need_purge = false;
if (screen_data.ChangeFilament.need_purge) {
screen_data.ChangeFilament.need_purge = false;
MoveAxisScreen::setManualFeedrate(getExtruder(), purge_distance_mm);
ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(getExtruder()) + purge_distance_mm, getExtruder());
}
Expand Down Expand Up @@ -277,23 +277,23 @@ bool ChangeFilamentScreen::onTouchEnd(uint8_t tag) {
case 3:
case 4:
// Change temperature
screen_data.ChangeFilamentScreen.t_tag = tag;
screen_data.ChangeFilament.t_tag = tag;
setTargetTemp_celsius(getSoftenTemp(), getExtruder());
break;
case 7:
screen_data.ChangeFilamentScreen.repeat_tag = (screen_data.ChangeFilamentScreen.repeat_tag == 7) ? 0 : 7;
screen_data.ChangeFilament.repeat_tag = (screen_data.ChangeFilament.repeat_tag == 7) ? 0 : 7;
break;
case 8:
screen_data.ChangeFilamentScreen.repeat_tag = (screen_data.ChangeFilamentScreen.repeat_tag == 8) ? 0 : 8;
screen_data.ChangeFilament.repeat_tag = (screen_data.ChangeFilament.repeat_tag == 8) ? 0 : 8;
break;
case 10:
case 11:
// Change extruder
screen_data.ChangeFilamentScreen.e_tag = tag;
screen_data.ChangeFilamentScreen.t_tag = 0;
screen_data.ChangeFilamentScreen.repeat_tag = 0;
screen_data.ChangeFilament.e_tag = tag;
screen_data.ChangeFilament.t_tag = 0;
screen_data.ChangeFilament.repeat_tag = 0;
#if FILAMENT_UNLOAD_PURGE_LENGTH > 0
screen_data.ChangeFilamentScreen.need_purge = true;
screen_data.ChangeFilament.need_purge = true;
#endif
setActiveTool(getExtruder(), true);
break;
Expand All @@ -319,7 +319,7 @@ bool ChangeFilamentScreen::onTouchHeld(uint8_t tag) {

void ChangeFilamentScreen::onIdle() {
reset_menu_timeout();
if (screen_data.ChangeFilamentScreen.repeat_tag) onTouchHeld(screen_data.ChangeFilamentScreen.repeat_tag);
if (screen_data.ChangeFilament.repeat_tag) onTouchHeld(screen_data.ChangeFilament.repeat_tag);
if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) {
onRefresh();
refresh_timer.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ void MoveEScreen::onRedraw(draw_mode_t what) {
w.heading( GET_TEXT_F(MSG_E_MOVE));
w.color(Theme::e_axis);
#if EXTRUDERS == 1
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), screen_data.MoveAxisScreen.e_rel[0], canMove(E0));
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), screen_data.MoveAxis.e_rel[0], canMove(E0));
#elif HAS_MULTI_EXTRUDER
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxisScreen.e_rel[0], canMove(E0));
w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxisScreen.e_rel[1], canMove(E1));
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxis.e_rel[0], canMove(E0));
w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxis.e_rel[1], canMove(E1));
#if EXTRUDERS > 2
w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), screen_data.MoveAxisScreen.e_rel[2], canMove(E2));
w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), screen_data.MoveAxis.e_rel[2], canMove(E2));
#endif
#if EXTRUDERS > 3
w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), screen_data.MoveAxisScreen.e_rel[3], canMove(E3));
w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), screen_data.MoveAxis.e_rel[3], canMove(E3));
#endif
#endif
w.increments();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "../config.h"

#if ENABLED(TOUCH_UI_FTDI_EVE) && defined(TOUCH_UI_COCOA_PRESS)
#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS)

#include "screens.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "../config.h"

#if ENABLED(TOUCH_UI_FTDI_EVE) && defined(TOUCH_UI_COCOA_PRESS)
#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS)

#include "screens.h"
#include "screen_data.h"
Expand Down Expand Up @@ -54,7 +54,7 @@ void PreheatTimerScreen::draw_message(draw_mode_t what) {
}

uint16_t PreheatTimerScreen::secondsRemaining() {
const uint32_t elapsed_sec = (millis() - screen_data.PreheatTimerScreen.start_ms) / 1000;
const uint32_t elapsed_sec = (millis() - screen_data.PreheatTimer.start_ms) / 1000;
return (COCOA_PRESS_PREHEAT_SECONDS > elapsed_sec) ? COCOA_PRESS_PREHEAT_SECONDS - elapsed_sec : 0;
}

Expand Down Expand Up @@ -118,7 +118,7 @@ void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, progmem_st
}

void PreheatTimerScreen::onEntry() {
screen_data.PreheatTimerScreen.start_ms = millis();
screen_data.PreheatTimer.start_ms = millis();
}

void PreheatTimerScreen::onRedraw(draw_mode_t what) {
Expand Down
Loading

0 comments on commit bb4b4c9

Please sign in to comment.