More correct display simulation
enable/disable works more like the real thing, however not entirely correct. When enabling the display, it takes the current content of the screen buffer instead of the data that has been send to the display controller.
This commit is contained in:
parent
9ab101067a
commit
4f295a6b52
3 changed files with 9 additions and 9 deletions
|
@ -16,6 +16,7 @@ public: // Exposed simulation variables...
|
||||||
bool dimmed_;
|
bool dimmed_;
|
||||||
bool enabled_;
|
bool enabled_;
|
||||||
bool inverted_;
|
bool inverted_;
|
||||||
|
bool dirty_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -611,8 +611,7 @@ uint8_t *Adafruit_SSD1306::getBuffer(void) {
|
||||||
of graphics commands, as best needed by one's own application.
|
of graphics commands, as best needed by one's own application.
|
||||||
*/
|
*/
|
||||||
void Adafruit_SSD1306::display(void) {
|
void Adafruit_SSD1306::display(void) {
|
||||||
|
dirty_ = true;
|
||||||
// TODO: Update SDL surface with content of `buffer`
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,6 +722,7 @@ void Adafruit_SSD1306::ssd1306_command(uint8_t cmd)
|
||||||
break;
|
break;
|
||||||
case SSD1306_DISPLAYON:
|
case SSD1306_DISPLAYON:
|
||||||
enabled_ = true;
|
enabled_ = true;
|
||||||
|
dirty_ = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
|
|
|
@ -47,8 +47,6 @@ void _reboot_Teensyduino_()
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void menu(void);
|
|
||||||
extern void initDisplay(void);
|
|
||||||
extern void breath();
|
extern void breath();
|
||||||
extern int noteValueCheck(int);
|
extern int noteValueCheck(int);
|
||||||
extern unsigned int breathCurve(unsigned int);
|
extern unsigned int breathCurve(unsigned int);
|
||||||
|
@ -189,7 +187,6 @@ static void doGlobalsWindow()
|
||||||
{
|
{
|
||||||
if( ImGui::Begin("Globals" ) ) {
|
if( ImGui::Begin("Globals" ) ) {
|
||||||
|
|
||||||
|
|
||||||
if(ImGui::TreeNode("Sensor limits") )
|
if(ImGui::TreeNode("Sensor limits") )
|
||||||
{
|
{
|
||||||
ImGui::LabelText("Breath Thr", "%d", breathThrVal);
|
ImGui::LabelText("Breath Thr", "%d", breathThrVal);
|
||||||
|
@ -376,13 +373,15 @@ static uint8_t displayBuffer[128*128];
|
||||||
|
|
||||||
static void GetDisplay()
|
static void GetDisplay()
|
||||||
{
|
{
|
||||||
|
if(!display.enabled_) {
|
||||||
SDL_memset( displayBuffer, 0, (128*128));
|
SDL_memset( displayBuffer, 0, (128*128));
|
||||||
|
} else if(display.dirty_) {
|
||||||
if(display.enabled_) {
|
|
||||||
uint8_t fg = 255;
|
uint8_t fg = 255;
|
||||||
uint8_t bg = 0;
|
uint8_t bg = 0;
|
||||||
|
|
||||||
if( display.dimmed_) fg = 127;
|
display.dirty_ = false;
|
||||||
|
|
||||||
|
if( display.dimmed_ ) fg = 0b01001001;
|
||||||
if( display.inverted_ ) { uint8_t tmp = fg; fg = bg; bg = tmp; }
|
if( display.inverted_ ) { uint8_t tmp = fg; fg = bg; bg = tmp; }
|
||||||
|
|
||||||
for(int y = 0 ; y < 64; ++y) {
|
for(int y = 0 ; y < 64; ++y) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue