2021-02-12 20:24:34 +03:00
|
|
|
#include "flipper.h"
|
|
|
|
#include <applications.h>
|
|
|
|
#include <furi.h>
|
2022-01-05 19:10:18 +03:00
|
|
|
#include <furi_hal_version.h>
|
2021-04-19 19:30:25 +03:00
|
|
|
|
2021-11-12 16:04:35 +03:00
|
|
|
#define TAG "Flipper"
|
|
|
|
|
2021-04-30 14:20:33 +03:00
|
|
|
static void flipper_print_version(const char* target, const Version* version) {
|
2021-04-19 19:30:25 +03:00
|
|
|
if(version) {
|
2021-04-30 14:20:33 +03:00
|
|
|
FURI_LOG_I(
|
2021-11-12 16:04:35 +03:00
|
|
|
TAG,
|
2021-04-30 14:20:33 +03:00
|
|
|
"\r\n\t%s version:\t%s\r\n"
|
|
|
|
"\tBuild date:\t\t%s\r\n"
|
|
|
|
"\tGit Commit:\t\t%s (%s)\r\n"
|
|
|
|
"\tGit Branch:\t\t%s",
|
|
|
|
target,
|
|
|
|
version_get_version(version),
|
|
|
|
version_get_builddate(version),
|
2021-04-19 19:30:25 +03:00
|
|
|
version_get_githash(version),
|
2021-04-30 14:20:33 +03:00
|
|
|
version_get_gitbranchnum(version),
|
|
|
|
version_get_gitbranch(version));
|
2021-04-19 19:30:25 +03:00
|
|
|
} else {
|
2021-11-12 16:04:35 +03:00
|
|
|
FURI_LOG_I(TAG, "No build info for %s", target);
|
2021-04-19 19:30:25 +03:00
|
|
|
}
|
|
|
|
}
|
2021-02-12 20:24:34 +03:00
|
|
|
|
|
|
|
void flipper_init() {
|
2021-04-19 19:30:25 +03:00
|
|
|
const Version* version;
|
|
|
|
|
2021-10-26 15:24:14 +03:00
|
|
|
version = (const Version*)furi_hal_version_get_bootloader_version();
|
2021-04-30 14:20:33 +03:00
|
|
|
flipper_print_version("Bootloader", version);
|
2021-04-19 19:30:25 +03:00
|
|
|
|
2021-08-08 21:03:25 +03:00
|
|
|
version = (const Version*)furi_hal_version_get_firmware_version();
|
2021-04-30 14:20:33 +03:00
|
|
|
flipper_print_version("Firmware", version);
|
2021-02-12 20:24:34 +03:00
|
|
|
|
2021-11-12 16:04:35 +03:00
|
|
|
FURI_LOG_I(TAG, "starting services");
|
2021-02-12 20:24:34 +03:00
|
|
|
|
|
|
|
for(size_t i = 0; i < FLIPPER_SERVICES_COUNT; i++) {
|
2021-11-12 16:04:35 +03:00
|
|
|
FURI_LOG_I(TAG, "starting service %s", FLIPPER_SERVICES[i].name);
|
2021-02-12 20:24:34 +03:00
|
|
|
|
|
|
|
FuriThread* thread = furi_thread_alloc();
|
|
|
|
|
|
|
|
furi_thread_set_name(thread, FLIPPER_SERVICES[i].name);
|
|
|
|
furi_thread_set_stack_size(thread, FLIPPER_SERVICES[i].stack_size);
|
|
|
|
furi_thread_set_callback(thread, FLIPPER_SERVICES[i].app);
|
|
|
|
|
|
|
|
furi_thread_start(thread);
|
|
|
|
}
|
|
|
|
|
2021-11-12 16:04:35 +03:00
|
|
|
FURI_LOG_I(TAG, "services startup complete");
|
2021-04-19 19:30:25 +03:00
|
|
|
}
|