From 80e7ab3161112d1841b19f8aded3cca21eb5021b Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sun, 6 Nov 2022 22:51:59 +1100 Subject: [PATCH] Force delay after display state change So that we backoff if OLED is busy Update OLED.hpp --- source/Core/Drivers/OLED.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/Core/Drivers/OLED.hpp b/source/Core/Drivers/OLED.hpp index b6b6743a..9912c5df 100644 --- a/source/Core/Drivers/OLED.hpp +++ b/source/Core/Drivers/OLED.hpp @@ -10,10 +10,12 @@ #ifndef OLED_HPP_ #define OLED_HPP_ #include "Font.h" +#include "cmsis_os.h" #include "configuration.h" #include #include #include + #ifdef __cplusplus extern "C" { #endif @@ -63,8 +65,13 @@ public: } static void setDisplayState(DisplayState state) { - displayState = state; - screenBuffer[1] = (state == ON) ? 0xAF : 0xAE; + if (state != displayState) { + displayState = state; + screenBuffer[1] = (state == ON) ? 0xAF : 0xAE; + // Dump the screen state change out _now_ + I2C_CLASS::Transmit(DEVICEADDR_OLED, screenBuffer, FRAMEBUFFER_START - 1); + osDelay(TICKS_10MS); + } } static void setRotation(bool leftHanded); // Set the rotation for the screen