mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-09 23:18:10 -07:00
Port of custom_name from Unleashed
This commit is contained in:
+13
-1
@@ -23,10 +23,11 @@ struct Version {
|
||||
// v 1.1
|
||||
const char* firmware_origin;
|
||||
const char* git_origin;
|
||||
const char* custom_flipper_name;
|
||||
};
|
||||
|
||||
/* version of current running firmware (bootloader/flipper) */
|
||||
static const Version version = {
|
||||
static Version version = {
|
||||
.magic = VERSION_MAGIC,
|
||||
.major = VERSION_MAJOR,
|
||||
.minor = VERSION_MINOR,
|
||||
@@ -42,6 +43,7 @@ static const Version version = {
|
||||
.build_is_dirty = BUILD_DIRTY,
|
||||
.firmware_origin = FIRMWARE_ORIGIN,
|
||||
.git_origin = GIT_ORIGIN,
|
||||
.custom_flipper_name = NULL,
|
||||
};
|
||||
|
||||
const Version* version_get(void) {
|
||||
@@ -69,6 +71,16 @@ const char* version_get_version(const Version* v) {
|
||||
return v ? v->version : version.version;
|
||||
}
|
||||
|
||||
const char* version_get_custom_name(const Version* v) {
|
||||
return v ? v->custom_flipper_name : version.custom_flipper_name;
|
||||
}
|
||||
|
||||
void version_set_custom_name(Version* v, const char* name) {
|
||||
Version* ver = v ? v : &version;
|
||||
ver->custom_flipper_name = name;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t version_get_target(const Version* v) {
|
||||
return v ? v->target : version.target;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -64,6 +65,23 @@ const char* version_get_builddate(const Version* v);
|
||||
*/
|
||||
const char* version_get_version(const Version* v);
|
||||
|
||||
/** Get custom flipper name if set in version_set_custom_name
|
||||
*
|
||||
* @param v pointer to Version data. NULL for currently running
|
||||
* software.
|
||||
*
|
||||
* @return custom name or NULL
|
||||
*/
|
||||
const char* version_get_custom_name(const Version* v);
|
||||
|
||||
/** Set custom flipper name
|
||||
*
|
||||
* @param v pointer to Version data. NULL for currently running
|
||||
* software.
|
||||
* @param name Custom name or NULL
|
||||
*/
|
||||
void version_set_custom_name(Version* v, const char* name);
|
||||
|
||||
/** Get hardware target this firmware was built for
|
||||
*
|
||||
* @param v pointer to Version data. NULL for currently running
|
||||
|
||||
Reference in New Issue
Block a user