big merge with fz main repo

This commit is contained in:
Eng1n33r
2022-06-01 16:07:53 +03:00
parent a6c787e7e9
commit 22cbe276a8
133 changed files with 830 additions and 3162 deletions
-9
View File
@@ -4,7 +4,6 @@
struct iButtonKey {
uint8_t data[IBUTTON_KEY_DATA_SIZE];
char name[IBUTTON_KEY_NAME_SIZE];
iButtonKeyType type;
};
@@ -42,14 +41,6 @@ uint8_t ibutton_key_get_data_size(iButtonKey* key) {
return ibutton_key_get_size_by_type(key->type);
}
void ibutton_key_set_name(iButtonKey* key, const char* name) {
strlcpy(key->name, name, IBUTTON_KEY_NAME_SIZE);
}
const char* ibutton_key_get_name_p(iButtonKey* key) {
return key->name;
}
void ibutton_key_set_type(iButtonKey* key, iButtonKeyType key_type) {
key->type = key_type;
}
-14
View File
@@ -68,20 +68,6 @@ const uint8_t* ibutton_key_get_data_p(iButtonKey* key);
*/
uint8_t ibutton_key_get_data_size(iButtonKey* key);
/**
* Set key name
* @param key
* @param name
*/
void ibutton_key_set_name(iButtonKey* key, const char* name);
/**
* Get pointer to key name
* @param key
* @return const char*
*/
const char* ibutton_key_get_name_p(iButtonKey* key);
/**
* Set key type
* @param key
+8 -8
View File
@@ -152,8 +152,8 @@ static bool
level_duration_make(true, (uint32_t)subghz_protocol_secplus_v1_const.te_short * 2);
break;
case SECPLUS_V1_BIT_2:
instance->encoder.upload[index++] = level_duration_make(
false, (uint32_t)subghz_protocol_secplus_v1_const.te_short);
instance->encoder.upload[index++] =
level_duration_make(false, (uint32_t)subghz_protocol_secplus_v1_const.te_short);
instance->encoder.upload[index++] =
level_duration_make(true, (uint32_t)subghz_protocol_secplus_v1_const.te_short * 3);
break;
@@ -188,8 +188,8 @@ static bool
level_duration_make(true, (uint32_t)subghz_protocol_secplus_v1_const.te_short * 2);
break;
case SECPLUS_V1_BIT_2:
instance->encoder.upload[index++] = level_duration_make(
false, (uint32_t)subghz_protocol_secplus_v1_const.te_short);
instance->encoder.upload[index++] =
level_duration_make(false, (uint32_t)subghz_protocol_secplus_v1_const.te_short);
instance->encoder.upload[index++] =
level_duration_make(true, (uint32_t)subghz_protocol_secplus_v1_const.te_short * 3);
break;
@@ -278,10 +278,10 @@ bool subghz_protocol_encoder_secplus_v1_deserialize(void* context, FlipperFormat
flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
if(!subghz_protocol_secplus_v1_encode(instance)){
if(!subghz_protocol_secplus_v1_encode(instance)) {
break;
}
if(!subghz_protocol_encoder_secplus_v1_get_upload(instance)){
if(!subghz_protocol_encoder_secplus_v1_get_upload(instance)) {
break;
}
@@ -528,12 +528,12 @@ bool subghz_protocol_decoder_secplus_v1_deserialize(void* context, FlipperFormat
return subghz_block_generic_deserialize(&instance->generic, flipper_format);
}
bool subghz_protocol_secplus_v1_check_fixed (uint32_t fixed) {
bool subghz_protocol_secplus_v1_check_fixed(uint32_t fixed) {
//uint8_t id0 = (fixed / 3) % 3;
uint8_t id1 = (fixed / 9) % 3;
uint8_t btn = fixed % 3;
do{
do {
if(id1 == 0) return false;
if(!(btn == 0 || btn == 1 || btn == 2)) return false;
} while(false);
-1
View File
@@ -334,7 +334,6 @@ bool subghz_keystore_save(SubGhzKeystore* instance, const char* file_name, uint8
SubGhzKeyArray_t* subghz_keystore_get_data(SubGhzKeystore* instance) {
furi_assert(instance);
return &instance->data;
FURI_LOG_I(TAG, "array: \n", &instance->data);
}
bool subghz_keystore_raw_encrypted_save(
+14
View File
@@ -19,6 +19,20 @@ void path_extract_filename_no_ext(const char* path, string_t filename) {
string_mid(filename, start_position, end_position - start_position);
}
void path_extract_filename(string_t path, string_t name, bool trim_ext) {
size_t filename_start = string_search_rchar(path, '/');
if(filename_start > 0) {
filename_start++;
string_set_n(name, path, filename_start, string_size(path) - filename_start);
}
if(trim_ext) {
size_t dot = string_search_rchar(name, '.');
if(dot > 0) {
string_left(name, dot);
}
}
}
static inline void path_cleanup(string_t path) {
string_strim(path);
while(string_end_with_str_p(path, "/")) {
+9
View File
@@ -14,6 +14,15 @@ extern "C" {
*/
void path_extract_filename_no_ext(const char* path, string_t filename);
/**
* @brief Extract filename string from path.
*
* @param path path string
* @param filename output filename string. Must be initialized before.
* @param trim_ext true - get filename without extension
*/
void path_extract_filename(string_t path, string_t filename, bool trim_ext);
/**
* @brief Extract last path component
*
-2
View File
@@ -14,6 +14,4 @@ void set_random_name(char* name, uint8_t max_name_size) {
, datetime.hour, datetime.minute
);
sniprintf(name, max_name_size, "%s", strings[0]);
// Set first symbol to upper case
name[0] = name[0] - 0x20;
}