Browse Source

fix bluetooth toggle on ui tiny

pull/3049/head
liamcottle 3 days ago
parent
commit
dd778e2189
  1. 10
      examples/companion_radio/ui-tiny/UITask.cpp

10
examples/companion_radio/ui-tiny/UITask.cpp

@ -240,7 +240,7 @@ public:
} else if (_page == HomePage::BLUETOOTH) { } else if (_page == HomePage::BLUETOOTH) {
display.setColor(UIColor::corp_blue); display.setColor(UIColor::corp_blue);
display.drawXbm((display.width() - 32) / 2, 8, display.drawXbm((display.width() - 32) / 2, 8,
_task->isSerialEnabled() ? bluetooth_on : bluetooth_off, _task->isBluetoothEnabled() ? bluetooth_on : bluetooth_off,
32, 32); 32, 32);
display.setTextSize(1); display.setTextSize(1);
// display.drawTextCentered(display.width() / 2, 40 - 11, "toggle: " PRESS_LABEL); // display.drawTextCentered(display.width() / 2, 40 - 11, "toggle: " PRESS_LABEL);
@ -391,10 +391,10 @@ public:
return true; return true;
} }
if (c == KEY_ENTER && _page == HomePage::BLUETOOTH) { if (c == KEY_ENTER && _page == HomePage::BLUETOOTH) {
if (_task->isSerialEnabled()) { // toggle Bluetooth on/off if (_task->isBluetoothEnabled()) { // toggle Bluetooth on/off
_task->disableSerial(); _task->disableBluetooth();
} else { } else {
_task->enableSerial(); _task->enableBluetooth();
} }
return true; return true;
} }
@ -677,7 +677,7 @@ void UITask::loop() {
_cached_batt_mv, _cached_batt_mv,
isBuzzerQuiet(), isBuzzerQuiet(),
getGPSState(), getGPSState(),
isSerialEnabled()); isBluetoothEnabled());
bool status_dirty = _statusBar.needsRedraw(); bool status_dirty = _statusBar.needsRedraw();
bool content_dirty = (millis() >= _next_refresh && curr); bool content_dirty = (millis() >= _next_refresh && curr);

Loading…
Cancel
Save