Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added setContrast method for the GNC255 oled device (recreated PR) #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion GNC255/GNC255.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ void GNC255::set(int16_t messageID, const char *data)
case 5: // set COM/NAV mode
setMode(strcmp(data, "0") == 0);
break;
case 6: // set contrast (brightness) of OLED
setContrast(atoi(data));
break;
default:
break;
}
Expand Down Expand Up @@ -164,4 +167,9 @@ void GNC255::_renderLabel(const char *text, Label label, Position offset, bool u

_oledDisplay->print(text);
if (update) _oledDisplay->sendBuffer();
}
}

void GNC255::setContrast(uint8_t displayContrast)
{
_oledDisplay->setContrast(displayContrast);
}
2 changes: 2 additions & 0 deletions GNC255/GNC255.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class GNC255
bool _hasChanged;
char activeFrequency[8] = "123.456";
char standbyFrequency[8] = "123.456";
uint8_t displayContrast = 32;

void _update();
void _stop();
Expand All @@ -53,4 +54,5 @@ class GNC255
void updateActiveLabel(const char *frequency);
void updateStandbyLabel(const char *frequency);
void _renderLabel(const char *text, Label label, Position offset, bool update = false);
void setContrast(uint8_t displayContrast);
};
Loading