diff --git a/src/DispInterface.cpp b/src/DispInterface.cpp index ea3970c..569f4eb 100644 --- a/src/DispInterface.cpp +++ b/src/DispInterface.cpp @@ -109,16 +109,18 @@ void DispInterface::drawSegments(segment_bitmap_t *ds, bool lowBat) { u8g2.drawXBM(0, 0, asterisk_width, asterisk_height, asterisk_bits); } -// Also kicks display out of power save mode void DispInterface::updateDisplay(nut_reg_t *nv, bool force) { static segment_bitmap_t lastSegments[VOYAGER_DISPLAY_DIGITS] = {0}; bool lowBat = lowBatAnnOverride || blinkTick(); - static bool lastLowBat = false; - bool doUpdate = (lastLowBat != lowBat) ? true : memcmp(lastSegments, nv->display_segments, sizeof(lastSegments)); + static bool lastLowBat = !lowBat; + bool displayEnabled = nv->display_chip->enable; + static bool lastDisplayEnabled = !displayEnabled; + bool doUpdate = (lastLowBat != lowBat) || (lastDisplayEnabled != displayEnabled) || memcmp(lastSegments, nv->display_segments, sizeof(lastSegments)); memcpy(lastSegments, nv->display_segments, sizeof(lastSegments)); if (doUpdate || force) { lastLowBat = lowBat; + lastDisplayEnabled = displayEnabled; drawSegments(nv->display_segments, lowBat); u8g2.sendBuffer(); } diff --git a/src/NutEmuInterface.cpp b/src/NutEmuInterface.cpp index de71c5d..97788f8 100644 --- a/src/NutEmuInterface.cpp +++ b/src/NutEmuInterface.cpp @@ -573,14 +573,7 @@ char *NutEmuInterface::getRomFilePath() { void NutEmuInterface::updateDisplayCallback() { displayEnabled = nv->display_chip->enable; // The value is the most reliable FOR NOW - static bool lastState = !displayEnabled; - - if (displayEnabled) { - disp.updateDisplay(nv, !lastState); - } else if (/*!unlockSpeed && */lastState) // For the sake of accuracy - disp.getU8g2()->clear(); // !! What about the low bat annunciator? - - lastState = displayEnabled; + disp.updateDisplay(nv); } void NutEmuInterface::setEnablePowerMgmt(bool enablePowerMgmt_) {