display backlight and bluetooth reference counting (#639)
This commit is contained in:
committed by
GitHub
parent
19b11eb9a8
commit
64fb1a9f52
@@ -38,7 +38,6 @@ static void setBacklightBrightness(uint8_t brightness) {
|
||||
if (device_get_first_active_by_type(&DISPLAY_TYPE, &display) == ERROR_NONE) {
|
||||
::Device* backlight;
|
||||
if (display_get_backlight(display, &backlight) == ERROR_NONE) {
|
||||
device_get(backlight);
|
||||
backlight_set_brightness(backlight, brightness);
|
||||
device_put(backlight);
|
||||
}
|
||||
@@ -53,6 +52,7 @@ static bool hasDisplayWithBacklight() {
|
||||
::Device* backlight;
|
||||
if (display_get_backlight(display, &backlight) == ERROR_NONE) {
|
||||
result = true;
|
||||
device_put(backlight);
|
||||
}
|
||||
device_put(display);
|
||||
}
|
||||
|
||||
@@ -178,10 +178,16 @@ class StatusbarService final : public Service {
|
||||
}
|
||||
}
|
||||
|
||||
Device* serial_dev = bluetooth_serial_get_device();
|
||||
Device* midi_dev = bluetooth_midi_get_device();
|
||||
Device* serial_dev = bluetooth_serial_get();
|
||||
Device* midi_dev = bluetooth_midi_get();
|
||||
bool connected = (serial_dev && bluetooth_serial_is_connected(serial_dev)) ||
|
||||
(midi_dev && bluetooth_midi_is_connected(midi_dev));
|
||||
if (serial_dev) {
|
||||
device_put(serial_dev);
|
||||
}
|
||||
if (midi_dev) {
|
||||
device_put(midi_dev);
|
||||
}
|
||||
const char* desired_icon = getBluetoothStatusIcon(radio_state, scanning, connected);
|
||||
if (bt_last_icon != desired_icon) {
|
||||
if (desired_icon != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user