Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2019-05-07 22:42:58 +0300
committerDavid Crocker <dcrocker@eschertech.com>2019-05-07 22:42:58 +0300
commitaaedf4817b6535ee3339ee890d6b387665baead5 (patch)
tree3ac1246784b3f50cc5f2776ec5129aef4f482a83 /src/Display/Display.cpp
parent126651784b5104348959c6544e14667b37d14c7b (diff)
Release 2.03RC1 provisional again
Fixed bugs in the 12864 menu system Allow prints to be paused and cancelled while they are waiting for temperatures to be reached
Diffstat (limited to 'src/Display/Display.cpp')
-rw-r--r--src/Display/Display.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/Display/Display.cpp b/src/Display/Display.cpp
index 5ee1d6de..37dc7c20 100644
--- a/src/Display/Display.cpp
+++ b/src/Display/Display.cpp
@@ -20,11 +20,14 @@ extern const LcdFont font11x14;
extern const LcdFont font7x11;
const LcdFont * const fonts[] = { &font7x11, &font11x14 };
-const size_t SmallFontNumber = 0;
-const size_t LargeFontNumber = 1;
+constexpr size_t SmallFontNumber = 0;
+constexpr size_t LargeFontNumber = 1;
+
+constexpr uint32_t NormalRefreshMillis = 250;
+constexpr uint32_t FastRefreshMillis = 50;
Display::Display()
- : lcd(nullptr), menu(nullptr), encoder(nullptr),
+ : lcd(nullptr), menu(nullptr), encoder(nullptr), lastRefreshMillis(0),
mboxSeq(0), mboxActive(false), beepActive(false), updatingFirmware(false)
{
}
@@ -39,13 +42,16 @@ void Display::Spin()
{
// Check encoder and update display
const int ch = encoder->GetChange();
+ bool forceRefresh = false;
if (ch != 0)
{
menu->EncoderAction(ch);
+ forceRefresh = true;
}
else if (encoder->GetButtonPress())
{
menu->EncoderAction(0);
+ forceRefresh = true;
}
const MessageBox& mbox = reprap.GetMessageBox();
@@ -62,6 +68,7 @@ void Display::Spin()
mboxActive = true;
mboxSeq = mbox.seq;
menu->DisplayMessageBox(mbox);
+ forceRefresh = true;
}
}
else if (mboxActive)
@@ -69,9 +76,23 @@ void Display::Spin()
// Message box has been cancelled from this or another input channel
menu->ClearMessageBox();
mboxActive = false;
+ forceRefresh = true;
}
- menu->Refresh();
+ const uint32_t now = millis();
+ if (forceRefresh)
+ {
+ menu->Refresh();
+ // To avoid a noticeable delay in updating the coordinates and babystepping offset when live adjusting them and we stop rotating the encoder,
+ // we force another update 50ms after any encoder actions
+ lastRefreshMillis = now - (NormalRefreshMillis - FastRefreshMillis);
+ }
+ else if (now - lastRefreshMillis >= NormalRefreshMillis)
+ {
+ menu->Refresh();
+ // When the encoder is inactive, we update at most 5 times per second, to avoid rapidly-changing values flickering on the display
+ lastRefreshMillis = now;
+ }
}
lcd->FlushSome();