mirror of
https://github.com/usatiuk/cardboy.git
synced 2025-10-28 23:27:49 +01:00
better statusbar
This commit is contained in:
@@ -237,7 +237,7 @@ extern "C" void app_main() {
|
||||
system.registerApp(apps::createTetrisAppFactory());
|
||||
system.registerApp(apps::createGameboyAppFactory());
|
||||
|
||||
start_task_usage_monitor();
|
||||
// start_task_usage_monitor();
|
||||
|
||||
system.run();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace cardboy::sdk {
|
||||
namespace {
|
||||
constexpr std::string_view kNamespace = "settings";
|
||||
constexpr std::string_view kMuteKey = "mute";
|
||||
constexpr std::string_view kAutoLightSleepKey = "auto_light_sleep";
|
||||
constexpr std::string_view kAutoLightSleepKey = "autosleep";
|
||||
|
||||
[[nodiscard]] std::uint32_t boolToStorage(bool value) { return value ? 1U : 0U; }
|
||||
[[nodiscard]] bool storageToBool(std::uint32_t value) { return value != 0U; }
|
||||
|
||||
@@ -55,11 +55,10 @@ std::string StatusBar::prepareRightText() const {
|
||||
const float fallbackV = services_->battery->voltage();
|
||||
char buf[64];
|
||||
if (std::isfinite(current) && std::isfinite(chargeMah)) {
|
||||
const long currentRounded = std::lround(static_cast<double>(current));
|
||||
const long chargeRounded = std::lround(static_cast<double>(chargeMah));
|
||||
std::snprintf(buf, sizeof(buf), "CUR %+ldMA CAP %ldMAH", currentRounded, std::max(0L, chargeRounded));
|
||||
std::snprintf(buf, sizeof(buf), "cur %.2fmA chr %.2fmAh", static_cast<double>(current),
|
||||
static_cast<double>(chargeMah));
|
||||
} else {
|
||||
std::snprintf(buf, sizeof(buf), "BAT %.2fV", static_cast<double>(fallbackV));
|
||||
std::snprintf(buf, sizeof(buf), "vol %.2fV", static_cast<double>(fallbackV));
|
||||
}
|
||||
right.assign(buf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user