Skip to content

Commit

Permalink
About: backport latest certification information from dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Dec 26, 2023
1 parent bc46984 commit 76bd35d
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 39 deletions.
132 changes: 94 additions & 38 deletions applications/about/about.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,47 @@
#include <gui/gui.h>
#include <gui/view_dispatcher.h>
#include <gui/modules/empty_screen.h>
#include <assets_icons.h>
#include <m-string.h>
#include <furi_hal_version.h>
#include <furi_hal_region.h>
#include <furi_hal_bt.h>
#include <furi_hal_info.h>

typedef DialogMessageButton (*AboutDialogScreen)(DialogsApp* dialogs, DialogMessage* message);

static DialogMessageButton product_screen(DialogsApp* dialogs, DialogMessage* message) {
static DialogMessageButton about_screen_product(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;

const char* screen_header = "Product: Flipper Zero\n"
"Model: FZ.1\n";
const char* screen_text = "FCC ID: 2A2V6-FZ\n"
"IC: 27624-FZ";

dialog_message_set_header(message, screen_header, 0, 0, AlignLeft, AlignTop);
dialog_message_set_text(message, screen_text, 0, 26, AlignLeft, AlignTop);
string_t screen_header;
string_init(screen_header);
string_cat_printf(
screen_header,
"Product: %s\n"
"Model: %s",
furi_hal_version_get_model_name(),
furi_hal_version_get_model_code());

string_t screen_text;
string_init(screen_text);
string_cat_printf(
screen_text,
"FCC ID: %s\n"
"IC: %s",
furi_hal_version_get_fcc_id(),
furi_hal_version_get_ic_id());

dialog_message_set_header(message, string_get_cstr(screen_header), 0, 0, AlignLeft, AlignTop);
dialog_message_set_text(message, string_get_cstr(screen_text), 0, 26, AlignLeft, AlignTop);
result = dialog_message_show(dialogs, message);
dialog_message_set_header(message, NULL, 0, 0, AlignLeft, AlignTop);
dialog_message_set_text(message, NULL, 0, 0, AlignLeft, AlignTop);

string_clear(screen_header);
string_clear(screen_text);

return result;
}

static DialogMessageButton address_screen(DialogsApp* dialogs, DialogMessage* message) {
static DialogMessageButton about_screen_address(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;

const char* screen_text = "Flipper Devices Inc\n"
Expand All @@ -37,12 +53,11 @@ static DialogMessageButton address_screen(DialogsApp* dialogs, DialogMessage* me

dialog_message_set_text(message, screen_text, 0, 0, AlignLeft, AlignTop);
result = dialog_message_show(dialogs, message);
dialog_message_set_text(message, NULL, 0, 0, AlignLeft, AlignTop);

return result;
}

static DialogMessageButton compliance_screen(DialogsApp* dialogs, DialogMessage* message) {
static DialogMessageButton about_screen_compliance(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;

const char* screen_text = "For all compliance\n"
Expand All @@ -51,32 +66,71 @@ static DialogMessageButton compliance_screen(DialogsApp* dialogs, DialogMessage*

dialog_message_set_text(message, screen_text, 0, 0, AlignLeft, AlignTop);
result = dialog_message_show(dialogs, message);
dialog_message_set_text(message, NULL, 0, 0, AlignLeft, AlignTop);

return result;
}

static DialogMessageButton icon1_screen(DialogsApp* dialogs, DialogMessage* message) {
static DialogMessageButton about_screen_icon1(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;

dialog_message_set_icon(message, &I_Certification1_103x56, 13, 0);
result = dialog_message_show(dialogs, message);
dialog_message_set_icon(message, NULL, 0, 0);

return result;
}

static DialogMessageButton icon2_screen(DialogsApp* dialogs, DialogMessage* message) {
static DialogMessageButton about_screen_icon2(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;

dialog_message_set_icon(message, &I_Certification2_46x33, 15, 10);
dialog_message_set_text(
message, furi_hal_version_get_mic_id(), 63, 27, AlignLeft, AlignCenter);
result = dialog_message_show(dialogs, message);

return result;
}

static DialogMessageButton about_screen_cert_china_0(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;

dialog_message_set_icon(message, &I_CertificationChina0_121x41, 3, 3);
result = dialog_message_show(dialogs, message);

return result;
}

static DialogMessageButton about_screen_cert_china_1(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;

dialog_message_set_icon(message, &I_Certification2_98x33, 15, 10);
dialog_message_set_icon(message, &I_CertificationChina1_122x47, 3, 3);
dialog_message_set_text(
message, furi_hal_version_get_srrc_id(), 55, 11, AlignLeft, AlignBottom);
result = dialog_message_show(dialogs, message);
dialog_message_set_icon(message, NULL, 0, 0);

return result;
}

static DialogMessageButton hw_version_screen(DialogsApp* dialogs, DialogMessage* message) {
static DialogMessageButton about_screen_cert_taiwan(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;

dialog_message_set_icon(message, &I_CertificationTaiwan_33x32, 3, 10);
dialog_message_set_text(
message, furi_hal_version_get_ncc_id(), 39, 30, AlignLeft, AlignBottom);
result = dialog_message_show(dialogs, message);

return result;
}

static DialogMessageButton about_screen_cert_mexico(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;

dialog_message_set_icon(message, &I_CertificationMexico_98x41, 17, 4);
result = dialog_message_show(dialogs, message);

return result;
}

static DialogMessageButton about_screen_hw_version(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;
string_t buffer;
string_init(buffer);
Expand All @@ -102,14 +156,12 @@ static DialogMessageButton hw_version_screen(DialogsApp* dialogs, DialogMessage*
dialog_message_set_header(message, "HW Version Info:", 0, 0, AlignLeft, AlignTop);
dialog_message_set_text(message, string_get_cstr(buffer), 0, 13, AlignLeft, AlignTop);
result = dialog_message_show(dialogs, message);
dialog_message_set_text(message, NULL, 0, 0, AlignLeft, AlignTop);
dialog_message_set_header(message, NULL, 0, 0, AlignLeft, AlignTop);
string_clear(buffer);

return result;
}

static DialogMessageButton fw_version_screen(DialogsApp* dialogs, DialogMessage* message) {
static DialogMessageButton about_screen_fw_version(DialogsApp* dialogs, DialogMessage* message) {
DialogMessageButton result;
string_t buffer;
string_init(buffer);
Expand All @@ -119,7 +171,7 @@ static DialogMessageButton fw_version_screen(DialogsApp* dialogs, DialogMessage*
c2_ver = ble_glue_get_c2_info();
#endif

if(!ver) {
if(!ver) { //-V1051
string_cat_printf(buffer, "No info\n");
} else {
string_cat_printf(
Expand All @@ -138,23 +190,23 @@ static DialogMessageButton fw_version_screen(DialogsApp* dialogs, DialogMessage*
dialog_message_set_header(message, "FW Version Info:", 0, 0, AlignLeft, AlignTop);
dialog_message_set_text(message, string_get_cstr(buffer), 0, 13, AlignLeft, AlignTop);
result = dialog_message_show(dialogs, message);
dialog_message_set_text(message, NULL, 0, 0, AlignLeft, AlignTop);
dialog_message_set_header(message, NULL, 0, 0, AlignLeft, AlignTop);
string_clear(buffer);

return result;
}

const AboutDialogScreen about_screens[] = {
product_screen,
compliance_screen,
address_screen,
icon1_screen,
icon2_screen,
hw_version_screen,
fw_version_screen};

const size_t about_screens_count = sizeof(about_screens) / sizeof(AboutDialogScreen);
about_screen_product,
about_screen_compliance,
about_screen_address,
about_screen_icon1,
about_screen_icon2,
about_screen_cert_china_0,
about_screen_cert_china_1,
about_screen_cert_taiwan,
about_screen_cert_mexico,
about_screen_hw_version,
about_screen_fw_version};

int32_t about_settings_app(void* p) {
UNUSED(p);
Expand All @@ -176,22 +228,26 @@ int32_t about_settings_app(void* p) {
view_dispatcher_switch_to_view(view_dispatcher, empty_screen_index);

while(1) {
if(screen_index >= about_screens_count - 1) {
if(screen_index >= COUNT_OF(about_screens) - 1) {
dialog_message_set_buttons(message, "Back", NULL, NULL);
} else {
dialog_message_set_buttons(message, "Back", NULL, "Next");
}

screen_result = about_screens[screen_index](dialogs, message);

dialog_message_set_icon(message, NULL, 0, 0);
dialog_message_set_header(message, NULL, 0, 0, AlignLeft, AlignTop);
dialog_message_set_text(message, NULL, 0, 0, AlignLeft, AlignTop);

if(screen_result == DialogMessageButtonLeft) {
if(screen_index <= 0) {
break;
} else {
screen_index--;
}
} else if(screen_result == DialogMessageButtonRight) {
if(screen_index < about_screens_count) {
if(screen_index < COUNT_OF(about_screens) - 1) {
screen_index++;
}
} else if(screen_result == DialogMessageButtonBack) {
Expand All @@ -208,4 +264,4 @@ int32_t about_settings_app(void* p) {
furi_record_close(RECORD_GUI);

return 0;
}
}
Binary file added assets/icons/About/Certification2_46x33.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/icons/About/Certification2_98x33.png
Binary file not shown.
Binary file added assets/icons/About/CertificationChina0_121x41.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/About/CertificationChina1_122x47.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/About/CertificationMexico_98x41.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/About/CertificationTaiwan_33x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 25 additions & 1 deletion firmware/targets/f7/furi_hal/furi_hal_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,37 @@ void furi_hal_version_init() {
}

bool furi_hal_version_do_i_belong_here() {
return furi_hal_version_get_hw_target() == 7;
return (furi_hal_version_get_hw_target() == 7) || (furi_hal_version_get_hw_target() == 0);
}

const char* furi_hal_version_get_model_name() {
return "Flipper Zero";
}

const char* furi_hal_version_get_model_code() {
return "FZ.1";
}

const char* furi_hal_version_get_fcc_id() {
return "2A2V6-FZ";
}

const char* furi_hal_version_get_ic_id() {
return "27624-FZ";
}

const char* furi_hal_version_get_mic_id() {
return "210-175991";
}

const char* furi_hal_version_get_srrc_id() {
return "2023DJ16420";
}

const char* furi_hal_version_get_ncc_id() {
return "CCAJ23LP34D0T3";
}

FuriHalVersionOtpVersion furi_hal_version_get_otp_version() {
if(*(uint64_t*)FURI_HAL_VERSION_OTP_ADDRESS == 0xFFFFFFFF) {
return FuriHalVersionOtpVersionEmpty;
Expand Down
36 changes: 36 additions & 0 deletions firmware/targets/furi_hal_include/furi_hal_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,42 @@ bool furi_hal_version_do_i_belong_here();
*/
const char* furi_hal_version_get_model_name();

/** Get model name
*
* @return model code C-string
*/
const char* furi_hal_version_get_model_code();

/** Get FCC ID
*
* @return FCC id as C-string
*/
const char* furi_hal_version_get_fcc_id();

/** Get IC id
*
* @return IC id as C-string
*/
const char* furi_hal_version_get_ic_id();

/** Get MIC id
*
* @return MIC id as C-string
*/
const char* furi_hal_version_get_mic_id();

/** Get SRRC id
*
* @return SRRC id as C-string
*/
const char* furi_hal_version_get_srrc_id();

/** Get NCC id
*
* @return NCC id as C-string
*/
const char* furi_hal_version_get_ncc_id();

/** Get OTP version
*
* @return OTP Version
Expand Down

0 comments on commit 76bd35d

Please sign in to comment.