[FL-1516] Fix name read on device without OTP (#561)

* Fix name read on device without OTP
* Dolphin: proper name handling.
This commit is contained in:
あく 2021-07-02 18:12:05 +03:00 committed by GitHub
parent 602c125ef5
commit 721f83dd83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 25 deletions

View file

@ -15,7 +15,10 @@
void cli_command_device_info(Cli* cli, string_t args, void* context) {
// Model name
printf("hardware_model : %s\r\n", api_hal_version_get_model_name());
printf("hardware_name : %s\r\n", api_hal_version_get_name_ptr());
const char* name = api_hal_version_get_name_ptr();
if(name) {
printf("hardware_name : %s\r\n", name);
}
// Unique ID
printf("hardware_uid : ");
@ -191,27 +194,6 @@ void cli_command_log(Cli* cli, string_t args, void* context) {
furi_stdglue_set_global_stdout_callback(NULL);
}
void cli_command_hw_info(Cli* cli, string_t args, void* context) {
printf(
"%-20s %d.F%dB%dC%d\r\n",
"HW version:",
api_hal_version_get_hw_version(),
api_hal_version_get_hw_target(),
api_hal_version_get_hw_body(),
api_hal_version_get_hw_connect());
time_t time = api_hal_version_get_hw_timestamp();
char time_string[26] = "";
ctime_r(&time, time_string);
if(time_string[strlen(time_string) - 1] == '\n') {
time_string[strlen(time_string) - 1] = '\0';
}
printf("%-20s %s\r\n", "Production date:", time_string);
const char* name = api_hal_version_get_name_ptr();
if(name) {
printf("%-20s %s", "Name:", name);
}
}
void cli_command_vibro(Cli* cli, string_t args, void* context) {
if(!string_cmp(args, "0")) {
NotificationApp* notification = furi_record_open("notification");

View file

@ -15,6 +15,7 @@ void dolphin_view_first_start_draw(Canvas* canvas, void* model) {
canvas_set_font(canvas, FontSecondary);
uint8_t width = canvas_width(canvas);
uint8_t height = canvas_height(canvas);
const char* my_name = api_hal_version_get_name_ptr();
if(m->page == 0) {
canvas_draw_icon_name(canvas, 0, height - 48, I_DolphinFirstStart0_70x53);
elements_multiline_text_framed(canvas, 75, 20, "Hey m8,\npress > to\ncontinue");
@ -37,7 +38,7 @@ void dolphin_view_first_start_draw(Canvas* canvas, void* model) {
64,
"%s %s%s",
"I am",
api_hal_version_get_name_ptr(),
my_name ? my_name : "Unknown",
",\ncyberdolphin\nliving in your\npocket >");
canvas_draw_icon_name(canvas, 0, height - 48, I_DolphinFirstStart5_45x53);
elements_multiline_text_framed(canvas, 60, 17, buf);
@ -119,6 +120,7 @@ void dolphin_view_idle_down_draw(Canvas* canvas, void* model) {
if(m->screen != DolphinViewStatsMeta) {
// Hardware version
const char* my_name = api_hal_version_get_name_ptr();
snprintf(
buffer,
sizeof(buffer),
@ -127,7 +129,7 @@ void dolphin_view_idle_down_draw(Canvas* canvas, void* model) {
api_hal_version_get_hw_target(),
api_hal_version_get_hw_body(),
api_hal_version_get_hw_connect(),
api_hal_version_get_name_ptr());
my_name ? my_name : "Unknown");
canvas_draw_str(canvas, 5, 23, buffer);
ver = m->screen == DolphinViewStatsBoot ? api_hal_version_get_boot_version() :

View file

@ -80,7 +80,8 @@ static void render_callback(Canvas* canvas, void* ctx) {
canvas_draw_line(canvas, 59, 31, 124, 31);
canvas_draw_line(canvas, 59, 44, 124, 44);
canvas_draw_str(canvas, 59, 15, api_hal_version_get_name_ptr());
const char* my_name = api_hal_version_get_name_ptr();
canvas_draw_str(canvas, 59, 15, my_name ? my_name : "Unknown");
snprintf(level, 20, "Level: %ld", current_level);
snprintf(mood, 20, "Mood: %s", mood_strings[butthurt]);