diff options
author | David Crocker <dcrocker@eschertech.com> | 2018-11-13 02:35:25 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2018-11-13 02:35:25 +0300 |
commit | 86a555acf94e8988c0d743b1781da350ff5a57e4 (patch) | |
tree | 8ca51e93f513f27c7508c7a945083808d5757fb6 /src/Display/Display.cpp | |
parent | 891a7ff5fb578a82d3ae43f1748be7a347634bee (diff) |
Closer to 2.02RC4
New and changed features:
- Send the mapped fan speed at the start of the fan speed list in the M408 response for PanelDue
- Support PanelDue emergency stop interrupt from UART driver
- Execute residual babystepping immediately
- Warning message are now generated if trying to move motors on internal drivers but VIN is too low or too high
- Increased minimum fullsteps for motor open detection from 4 to 20
- I2C addresses can be specified in hex format e.g. "0x71" or "x71"
- M584 can now use dummy (high) driver numbers to assign an axis or extruder to no driver
- M122 now tells you if the drivers are enabled, or disabled and waiting for the correct voltage
- Added special support for coast-to-end in RecalculateMove
- Brought RADDS build up to date and use RTOS
- Improved HTTP 'page not found' message
- M260 now lets you receive I2C data after sending data
Bug fixes:
- G30 H parameters didn't work if deployprobe.g or retractprobe.g file present
- M600 stopped the machine
- Watchdog initialisation timing was marginal
- Possible fix for issue with using 3 independent Z motors each with a separate endstop switch
- Use a I2C mutex instead of a critical section lock
- Use new I2C driver in CoreNG
- M557 P parameter was not working
- G30 S-2 tool offset was set in the wrong direction
- After G30 S-2, user coordinates were not updated to account for new tool offset
- M918 with a P parameter now resets the display
- Improved the mechanism used to determine which layer is being printed
- 12864 display buttons sometimes disappeared when moving between them
- 12864 display: last byte of images didn't display correctly
- 12864 display: in button commands, "#0" should be substituted, not "menu"
- Don't start executing a G30 S-2 command if no tool is selected
- Http responses now use \r\n as the line ending, not \n
Diffstat (limited to 'src/Display/Display.cpp')
-rw-r--r-- | src/Display/Display.cpp | 135 |
1 files changed, 80 insertions, 55 deletions
diff --git a/src/Display/Display.cpp b/src/Display/Display.cpp index 094a7cad..e8231d43 100644 --- a/src/Display/Display.cpp +++ b/src/Display/Display.cpp @@ -31,69 +31,70 @@ Display::Display() void Display::Init() { - lcd.Init(); encoder.Init(DefaultPulsesPerClick); - IoPort::SetPinMode(LcdBeepPin, OUTPUT_PWM_LOW); -} - -void Display::Start() -{ - lcd.SetFont(SmallFontNumber); - menu.Load("main"); } void Display::Spin(bool full) { - encoder.Poll(); - - if (full) + if (present) { - if (!updatingFirmware) + encoder.Poll(); + + if (full) { - // Check encoder and update display - const int ch = encoder.GetChange(); - if (ch != 0) - { - menu.EncoderAction(ch); - } - else if (encoder.GetButtonPress()) + if (!updatingFirmware) { - menu.EncoderAction(0); + // Check encoder and update display + const int ch = encoder.GetChange(); + if (ch != 0) + { + menu.EncoderAction(ch); + } + else if (encoder.GetButtonPress()) + { + menu.EncoderAction(0); + } + menu.Refresh(); } - menu.Refresh(); + lcd.FlushSome(); } - lcd.FlushSome(); - } - if (beepActive && millis() - whenBeepStarted > beepLength) - { - IoPort::WriteAnalog(LcdBeepPin, 0.0, 0); - beepActive = false; + if (beepActive && millis() - whenBeepStarted > beepLength) + { + IoPort::WriteAnalog(LcdBeepPin, 0.0, 0); + beepActive = false; + } } } void Display::Exit() { - IoPort::WriteAnalog(LcdBeepPin, 0.0, 0); // stop any beep - if (!updatingFirmware) + if (present) { - lcd.TextInvert(false); - lcd.Clear(); - lcd.SetFont(LargeFontNumber); - lcd.SetCursor(20, 0); - lcd.print("Shutting down..."); + IoPort::WriteAnalog(LcdBeepPin, 0.0, 0); // stop any beep + if (!updatingFirmware) + { + lcd.TextInvert(false); + lcd.Clear(); + lcd.SetFont(LargeFontNumber); + lcd.SetCursor(20, 0); + lcd.print("Shutting down..."); + } + lcd.FlushAll(); } - lcd.FlushAll(); } // NOTE: nothing enforces that this beep concludes before another is begun; // that is, in rapid succession of commands, only the last beep issued will be heard by the user void Display::Beep(unsigned int frequency, unsigned int milliseconds) { - whenBeepStarted = millis(); - beepLength = milliseconds; - beepActive = true; - IoPort::WriteAnalog(LcdBeepPin, 0.5, (uint16_t)frequency); + if (present) + { + whenBeepStarted = millis(); + beepLength = milliseconds; + beepActive = true; + IoPort::WriteAnalog(LcdBeepPin, 0.5, (uint16_t)frequency); + } } void Display::SuccessBeep() @@ -108,22 +109,43 @@ void Display::ErrorBeep() GCodeResult Display::Configure(GCodeBuffer& gb, const StringRef& reply) { - if (gb.Seen('P') && gb.GetUIValue() == 1) + bool seen = false; + + if (gb.Seen('P')) { - // 12864 display configuration - present = true; - if (gb.Seen('E')) + seen = true; + switch (gb.GetUIValue()) { - encoder.Init(gb.GetIValue()); // configure encoder pulses per click and direction + case 1: // 12864 display + present = true; + lcd.Init(); + IoPort::SetPinMode(LcdBeepPin, OUTPUT_PWM_LOW); + lcd.SetFont(SmallFontNumber); + menu.Load("main"); + break; + + default: + reply.copy("Unknown display type"); + return GCodeResult::error; } } - else if (!present) + + if (gb.Seen('E')) { - reply.copy("12864 display is not present or not configured"); + seen = true; + encoder.Init(gb.GetIValue()); // configure encoder pulses per click and direction } - else + + if (!seen) { - reply.printf("12864 display is configured, pulses-per-click is %d", encoder.GetPulsesPerClick()); + if (present) + { + reply.printf("12864 display is configured, pulses-per-click is %d", encoder.GetPulsesPerClick()); + } + else + { + reply.copy("12864 display is not present or not configured"); + } } return GCodeResult::ok; } @@ -132,13 +154,16 @@ GCodeResult Display::Configure(GCodeBuffer& gb, const StringRef& reply) void Display::UpdatingFirmware() { updatingFirmware = true; - IoPort::WriteAnalog(LcdBeepPin, 0.0, 0); // stop any beep - lcd.TextInvert(false); - lcd.Clear(); - lcd.SetFont(LargeFontNumber); - lcd.SetCursor(20, 0); - lcd.print("Updating firmware..."); - lcd.FlushAll(); + if (present) + { + IoPort::WriteAnalog(LcdBeepPin, 0.0, 0); // stop any beep + lcd.TextInvert(false); + lcd.Clear(); + lcd.SetFont(LargeFontNumber); + lcd.SetCursor(20, 0); + lcd.print("Updating firmware..."); + lcd.FlushAll(); + } } // End |