Added battery voltage and Powersaving status to repeater OLED
This commit is contained in:
1 parent
a54ef6e7cc
commit
07172b7c54
3 files changed
+15
-3
No files matched your search
@@ -26,10 +26,11 @@ static const uint8_t meshcore_logo [] PROGMEM = {
|
||||
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
|
||||
};
|
||||
|
||||
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
|
||||
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version, mesh::MainBoard* board) {
|
||||
_prevBtnState = HIGH;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
_node_prefs = node_prefs;
|
||||
_board = board;
|
||||
_display->turnOn();
|
||||
|
||||
// strip off dash and commit hash by changing dash to null terminator
|
||||
@@ -89,6 +90,16 @@ void UITask::renderCurrScreen() {
|
||||
_display->setCursor(0, 30);
|
||||
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
|
||||
_display->print(tmp);
|
||||
|
||||
// Battery
|
||||
_display->setCursor(0, 40);
|
||||
sprintf(tmp, "BAT: %.2fV", _board->getBattMilliVolts() / 1000.0);
|
||||
_display->print(tmp);
|
||||
|
||||
// PowerSaving
|
||||
_display->setCursor(0, 50);
|
||||
sprintf(tmp, "PowerSaving: %s", _node_prefs->powersaving_enabled? "ON" : "off");
|
||||
_display->print(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,12 @@ class UITask {
|
||||
int _prevBtnState;
|
||||
NodePrefs* _node_prefs;
|
||||
char _version_info[32];
|
||||
mesh::MainBoard* _board;
|
||||
|
||||
void renderCurrScreen();
|
||||
public:
|
||||
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
|
||||
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
|
||||
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version, mesh::MainBoard* board);
|
||||
|
||||
void loop();
|
||||
};
|
||||
@@ -104,7 +104,7 @@ void setup() {
|
||||
the_mesh.begin(fs);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION, &board);
|
||||
#endif
|
||||
|
||||
// send out initial zero hop Advertisement to the mesh
|
||||
|
||||
Reference in new issue
Block a user