mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-23 01:18:12 -07:00
Merge remote-tracking branch 'ofw/dev' into mntm-dev
This commit is contained in:
@@ -135,4 +135,4 @@ void buffer_stream_reset(BufferStream* buffer_stream) {
|
||||
buffer_reset(&buffer_stream->buffers[i]);
|
||||
}
|
||||
FURI_CRITICAL_EXIT();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
bool hex_char_to_hex_nibble(char c, uint8_t* nibble) {
|
||||
furi_check(nibble);
|
||||
|
||||
if((c >= '0' && c <= '9')) {
|
||||
if(c >= '0' && c <= '9') {
|
||||
*nibble = c - '0';
|
||||
return true;
|
||||
} else if((c >= 'A' && c <= 'F')) {
|
||||
} else if(c >= 'A' && c <= 'F') {
|
||||
*nibble = c - 'A' + 10;
|
||||
return true;
|
||||
} else if(c >= 'a' && c <= 'f') {
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
|
||||
#ifdef LEVEL_DURATION_BIG
|
||||
|
||||
#define LEVEL_DURATION_RESET 0U
|
||||
#define LEVEL_DURATION_LEVEL_LOW 1U
|
||||
#define LEVEL_DURATION_RESET 0U
|
||||
#define LEVEL_DURATION_LEVEL_LOW 1U
|
||||
#define LEVEL_DURATION_LEVEL_HIGH 2U
|
||||
#define LEVEL_DURATION_WAIT 3U
|
||||
#define LEVEL_DURATION_RESERVED 0x800000U
|
||||
#define LEVEL_DURATION_WAIT 3U
|
||||
#define LEVEL_DURATION_RESERVED 0x800000U
|
||||
|
||||
typedef struct {
|
||||
uint32_t duration : 30;
|
||||
uint8_t level : 2;
|
||||
uint8_t level : 2;
|
||||
} LevelDuration;
|
||||
|
||||
static inline LevelDuration level_duration_make(bool level, uint32_t duration) {
|
||||
@@ -54,7 +54,7 @@ static inline uint32_t level_duration_get_duration(LevelDuration level_duration)
|
||||
|
||||
#else
|
||||
|
||||
#define LEVEL_DURATION_RESET 0U
|
||||
#define LEVEL_DURATION_RESET 0U
|
||||
#define LEVEL_DURATION_RESERVED 0x800000U
|
||||
|
||||
typedef int32_t LevelDuration;
|
||||
@@ -68,11 +68,11 @@ static inline LevelDuration level_duration_reset() {
|
||||
}
|
||||
|
||||
static inline bool level_duration_is_reset(LevelDuration level_duration) {
|
||||
return (level_duration == LEVEL_DURATION_RESET);
|
||||
return level_duration == LEVEL_DURATION_RESET;
|
||||
}
|
||||
|
||||
static inline bool level_duration_get_level(LevelDuration level_duration) {
|
||||
return (level_duration > 0);
|
||||
return level_duration > 0;
|
||||
}
|
||||
|
||||
static inline uint32_t level_duration_get_duration(LevelDuration level_duration) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
#include <m-core.h>
|
||||
|
||||
#define M_INIT_DUP(a) ((a) = strdup(""))
|
||||
#define M_INIT_DUP(a) ((a) = strdup(""))
|
||||
#define M_INIT_SET_DUP(a, b) ((a) = strdup(b))
|
||||
#define M_SET_DUP(a, b) (free((void*)a), (a) = strdup(b))
|
||||
#define M_CLEAR_DUP(a) (free((void*)a))
|
||||
#define M_SET_DUP(a, b) (free((void*)a), (a) = strdup(b))
|
||||
#define M_CLEAR_DUP(a) (free((void*)a))
|
||||
|
||||
#define M_CSTR_DUP_OPLIST \
|
||||
(INIT(M_INIT_DUP), \
|
||||
|
||||
@@ -55,4 +55,4 @@ bool md5_string_calc_file(File* file, const char* path, FuriString* output, FS_E
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PRETTY_FORMAT_FONT_BOLD "\e#"
|
||||
#define PRETTY_FORMAT_FONT_BOLD "\e#"
|
||||
#define PRETTY_FORMAT_FONT_MONOSPACE "\e*"
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,4 +20,4 @@ void profiler_dump(Profiler* profiler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -44,4 +44,4 @@ typedef struct {
|
||||
ProtocolRenderData render_data;
|
||||
ProtocolRenderData render_brief_data;
|
||||
ProtocolWriteData write_data;
|
||||
} ProtocolBase;
|
||||
} ProtocolBase;
|
||||
|
||||
@@ -245,4 +245,4 @@ bool protocol_dict_get_write_data(ProtocolDict* dict, size_t protocol_index, voi
|
||||
|
||||
furi_check(fn);
|
||||
return fn(dict->data[protocol_index], data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ typedef struct ProtocolDict ProtocolDict;
|
||||
|
||||
typedef int32_t ProtocolId;
|
||||
|
||||
#define PROTOCOL_NO (-1)
|
||||
#define PROTOCOL_NO (-1)
|
||||
#define PROTOCOL_ALL_FEATURES (0xFFFFFFFF)
|
||||
|
||||
ProtocolDict* protocol_dict_alloc(const ProtocolBase** protocols, size_t protocol_count);
|
||||
|
||||
@@ -114,4 +114,4 @@ void pulse_joiner_pop_pulse(PulseJoiner* pulse_joiner, size_t* period, size_t* p
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,4 +43,4 @@ void pulse_joiner_pop_pulse(PulseJoiner* pulse_joiner, size_t* period, size_t* p
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -144,7 +144,7 @@ static bool stream_write_struct(Stream* stream, const void* context) {
|
||||
furi_check(stream);
|
||||
furi_check(context);
|
||||
const StreamWriteData* write_data = context;
|
||||
return (stream_write(stream, write_data->data, write_data->size) == write_data->size);
|
||||
return stream_write(stream, write_data->data, write_data->size) == write_data->size;
|
||||
}
|
||||
|
||||
bool stream_read_line(Stream* stream, FuriString* str_result) {
|
||||
|
||||
@@ -51,7 +51,7 @@ static void string_stream_free(StringStream* stream) {
|
||||
}
|
||||
|
||||
static bool string_stream_eof(StringStream* stream) {
|
||||
return (string_stream_tell(stream) >= string_stream_size(stream));
|
||||
return string_stream_tell(stream) >= string_stream_size(stream);
|
||||
}
|
||||
|
||||
static void string_stream_clean(StringStream* stream) {
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
#include <toolbox/compress.h>
|
||||
|
||||
#define TAG "TarArch"
|
||||
#define MAX_NAME_LEN 254
|
||||
|
||||
#define MAX_NAME_LEN 254
|
||||
#define FILE_BLOCK_SIZE (10 * 1024)
|
||||
|
||||
#define FILE_OPEN_NTRIES 10
|
||||
#define FILE_OPEN_NTRIES 10
|
||||
#define FILE_OPEN_RETRY_DELAY 25
|
||||
|
||||
TarOpenMode tar_archive_get_mode_for_path(const char* path) {
|
||||
@@ -281,12 +282,12 @@ bool tar_archive_get_read_progress(TarArchive* archive, int32_t* processed, int3
|
||||
|
||||
bool tar_archive_dir_add_element(TarArchive* archive, const char* dirpath) {
|
||||
furi_check(archive);
|
||||
return (mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS);
|
||||
return mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_finalize(TarArchive* archive) {
|
||||
furi_check(archive);
|
||||
return (mtar_finalize(&archive->tar) == MTAR_ESUCCESS);
|
||||
return mtar_finalize(&archive->tar) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_store_data(
|
||||
@@ -296,16 +297,15 @@ bool tar_archive_store_data(
|
||||
const int32_t data_len) {
|
||||
furi_check(archive);
|
||||
|
||||
return (
|
||||
tar_archive_file_add_header(archive, path, data_len) &&
|
||||
tar_archive_file_add_data_block(archive, data, data_len) &&
|
||||
tar_archive_file_finalize(archive));
|
||||
return tar_archive_file_add_header(archive, path, data_len) &&
|
||||
tar_archive_file_add_data_block(archive, data, data_len) &&
|
||||
tar_archive_file_finalize(archive);
|
||||
}
|
||||
|
||||
bool tar_archive_file_add_header(TarArchive* archive, const char* path, const int32_t data_len) {
|
||||
furi_check(archive);
|
||||
|
||||
return (mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS);
|
||||
return mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_file_add_data_block(
|
||||
@@ -314,12 +314,12 @@ bool tar_archive_file_add_data_block(
|
||||
const int32_t block_len) {
|
||||
furi_check(archive);
|
||||
|
||||
return (mtar_write_data(&archive->tar, data_block, block_len) == block_len);
|
||||
return mtar_write_data(&archive->tar, data_block, block_len) == block_len;
|
||||
}
|
||||
|
||||
bool tar_archive_file_finalize(TarArchive* archive) {
|
||||
furi_check(archive);
|
||||
return (mtar_end_data(&archive->tar) == MTAR_ESUCCESS);
|
||||
return mtar_end_data(&archive->tar) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -439,8 +439,8 @@ bool tar_archive_unpack_to(
|
||||
|
||||
FURI_LOG_I(TAG, "Restoring '%s'", destination);
|
||||
|
||||
return (mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS);
|
||||
};
|
||||
return mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_add_file(
|
||||
TarArchive* archive,
|
||||
|
||||
@@ -32,4 +32,4 @@ size_t varint_int32_length(int32_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user