MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / Spin

Method Spin

src/Display/Display.cpp:94–171  ·  view source on GitHub ↗

Keep the display and encoder refreshed. Don't touch the display if we are updating the firmware because the associated RAM may be overwritten by the IAP.

Source from the content-addressed store, hash-verified

92
93// Keep the display and encoder refreshed. Don't touch the display if we are updating the firmware because the associated RAM may be overwritten by the IAP.
94void Display::Spin() noexcept
95{
96 if (lcd != nullptr && !updatingFirmware)
97 {
98 bool forceRefresh = false;
99#if SUPPORT_ROTARY_ENCODER
100 if (encoder != nullptr)
101 {
102 encoder->Poll();
103 // Check encoder and update display
104 const int ch = encoder->GetChange();
105 if (ch != 0)
106 {
107 menu->EncoderAction(ch);
108 forceRefresh = true;
109 }
110 else if (encoder->GetButtonPress())
111 {
112 menu->EncoderAction(0);
113 forceRefresh = true;
114 }
115 }
116#endif
117#if SUPPORT_RESISTIVE_TOUCH
118 if (touchController != nullptr)
119 {
120 uint16_t x, y;
121 bool repeat;
122 if (touchController->Read(x, y, repeat) && menu != nullptr)
123 {
124 menu->HandleTouch(x, y);
125 }
126 }
127#endif
128 {
129 ReadLockedPointer<const MessageBox> mbox = MessageBox::GetLockedCurrent();
130 if (mbox.IsNotNull() && mbox->IsLegacyType())
131 {
132 if (!mboxActive || mboxSeq != mbox->GetSeq())
133 {
134 // New message box to display
135 if (!mboxActive)
136 {
137 menu->ClearHighlighting(); // cancel highlighting and adjustment
138 menu->Refresh();
139 }
140 mboxActive = true;
141 mboxSeq = mbox->GetSeq();
142 menu->DisplayMessageBox(*mbox);
143 forceRefresh = true;
144 }
145 }
146 else if (mboxActive)
147 {
148 // Message box has been cancelled from this or another input channel
149 menu->ClearMessageBox();
150 mboxActive = false;
151 forceRefresh = true;

Callers

nothing calls this directly

Calls 11

GetChangeMethod · 0.80
EncoderActionMethod · 0.80
GetButtonPressMethod · 0.80
HandleTouchMethod · 0.80
ClearHighlightingMethod · 0.80
DisplayMessageBoxMethod · 0.80
ClearMessageBoxMethod · 0.80
PollMethod · 0.45
ReadMethod · 0.45
RefreshMethod · 0.45
FlushSomeMethod · 0.45

Tested by

no test coverage detected