2021-01-08 07:42:48 +03:00
|
|
|
#include "dolphin_views.h"
|
|
|
|
#include <gui/view.h>
|
2021-02-03 12:52:54 +03:00
|
|
|
#include <gui/gui.h>
|
|
|
|
#include <gui/elements.h>
|
2021-08-08 21:03:25 +03:00
|
|
|
#include <furi-hal.h>
|
|
|
|
#include <furi-hal-version.h>
|
2021-02-18 15:49:32 +03:00
|
|
|
|
2021-03-25 20:48:58 +03:00
|
|
|
static char* Lockmenu_Items[3] = {"Lock", "Set PIN", "DUMB mode"};
|
|
|
|
|
2021-01-08 07:42:48 +03:00
|
|
|
void dolphin_view_first_start_draw(Canvas* canvas, void* model) {
|
|
|
|
DolphinViewFirstStartModel* m = model;
|
|
|
|
canvas_clear(canvas);
|
|
|
|
canvas_set_color(canvas, ColorBlack);
|
2021-02-03 12:52:54 +03:00
|
|
|
canvas_set_font(canvas, FontSecondary);
|
|
|
|
uint8_t width = canvas_width(canvas);
|
|
|
|
uint8_t height = canvas_height(canvas);
|
2021-08-08 21:03:25 +03:00
|
|
|
const char* my_name = furi_hal_version_get_name_ptr();
|
2021-01-08 07:42:48 +03:00
|
|
|
if(m->page == 0) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, 0, height - 48, &I_DolphinFirstStart0_70x53);
|
2021-04-06 20:09:15 +03:00
|
|
|
elements_multiline_text_framed(canvas, 75, 20, "Hey m8,\npress > to\ncontinue");
|
2021-01-08 07:42:48 +03:00
|
|
|
} else if(m->page == 1) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, 0, height - 48, &I_DolphinFirstStart1_59x53);
|
2021-04-06 20:09:15 +03:00
|
|
|
elements_multiline_text_framed(canvas, 64, 20, "First Of All,\n... >");
|
2021-01-08 07:42:48 +03:00
|
|
|
} else if(m->page == 2) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, 0, height - 48, &I_DolphinFirstStart2_59x51);
|
2021-04-06 20:09:15 +03:00
|
|
|
elements_multiline_text_framed(canvas, 64, 20, "Thank you\nfor your\nsupport! >");
|
2021-01-08 07:42:48 +03:00
|
|
|
} else if(m->page == 3) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, width - 57, height - 48, &I_DolphinFirstStart3_57x48);
|
2021-04-06 20:09:15 +03:00
|
|
|
elements_multiline_text_framed(canvas, 0, 20, "Kickstarter\ncampaign\nwas INSANE! >");
|
2021-01-08 07:42:48 +03:00
|
|
|
} else if(m->page == 4) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, width - 67, height - 50, &I_DolphinFirstStart4_67x53);
|
2021-04-06 20:09:15 +03:00
|
|
|
elements_multiline_text_framed(canvas, 0, 17, "Now\nallow me\nto introduce\nmyself >");
|
2021-01-08 07:42:48 +03:00
|
|
|
} else if(m->page == 5) {
|
2021-04-06 20:09:15 +03:00
|
|
|
char buf[64];
|
|
|
|
snprintf(
|
|
|
|
buf,
|
|
|
|
64,
|
|
|
|
"%s %s%s",
|
|
|
|
"I am",
|
2021-07-02 18:12:05 +03:00
|
|
|
my_name ? my_name : "Unknown",
|
2021-04-06 20:09:15 +03:00
|
|
|
",\ncyberdolphin\nliving in your\npocket >");
|
2021-07-26 21:08:41 +03:00
|
|
|
canvas_draw_icon(canvas, 0, height - 48, &I_DolphinFirstStart5_54x49);
|
2021-04-06 20:09:15 +03:00
|
|
|
elements_multiline_text_framed(canvas, 60, 17, buf);
|
2021-01-08 07:42:48 +03:00
|
|
|
} else if(m->page == 6) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, 0, height - 48, &I_DolphinFirstStart6_58x54);
|
2021-04-06 20:09:15 +03:00
|
|
|
elements_multiline_text_framed(
|
|
|
|
canvas, 63, 17, "I can grow\nsmart'n'cool\nif you use me\noften >");
|
2021-01-08 07:42:48 +03:00
|
|
|
} else if(m->page == 7) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, width - 61, height - 48, &I_DolphinFirstStart7_61x51);
|
2021-04-06 20:09:15 +03:00
|
|
|
elements_multiline_text_framed(
|
|
|
|
canvas, 0, 17, "As long as\nyou read, write\nand emulate >");
|
2021-01-08 07:42:48 +03:00
|
|
|
} else if(m->page == 8) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, width - 56, height - 48, &I_DolphinFirstStart8_56x51);
|
2021-04-06 20:09:15 +03:00
|
|
|
elements_multiline_text_framed(
|
|
|
|
canvas, 0, 17, "You can check\nmy level and\nmood in the\nPassport menu");
|
2021-01-08 07:42:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void dolphin_view_idle_main_draw(Canvas* canvas, void* model) {
|
|
|
|
canvas_clear(canvas);
|
2021-03-25 20:48:58 +03:00
|
|
|
DolphinViewMainModel* m = model;
|
2021-05-05 12:50:03 +03:00
|
|
|
if(m->animation) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon_animation(canvas, 0, -3, m->animation);
|
2021-05-05 12:50:03 +03:00
|
|
|
}
|
2021-01-08 07:42:48 +03:00
|
|
|
|
2021-08-16 23:50:49 +03:00
|
|
|
if(m->hint_timeout) {
|
2021-05-05 12:50:03 +03:00
|
|
|
m->hint_timeout--;
|
2021-05-18 21:54:56 +03:00
|
|
|
if(m->locked) {
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, 13, 5, &I_LockPopup_100x49);
|
2021-05-18 21:54:56 +03:00
|
|
|
elements_multiline_text(canvas, 65, 20, "To unlock\npress:");
|
|
|
|
} else {
|
|
|
|
canvas_set_font(canvas, FontPrimary);
|
|
|
|
elements_multiline_text_framed(canvas, 42, 30, "Unlocked");
|
|
|
|
}
|
2021-05-05 12:50:03 +03:00
|
|
|
}
|
2021-03-25 20:48:58 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void dolphin_view_lockmenu_draw(Canvas* canvas, void* model) {
|
2021-05-05 12:50:03 +03:00
|
|
|
DolphinViewLockMenuModel* m = model;
|
2021-03-25 20:48:58 +03:00
|
|
|
canvas_clear(canvas);
|
|
|
|
canvas_set_color(canvas, ColorBlack);
|
2021-07-07 11:57:49 +03:00
|
|
|
canvas_draw_icon(canvas, m->door_left_x, 0, &I_DoorLeft_70x55);
|
|
|
|
canvas_draw_icon(canvas, m->door_right_x, 0, &I_DoorRight_70x55);
|
2021-03-25 20:48:58 +03:00
|
|
|
canvas_set_font(canvas, FontSecondary);
|
2021-05-05 12:50:03 +03:00
|
|
|
|
|
|
|
if(m->locked) {
|
|
|
|
m->exit_timeout--;
|
|
|
|
|
2021-05-18 21:54:56 +03:00
|
|
|
m->door_left_x = CLAMP(m->door_left_x + 5, 0, -57);
|
|
|
|
m->door_right_x = CLAMP(m->door_right_x - 5, 115, 60);
|
2021-05-05 12:50:03 +03:00
|
|
|
|
|
|
|
if(m->door_left_x > -10) {
|
|
|
|
canvas_set_font(canvas, FontPrimary);
|
|
|
|
elements_multiline_text_framed(canvas, 42, 30, "Locked");
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if(m->door_left_x == -57) {
|
|
|
|
for(uint8_t i = 0; i < 3; ++i) {
|
|
|
|
canvas_draw_str_aligned(
|
2021-08-16 23:50:49 +03:00
|
|
|
canvas,
|
|
|
|
64,
|
|
|
|
13 + (i * 17),
|
|
|
|
AlignCenter,
|
|
|
|
AlignCenter,
|
|
|
|
(m->hint_timeout && m->idx == i) ? "Not implemented" : Lockmenu_Items[i]);
|
2021-05-05 12:50:03 +03:00
|
|
|
if(m->idx == i) elements_frame(canvas, 15, 5 + (i * 17), 98, 15);
|
|
|
|
}
|
|
|
|
}
|
2021-08-16 23:50:49 +03:00
|
|
|
|
|
|
|
if(m->hint_timeout) {
|
|
|
|
m->hint_timeout--;
|
|
|
|
}
|
2021-03-25 20:48:58 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-18 15:49:32 +03:00
|
|
|
void dolphin_view_idle_down_draw(Canvas* canvas, void* model) {
|
2021-05-05 12:50:03 +03:00
|
|
|
DolphinViewStatsModel* m = model;
|
2021-04-19 19:30:25 +03:00
|
|
|
const Version* ver;
|
|
|
|
char buffer[64];
|
|
|
|
|
2021-06-18 14:08:13 +03:00
|
|
|
static const char* headers[] = {"FW Version info:", "Boot Version info:", "Dolphin info:"};
|
2021-05-05 12:50:03 +03:00
|
|
|
|
2021-01-08 07:42:48 +03:00
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
|
|
canvas_set_font(canvas, FontPrimary);
|
2021-05-05 12:50:03 +03:00
|
|
|
canvas_draw_str(canvas, 2, 13, headers[m->screen]);
|
2021-01-08 07:42:48 +03:00
|
|
|
canvas_set_font(canvas, FontSecondary);
|
2021-02-18 15:49:32 +03:00
|
|
|
|
2021-05-05 12:50:03 +03:00
|
|
|
if(m->screen != DolphinViewStatsMeta) {
|
|
|
|
// Hardware version
|
2021-08-08 21:03:25 +03:00
|
|
|
const char* my_name = furi_hal_version_get_name_ptr();
|
2021-05-05 12:50:03 +03:00
|
|
|
snprintf(
|
|
|
|
buffer,
|
|
|
|
sizeof(buffer),
|
|
|
|
"HW: %d.F%dB%dC%d %s",
|
2021-08-08 21:03:25 +03:00
|
|
|
furi_hal_version_get_hw_version(),
|
|
|
|
furi_hal_version_get_hw_target(),
|
|
|
|
furi_hal_version_get_hw_body(),
|
|
|
|
furi_hal_version_get_hw_connect(),
|
2021-07-02 18:12:05 +03:00
|
|
|
my_name ? my_name : "Unknown");
|
2021-05-05 12:50:03 +03:00
|
|
|
canvas_draw_str(canvas, 5, 23, buffer);
|
|
|
|
|
2021-08-08 21:03:25 +03:00
|
|
|
ver = m->screen == DolphinViewStatsBoot ? furi_hal_version_get_boot_version() :
|
|
|
|
furi_hal_version_get_firmware_version();
|
2021-05-05 12:50:03 +03:00
|
|
|
|
|
|
|
if(!ver) {
|
|
|
|
canvas_draw_str(canvas, 5, 33, "No info");
|
|
|
|
return;
|
|
|
|
}
|
2021-04-19 19:30:25 +03:00
|
|
|
|
2021-05-05 12:50:03 +03:00
|
|
|
snprintf(
|
|
|
|
buffer,
|
|
|
|
sizeof(buffer),
|
|
|
|
"%s [%s]",
|
|
|
|
version_get_version(ver),
|
|
|
|
version_get_builddate(ver));
|
|
|
|
canvas_draw_str(canvas, 5, 33, buffer);
|
2021-04-19 19:30:25 +03:00
|
|
|
|
2021-05-05 12:50:03 +03:00
|
|
|
snprintf(
|
|
|
|
buffer,
|
|
|
|
sizeof(buffer),
|
|
|
|
"%s [%s]",
|
|
|
|
version_get_githash(ver),
|
|
|
|
version_get_gitbranchnum(ver));
|
|
|
|
canvas_draw_str(canvas, 5, 43, buffer);
|
2021-04-19 19:30:25 +03:00
|
|
|
|
2021-05-05 12:50:03 +03:00
|
|
|
snprintf(
|
|
|
|
buffer, sizeof(buffer), "[%s] %s", version_get_target(ver), version_get_gitbranch(ver));
|
|
|
|
canvas_draw_str(canvas, 5, 53, buffer);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
char buffer[64];
|
|
|
|
canvas_set_font(canvas, FontSecondary);
|
|
|
|
snprintf(buffer, 64, "Icounter: %ld", m->icounter);
|
|
|
|
canvas_draw_str(canvas, 5, 30, buffer);
|
|
|
|
snprintf(buffer, 64, "Butthurt: %ld", m->butthurt);
|
|
|
|
canvas_draw_str(canvas, 5, 40, buffer);
|
|
|
|
canvas_draw_str(canvas, 0, 53, "[< >] icounter value [ok] save");
|
|
|
|
}
|
2021-02-18 15:49:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void dolphin_view_hw_mismatch_draw(Canvas* canvas, void* model) {
|
|
|
|
canvas_clear(canvas);
|
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
|
|
canvas_set_font(canvas, FontPrimary);
|
2021-04-06 20:09:15 +03:00
|
|
|
canvas_draw_str(canvas, 2, 15, "!!!! HW Mismatch !!!!");
|
2021-02-18 15:49:32 +03:00
|
|
|
|
|
|
|
char buffer[64];
|
|
|
|
canvas_set_font(canvas, FontSecondary);
|
2021-08-08 21:03:25 +03:00
|
|
|
snprintf(buffer, 64, "HW target: F%d", furi_hal_version_get_hw_target());
|
2021-04-06 20:09:15 +03:00
|
|
|
canvas_draw_str(canvas, 5, 27, buffer);
|
2021-07-04 19:01:16 +03:00
|
|
|
canvas_draw_str(canvas, 5, 38, "FW target: " TARGET);
|
2021-01-08 07:42:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t dolphin_view_idle_back(void* context) {
|
|
|
|
return DolphinViewIdleMain;
|
|
|
|
}
|