mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-30 02:18:11 -07:00
Merge branch 'dev' of https://github.com/ClaraCrazy/Flipper-Xtreme into fix-bad_kb_bt-flipper_app-conflict
This commit is contained in:
@@ -3,18 +3,13 @@
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/modules/empty_screen.h>
|
||||
#include <gui/elements.h>
|
||||
#include <assets_icons.h>
|
||||
#include <furi_hal_version.h>
|
||||
#include <furi_hal_region.h>
|
||||
#include <furi_hal_bt.h>
|
||||
#include <power/power_service/power.h>
|
||||
|
||||
int screen_index;
|
||||
|
||||
#define LOW_CHARGE_THRESHOLD 10
|
||||
#define HIGH_DRAIN_CURRENT_THRESHOLD 100
|
||||
|
||||
typedef DialogMessageButton (*AboutDialogScreen)(DialogsApp* dialogs, DialogMessage* message);
|
||||
|
||||
static DialogMessageButton product_screen(DialogsApp* dialogs, DialogMessage* message) {
|
||||
@@ -170,6 +165,13 @@ static DialogMessageButton fw_version_screen(DialogsApp* dialogs, DialogMessage*
|
||||
return result;
|
||||
}
|
||||
|
||||
#include <gui/elements.h>
|
||||
#include <locale/locale.h>
|
||||
#include <power/power_service/power.h>
|
||||
|
||||
#define LOW_CHARGE_THRESHOLD 10
|
||||
#define HIGH_DRAIN_CURRENT_THRESHOLD 100
|
||||
|
||||
static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val) {
|
||||
canvas_draw_frame(canvas, x - 7, y + 7, 30, 13);
|
||||
canvas_draw_icon(canvas, x, y, icon);
|
||||
@@ -221,15 +223,15 @@ static void draw_battery(Canvas* canvas, PowerInfo* info, int x, int y) {
|
||||
drain_current > HIGH_DRAIN_CURRENT_THRESHOLD ? "mA!" : "mA");
|
||||
} else if(drain_current != 0) {
|
||||
snprintf(header, 20, "...");
|
||||
} else if(info->voltage_battery_charging < 4.2) {
|
||||
} else if(info->voltage_battery_charge_limit < 4.2) {
|
||||
// Non-default battery charging limit, mention it
|
||||
snprintf(header, sizeof(header), "Limited to");
|
||||
snprintf(
|
||||
value,
|
||||
sizeof(value),
|
||||
"%lu.%luV",
|
||||
(uint32_t)(info->voltage_battery_charging),
|
||||
(uint32_t)(info->voltage_battery_charging * 10) % 10);
|
||||
(uint32_t)(info->voltage_battery_charge_limit),
|
||||
(uint32_t)(info->voltage_battery_charge_limit * 10) % 10);
|
||||
} else {
|
||||
snprintf(header, sizeof(header), "Charged!");
|
||||
}
|
||||
@@ -258,7 +260,15 @@ static void battery_info_draw_callback(Canvas* canvas, void* context) {
|
||||
char health[10];
|
||||
|
||||
snprintf(batt_level, sizeof(batt_level), "%lu%%", (uint32_t)info->charge);
|
||||
snprintf(temperature, sizeof(temperature), "%lu C", (uint32_t)info->temperature_gauge);
|
||||
if(locale_get_measurement_unit() == LocaleMeasurementUnitsMetric) {
|
||||
snprintf(temperature, sizeof(temperature), "%lu C", (uint32_t)info->temperature_gauge);
|
||||
} else {
|
||||
snprintf(
|
||||
temperature,
|
||||
sizeof(temperature),
|
||||
"%lu F",
|
||||
(uint32_t)locale_celsius_to_fahrenheit(info->temperature_gauge));
|
||||
}
|
||||
snprintf(
|
||||
voltage,
|
||||
sizeof(voltage),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "../bt_settings_app.h"
|
||||
#include "furi_hal_bt.h"
|
||||
#include "xtreme/assets.h"
|
||||
#include <furi_hal_bt.h>
|
||||
|
||||
|
||||
@@ -20,20 +20,52 @@ static const NotificationSequence sequence_note_c = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
#define BACKLIGHT_COUNT 5
|
||||
#define BACKLIGHT_COUNT 21
|
||||
const char* const backlight_text[BACKLIGHT_COUNT] = {
|
||||
"0%",
|
||||
"5%",
|
||||
"10%",
|
||||
"15%",
|
||||
"20%",
|
||||
"25%",
|
||||
"30%",
|
||||
"35%",
|
||||
"40%",
|
||||
"45%",
|
||||
"50%",
|
||||
"55%",
|
||||
"60%",
|
||||
"65%",
|
||||
"70%",
|
||||
"75%",
|
||||
"80%",
|
||||
"85%",
|
||||
"90%",
|
||||
"95%",
|
||||
"100%",
|
||||
};
|
||||
const float backlight_value[BACKLIGHT_COUNT] = {
|
||||
0.0f,
|
||||
0.00f,
|
||||
0.05f,
|
||||
0.10f,
|
||||
0.15f,
|
||||
0.20f,
|
||||
0.25f,
|
||||
0.5f,
|
||||
0.30f,
|
||||
0.35f,
|
||||
0.40f,
|
||||
0.45f,
|
||||
0.50f,
|
||||
0.55f,
|
||||
0.60f,
|
||||
0.65f,
|
||||
0.70f,
|
||||
0.75f,
|
||||
1.0f,
|
||||
0.80f,
|
||||
0.85f,
|
||||
0.90f,
|
||||
0.95f,
|
||||
1.00f,
|
||||
};
|
||||
|
||||
#define VOLUME_COUNT 5
|
||||
|
||||
@@ -7,7 +7,7 @@ static void power_settings_scene_battery_info_update_model(PowerSettingsApp* app
|
||||
.gauge_voltage = app->info.voltage_gauge,
|
||||
.gauge_current = app->info.current_gauge,
|
||||
.gauge_temperature = app->info.temperature_gauge,
|
||||
.charging_voltage = app->info.voltage_battery_charging,
|
||||
.charge_voltage_limit = app->info.voltage_battery_charge_limit,
|
||||
.charge = app->info.charge,
|
||||
.health = app->info.health,
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
|
||||
drain_current > HIGH_DRAIN_CURRENT_THRESHOLD ? "mA!" : "mA");
|
||||
} else if(drain_current != 0) {
|
||||
snprintf(header, 20, "...");
|
||||
} else if(data->charging_voltage < 4.2) {
|
||||
} else if(data->charge_voltage_limit < 4.2) {
|
||||
// Non-default battery charging limit, mention it
|
||||
snprintf(emote, sizeof(emote), "Charged!");
|
||||
snprintf(header, sizeof(header), "Limited to");
|
||||
@@ -77,8 +77,8 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
|
||||
value,
|
||||
sizeof(value),
|
||||
"%lu.%luV",
|
||||
(uint32_t)(data->charging_voltage),
|
||||
(uint32_t)(data->charging_voltage * 10) % 10);
|
||||
(uint32_t)(data->charge_voltage_limit),
|
||||
(uint32_t)(data->charge_voltage_limit * 10) % 10);
|
||||
} else {
|
||||
snprintf(header, sizeof(header), "Charged!");
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ typedef struct {
|
||||
float gauge_voltage;
|
||||
float gauge_current;
|
||||
float gauge_temperature;
|
||||
float charging_voltage;
|
||||
float charge_voltage_limit;
|
||||
uint8_t charge;
|
||||
uint8_t health;
|
||||
} BatteryInfoModel;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "../storage_settings.h"
|
||||
#include <stm32_adafruit_sd.h>
|
||||
|
||||
static void storage_settings_scene_sd_info_dialog_callback(DialogExResult result, void* context) {
|
||||
StorageSettings* app = context;
|
||||
@@ -12,9 +11,7 @@ void storage_settings_scene_sd_info_on_enter(void* context) {
|
||||
DialogEx* dialog_ex = app->dialog_ex;
|
||||
|
||||
SDInfo sd_info;
|
||||
SD_CID sd_cid;
|
||||
FS_Error sd_status = storage_sd_info(app->fs_api, &sd_info);
|
||||
BSP_SD_GetCIDRegister(&sd_cid);
|
||||
|
||||
scene_manager_set_scene_state(app->scene_manager, StorageSettingsSDInfo, sd_status);
|
||||
|
||||
@@ -28,52 +25,38 @@ void storage_settings_scene_sd_info_on_enter(void* context) {
|
||||
dialog_ex, "Try to reinsert\nor format SD\ncard.", 3, 19, AlignLeft, AlignTop);
|
||||
dialog_ex_set_center_button_text(dialog_ex, "Ok");
|
||||
} else {
|
||||
char unit_kb[] = "KB";
|
||||
char unit_mb[] = "MB";
|
||||
char unit_gb[] = "GB";
|
||||
|
||||
double sd_total_val = (double)sd_info.kb_total;
|
||||
char* sd_total_unit = unit_kb;
|
||||
double sd_free_val = (double)sd_info.kb_free;
|
||||
char* sd_free_unit = unit_kb;
|
||||
|
||||
if(sd_total_val > 1024) {
|
||||
sd_total_val /= 1024;
|
||||
sd_total_unit = unit_mb;
|
||||
double total_v = (double)sd_info.kb_total;
|
||||
double free_v = (double)sd_info.kb_free;
|
||||
char* units[] = {"KiB", "MiB", "GiB", "TiB"};
|
||||
uint total_i, free_i;
|
||||
for(total_i = 0; total_i < COUNT_OF(units); total_i++) {
|
||||
if(total_v < 1024) break;
|
||||
total_v /= 1024;
|
||||
}
|
||||
if(sd_total_val > 1024) {
|
||||
sd_total_val /= 1024;
|
||||
sd_total_unit = unit_gb;
|
||||
}
|
||||
|
||||
if(sd_free_val > 1024) {
|
||||
sd_free_val /= 1024;
|
||||
sd_free_unit = unit_mb;
|
||||
}
|
||||
if(sd_free_val > 1024) {
|
||||
sd_free_val /= 1024;
|
||||
sd_free_unit = unit_gb;
|
||||
for(free_i = 0; free_i < COUNT_OF(units); free_i++) {
|
||||
if(free_v < 1024) break;
|
||||
free_v /= 1024;
|
||||
}
|
||||
|
||||
furi_string_printf(
|
||||
app->text_string,
|
||||
"Label: %s\nType: %s\n%.2f %s total\n%.2f %s free %.2f%% free\n"
|
||||
"%02X%2.2s %5.5s %i.%i\nSN:%04lX %02i/%i",
|
||||
"%02X%s %s v%i.%i\nSN:%04lX %02i/%i",
|
||||
sd_info.label,
|
||||
sd_api_get_fs_type_text(sd_info.fs_type),
|
||||
sd_total_val,
|
||||
sd_total_unit,
|
||||
sd_free_val,
|
||||
sd_free_unit,
|
||||
total_v,
|
||||
units[total_i],
|
||||
free_v,
|
||||
units[free_i],
|
||||
(double)(((int)sd_info.kb_free * 100.0) / (int)sd_info.kb_total),
|
||||
sd_cid.ManufacturerID,
|
||||
sd_cid.OEM_AppliID,
|
||||
sd_cid.ProdName,
|
||||
sd_cid.ProdRev >> 4,
|
||||
sd_cid.ProdRev & 0xf,
|
||||
sd_cid.ProdSN,
|
||||
sd_cid.ManufactMonth,
|
||||
sd_cid.ManufactYear + 2000);
|
||||
sd_info.manufacturer_id,
|
||||
sd_info.oem_id,
|
||||
sd_info.product_name,
|
||||
sd_info.product_revision_major,
|
||||
sd_info.product_revision_minor,
|
||||
sd_info.product_serial_number,
|
||||
sd_info.manufacturing_month,
|
||||
sd_info.manufacturing_year);
|
||||
dialog_ex_set_text(
|
||||
dialog_ex, furi_string_get_cstr(app->text_string), 4, 1, AlignLeft, AlignTop);
|
||||
}
|
||||
@@ -112,4 +95,4 @@ void storage_settings_scene_sd_info_on_exit(void* context) {
|
||||
dialog_ex_reset(dialog_ex);
|
||||
|
||||
furi_string_reset(app->text_string);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user