feat: integrate MCP and ES3C28P audio support with upstream compatibility updates
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include <tactility/lvgl_icon_statusbar.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <format>
|
||||
#include <string>
|
||||
|
||||
namespace tt::service::statusbar {
|
||||
|
||||
@@ -102,6 +104,13 @@ static const char* getPowerStatusIcon() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
hal::power::PowerDevice::MetricData charging_data;
|
||||
if (power->supportsMetric(hal::power::PowerDevice::MetricType::IsCharging) &&
|
||||
power->getMetric(hal::power::PowerDevice::MetricType::IsCharging, charging_data) &&
|
||||
charging_data.valueAsBool) {
|
||||
return LVGL_ICON_STATUSBAR_BATTERY_ANDROID_FRAME_BOLT;
|
||||
}
|
||||
|
||||
hal::power::PowerDevice::MetricData charge_level;
|
||||
if (!power->getMetric(hal::power::PowerDevice::MetricType::ChargeLevel, charge_level)) {
|
||||
return nullptr;
|
||||
@@ -210,6 +219,29 @@ class StatusbarService final : public Service {
|
||||
}
|
||||
power_last_icon = desired_icon;
|
||||
}
|
||||
|
||||
std::shared_ptr<hal::power::PowerDevice> power;
|
||||
hal::findDevices<hal::power::PowerDevice>(hal::Device::Type::Power, [&power](const auto& device) {
|
||||
if (device->supportsMetric(hal::power::PowerDevice::MetricType::ChargeLevel)) {
|
||||
power = device;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (power != nullptr) {
|
||||
hal::power::PowerDevice::MetricData charge_level;
|
||||
if (power->getMetric(hal::power::PowerDevice::MetricType::ChargeLevel, charge_level)) {
|
||||
uint8_t charge = charge_level.valueAsUint8;
|
||||
std::string battery_text = std::format("{}%", charge);
|
||||
lvgl::statusbar_set_battery_text(battery_text);
|
||||
lvgl::statusbar_set_battery_visibility(true);
|
||||
} else {
|
||||
lvgl::statusbar_set_battery_visibility(false);
|
||||
}
|
||||
} else {
|
||||
lvgl::statusbar_set_battery_visibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
void updateUsbIcon() {
|
||||
|
||||
Reference in New Issue
Block a user