diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-12-02 13:53:44 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-12-02 13:53:44 +0300 |
commit | a8d6c52f2f8023fc83fdd1facd03e0608b16183c (patch) | |
tree | 54a9dfd1ff173c3d2e6b9db6e1fad2468e27f53b /src/Display/Display.cpp | |
parent | 51926a0b7309aa7845a04f923f8cdf7f0befd0ee (diff) |
Fixed to minor 12864 display create/destroy issues (3.4beta4.1)
M918 P0 deletes any existing display and no longer reports an error
When a display is deleted, set the CS and A0 pins back to inputs
Diffstat (limited to 'src/Display/Display.cpp')
-rw-r--r-- | src/Display/Display.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Display/Display.cpp b/src/Display/Display.cpp index 78fa4977..e27c8c48 100644 --- a/src/Display/Display.cpp +++ b/src/Display/Display.cpp @@ -194,15 +194,26 @@ GCodeResult Display::Configure(GCodeBuffer& gb, const StringRef& reply) THROWS(G if (gb.Seen('P')) { + // Delete any existing LCD, menu and encoder Lcd *tempLcd = nullptr; std::swap(lcd, tempLcd); delete tempLcd; - delete menu; - menu = nullptr; + + Menu *tempMenu = nullptr; + std::swap(menu, tempMenu); + delete tempMenu; + + RotaryEncoder *tempEncoder = nullptr; + std::swap(encoder, tempEncoder); + delete tempEncoder; seen = true; switch (gb.GetUIValue()) { + case 0: // no display + // We have already deleted the display, menu buffer and encoder, so nothing to do here + break; + case 1: // 12864 display, ST7920 controller #ifdef DUET3MINI // On the Duet 3 Mini we use the A0 pin as CS because it more nearly matches the pinout of the display (with the connectors reversed) |