| 188 | } |
| 189 | |
| 190 | void Display::InitDisplay(GCodeBuffer& gb, Lcd *_ecv_from newLcd, Pin csPin, Pin a0Pin, bool defaultCsPolarity) THROWS(GCodeException) |
| 191 | { |
| 192 | // ST7567-based displays need a resistor ratio setting and a contrast setting |
| 193 | // For now we always pass these as parameters toLcd::Init(). If we get any more, consider passing the GCodeBuffer and letting the display pick the parameters instead. |
| 194 | const uint32_t contrast = (gb.Seen('C')) ? gb.GetUIValue() : DefaultDisplayContrastRatio; |
| 195 | const uint32_t resistorRatio = (gb.Seen('R')) ? gb.GetUIValue() : DefaultDisplayResistorRatio; |
| 196 | newLcd->Init(csPin, a0Pin, defaultCsPolarity, (gb.Seen('F')) ? gb.GetUIValue() : LcdSpiClockFrequency, contrast, resistorRatio); |
| 197 | StopBeep(); // this serves to initialise the pins |
| 198 | |
| 199 | newLcd->SetFont(SmallFontNumber); |
| 200 | |
| 201 | #if SUPPORT_ROTARY_ENCODER |
| 202 | if (encoder == nullptr) |
| 203 | { |
| 204 | encoder = new RotaryEncoder(EncoderPinA, EncoderPinB, EncoderPinSw); |
| 205 | encoder->Init(DefaultPulsesPerClick); |
| 206 | } |
| 207 | #endif |
| 208 | |
| 209 | menu = new Menu(*newLcd); |
| 210 | menu->Load("main"); |
| 211 | lcd = newLcd; |
| 212 | } |
| 213 | |
| 214 | GCodeResult Display::Configure(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException) |
| 215 | { |
no test coverage detected