mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 04:34:43 +04:00
merge manually formatted stuff too
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
#include <cli/cli.h>
|
||||
#include <toolbox/args.h>
|
||||
|
||||
#define TAG "SpeakerDebug"
|
||||
#define TAG "SpeakerDebug"
|
||||
|
||||
#define CLI_COMMAND "speaker_debug"
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
#include <notification/notification.h>
|
||||
#include <notification/notification_messages.h>
|
||||
|
||||
#define TAG "UartEcho"
|
||||
|
||||
#define LINES_ON_SCREEN 6
|
||||
#define COLUMNS_ON_SCREEN 21
|
||||
#define TAG "UartEcho"
|
||||
#define DEFAULT_BAUD_RATE 230400
|
||||
|
||||
typedef struct UartDumpModel UartDumpModel;
|
||||
@@ -147,7 +148,7 @@ static void uart_echo_push_to_list(UartDumpModel* model, const char data) {
|
||||
bool new_string_needed = false;
|
||||
if(furi_string_size(model->list[model->line]->text) >= COLUMNS_ON_SCREEN) {
|
||||
new_string_needed = true;
|
||||
} else if((data == '\n' || data == '\r')) {
|
||||
} else if(data == '\n' || data == '\r') {
|
||||
// pack line breaks
|
||||
if(model->last_char != '\n' && model->last_char != '\r') {
|
||||
new_string_needed = true;
|
||||
|
||||
@@ -42,7 +42,8 @@ typedef struct {
|
||||
|
||||
static RpcSessionContext rpc_session[TEST_RPC_SESSIONS];
|
||||
|
||||
#define TAG "UnitTestsRpc"
|
||||
#define TAG "UnitTestsRpc"
|
||||
|
||||
#define MAX_RECEIVE_OUTPUT_TIMEOUT 3000
|
||||
#define MAX_NAME_LENGTH 255
|
||||
#define MAX_DATA_SIZE 512u // have to be exact as in rpc_storage.c
|
||||
@@ -554,7 +555,7 @@ static bool test_rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_
|
||||
time_left = MAX(time_left, 0);
|
||||
bytes_received =
|
||||
furi_stream_buffer_receive(session_context->output_stream, buf, count, time_left);
|
||||
return (count == bytes_received);
|
||||
return count == bytes_received;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
#include <lib/subghz/devices/devices.h>
|
||||
#include <lib/subghz/devices/cc1101_configs.h>
|
||||
|
||||
#define TAG "SubGhzTest"
|
||||
#define TAG "SubGhzTest"
|
||||
|
||||
#define KEYSTORE_DIR_NAME EXT_PATH("subghz/assets/keeloq_mfcodes")
|
||||
#define CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo")
|
||||
#define NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s")
|
||||
|
||||
@@ -390,7 +390,7 @@ bool subghz_device_cc1101_ext_is_rx_data_crc_valid(void) {
|
||||
cc1101_read_reg(
|
||||
subghz_device_cc1101_ext->spi_bus_handle, CC1101_STATUS_LQI | CC1101_BURST, data);
|
||||
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
||||
if(((data[0] >> 7) & 0x01)) {
|
||||
if((data[0] >> 7) & 0x01) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -879,9 +879,8 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
|
||||
}
|
||||
|
||||
bool subghz_device_cc1101_ext_is_async_tx_complete(void) {
|
||||
return (
|
||||
(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) &&
|
||||
(LL_TIM_GetAutoReload(TIM17) == 0));
|
||||
return (subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) &&
|
||||
(LL_TIM_GetAutoReload(TIM17) == 0);
|
||||
}
|
||||
|
||||
void subghz_device_cc1101_ext_stop_async_tx(void) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define TAG "ble_beacon_app"
|
||||
#define TAG "BleBeaconApp"
|
||||
|
||||
static bool ble_beacon_app_custom_event_callback(void* context, uint32_t event) {
|
||||
furi_assert(context);
|
||||
|
||||
@@ -344,7 +344,7 @@ bool archive_is_home(ArchiveBrowserView* browser) {
|
||||
}
|
||||
|
||||
const char* default_path = archive_get_default_path(archive_get_tab(browser));
|
||||
return (furi_string_cmp_str(browser->path, default_path) == 0);
|
||||
return furi_string_cmp_str(browser->path, default_path) == 0;
|
||||
}
|
||||
|
||||
const char* archive_get_name(ArchiveBrowserView* browser) {
|
||||
|
||||
@@ -67,7 +67,7 @@ static inline const char* archive_get_default_path(ArchiveTabEnum tab) {
|
||||
}
|
||||
|
||||
inline bool archive_is_known_app(ArchiveFileTypeEnum type) {
|
||||
return (type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown);
|
||||
return type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown;
|
||||
}
|
||||
|
||||
bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx);
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include "ducky_script_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#define TAG "BadUsb"
|
||||
#define TAG "BadUsb"
|
||||
|
||||
#define WORKER_TAG TAG "Worker"
|
||||
|
||||
#define BADUSB_ASCII_TO_KEY(script, x) \
|
||||
@@ -46,7 +47,7 @@ uint32_t ducky_get_command_len(const char* line) {
|
||||
}
|
||||
|
||||
bool ducky_is_line_end(const char chr) {
|
||||
return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n'));
|
||||
return (chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n');
|
||||
}
|
||||
|
||||
uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept_chars) {
|
||||
@@ -56,7 +57,7 @@ uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept
|
||||
}
|
||||
|
||||
if((accept_chars) && (strlen(param) > 0)) {
|
||||
return (BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF);
|
||||
return BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -309,7 +310,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur - 1U);
|
||||
return SCRIPT_STATE_ERROR;
|
||||
} else {
|
||||
return (delay_val + bad_usb->defdelay);
|
||||
return delay_val + bad_usb->defdelay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +349,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur);
|
||||
return SCRIPT_STATE_ERROR;
|
||||
} else {
|
||||
return (delay_val + bad_usb->defdelay);
|
||||
return delay_val + bad_usb->defdelay;
|
||||
}
|
||||
} else {
|
||||
furi_string_push_back(bad_usb->line, bad_usb->file_buf[i]);
|
||||
|
||||
@@ -215,7 +215,8 @@ static const DuckyCmd ducky_commands[] = {
|
||||
{"GLOBE", ducky_fnc_globe, -1},
|
||||
};
|
||||
|
||||
#define TAG "BadUsb"
|
||||
#define TAG "BadUsb"
|
||||
|
||||
#define WORKER_TAG TAG "Worker"
|
||||
|
||||
int32_t ducky_execute_cmd(BadUsbScript* bad_usb, const char* line) {
|
||||
@@ -231,7 +232,7 @@ int32_t ducky_execute_cmd(BadUsbScript* bad_usb, const char* line) {
|
||||
if(ducky_commands[i].callback == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
return ((ducky_commands[i].callback)(bad_usb, line, ducky_commands[i].param));
|
||||
return (ducky_commands[i].callback)(bad_usb, line, ducky_commands[i].param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ static bool infrared_move_view_input_callback(InputEvent* event, void* context)
|
||||
|
||||
bool consumed = false;
|
||||
|
||||
if(((event->type == InputTypeShort || event->type == InputTypeRepeat)) &&
|
||||
if((event->type == InputTypeShort || event->type == InputTypeRepeat) &&
|
||||
((event->key == InputKeyUp) || (event->key == InputKeyDown))) {
|
||||
with_view_model(
|
||||
move_view->view,
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
#include <bit_lib.h>
|
||||
|
||||
#define TAG "HI!"
|
||||
#define TAG "HI!"
|
||||
|
||||
#define KEY_LENGTH 6
|
||||
#define HI_KEY_TO_GEN 5
|
||||
#define UID_LENGTH 7
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
#include <bit_lib.h>
|
||||
|
||||
#define TAG "Microel"
|
||||
#define TAG "Microel"
|
||||
|
||||
#define KEY_LENGTH 6
|
||||
#define UID_LENGTH 4
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
#include <bit_lib.h>
|
||||
|
||||
#define TAG "MiZIP"
|
||||
#define TAG "MiZIP"
|
||||
|
||||
#define KEY_LENGTH 6
|
||||
#define MIZIP_KEY_TO_GEN 5
|
||||
#define UID_LENGTH 4
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
#include <bit_lib.h>
|
||||
|
||||
#define TAG "Saflok"
|
||||
#define TAG "Saflok"
|
||||
|
||||
#define MAGIC_TABLE_SIZE 192
|
||||
#define KEY_LENGTH 6
|
||||
#define UID_LENGTH 4
|
||||
|
||||
@@ -38,7 +38,7 @@ bool parse_datetime(uint16_t date, DateTime* result) {
|
||||
result->year = 2000 + (date >> 9);
|
||||
result->month = date >> 5 & 0x0F;
|
||||
result->day = date & 0x1F;
|
||||
return (date != 0);
|
||||
return date != 0;
|
||||
}
|
||||
|
||||
static bool umarsh_parse(const NfcDevice* device, FuriString* parsed_data) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "subghz_chat.h"
|
||||
#include <lib/subghz/subghz_tx_rx_worker.h>
|
||||
|
||||
#define TAG "SubGhzChat"
|
||||
#define TAG "SubGhzChat"
|
||||
|
||||
#define SUBGHZ_CHAT_WORKER_TIMEOUT_BETWEEN_MESSAGES 500
|
||||
|
||||
struct SubGhzChatWorker {
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#include <float_tools.h>
|
||||
#include "../subghz_i.h"
|
||||
|
||||
#define TAG "SubGhzThresholdRssi"
|
||||
#define TAG "SubGhzThresholdRssi"
|
||||
|
||||
#define THRESHOLD_RSSI_LOW_COUNT 10
|
||||
|
||||
struct SubGhzThresholdRssi {
|
||||
|
||||
@@ -528,22 +528,19 @@ SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance) {
|
||||
|
||||
bool subghz_txrx_protocol_is_serializable(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return (
|
||||
(instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) ==
|
||||
SubGhzProtocolFlag_Save);
|
||||
return (instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) ==
|
||||
SubGhzProtocolFlag_Save;
|
||||
}
|
||||
|
||||
bool subghz_txrx_protocol_is_transmittable(SubGhzTxRx* instance, bool check_type) {
|
||||
furi_assert(instance);
|
||||
const SubGhzProtocol* protocol = instance->decoder_result->protocol;
|
||||
if(check_type) {
|
||||
return (
|
||||
((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
|
||||
protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic);
|
||||
return ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
|
||||
protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic;
|
||||
}
|
||||
return (
|
||||
((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
|
||||
protocol->encoder->deserialize);
|
||||
return ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
|
||||
protocol->encoder->deserialize;
|
||||
}
|
||||
|
||||
void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "../subghz_i.h"
|
||||
|
||||
#define TAG "SubGhzDecodeRaw"
|
||||
#define TAG "SubGhzDecodeRaw"
|
||||
|
||||
#define SAMPLES_TO_READ_PER_TICK 400
|
||||
|
||||
static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
|
||||
@@ -414,7 +414,7 @@ void subghz_unlock(SubGhz* subghz) {
|
||||
|
||||
bool subghz_is_locked(SubGhz* subghz) {
|
||||
furi_assert(subghz);
|
||||
return (subghz->lock == SubGhzLockOn);
|
||||
return subghz->lock == SubGhzLockOn;
|
||||
}
|
||||
|
||||
void subghz_rx_key_state_set(SubGhz* subghz, SubGhzRxKeyState state) {
|
||||
|
||||
@@ -186,7 +186,7 @@ void subghz_view_receiver_add_item_to_menu(
|
||||
item_menu->time = furi_string_alloc_set(time);
|
||||
item_menu->item_str = furi_string_alloc_set(name);
|
||||
item_menu->type = type;
|
||||
if((model->idx == model->history_item - 1)) {
|
||||
if(model->idx == model->history_item - 1) {
|
||||
model->history_item++;
|
||||
model->idx++;
|
||||
subghz_view_receiver_show_time_moment(subghz_receiver);
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
#include <mbedtls/ecdsa.h>
|
||||
#include <mbedtls/error.h>
|
||||
|
||||
#define TAG "U2f"
|
||||
#define TAG "U2f"
|
||||
|
||||
#define WORKER_TAG TAG "Worker"
|
||||
|
||||
#define MCHECK(expr) furi_check((expr) == 0)
|
||||
@@ -315,7 +316,7 @@ static uint16_t u2f_register(U2fData* U2F, uint8_t* buf) {
|
||||
uint8_t signature_len = u2f_der_encode_signature(resp->cert + cert_len, signature);
|
||||
memcpy(resp->cert + cert_len + signature_len, state_no_error, 2);
|
||||
|
||||
return (sizeof(U2fRegisterResp) + cert_len + signature_len + 2);
|
||||
return sizeof(U2fRegisterResp) + cert_len + signature_len + 2;
|
||||
}
|
||||
|
||||
static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) {
|
||||
@@ -410,7 +411,7 @@ static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) {
|
||||
|
||||
if(U2F->callback != NULL) U2F->callback(U2fNotifyAuthSuccess, U2F->context);
|
||||
|
||||
return (sizeof(U2fAuthResp) + signature_len + 2);
|
||||
return sizeof(U2fAuthResp) + signature_len + 2;
|
||||
}
|
||||
|
||||
uint16_t u2f_msg_parse(U2fData* U2F, uint8_t* buf, uint16_t len) {
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include <furi_hal_usb_hid_u2f.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define TAG "U2fHid"
|
||||
#define TAG "U2fHid"
|
||||
|
||||
#define WORKER_TAG TAG "Worker"
|
||||
|
||||
#define U2F_HID_MAX_PAYLOAD_LEN ((HID_U2F_PACKET_LEN - 7) + 128 * (HID_U2F_PACKET_LEN - 5))
|
||||
|
||||
@@ -79,7 +79,7 @@ size_t cli_read_timeout(Cli* cli, uint8_t* buffer, size_t size, uint32_t timeout
|
||||
bool cli_is_connected(Cli* cli) {
|
||||
furi_check(cli);
|
||||
if(cli->session != NULL) {
|
||||
return (cli->session->is_connected());
|
||||
return cli->session->is_connected();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ static bool browser_filter_by_name(BrowserWorker* browser, FuriString* name, boo
|
||||
if(is_folder) {
|
||||
// Skip assets folders (if enabled)
|
||||
if(browser->skip_assets) {
|
||||
return ((furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true));
|
||||
return (furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ static bool browser_folder_load_chunked(
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return (items_cnt == count);
|
||||
return items_cnt == count;
|
||||
}
|
||||
|
||||
// Load all files at once, may cause memory overflow so need to limit that to about 400 files
|
||||
@@ -571,7 +571,7 @@ void file_browser_worker_folder_enter(BrowserWorker* browser, FuriString* path,
|
||||
|
||||
bool file_browser_worker_is_in_start_folder(BrowserWorker* browser) {
|
||||
furi_check(browser);
|
||||
return (furi_string_cmp(browser->path_start, browser->path_current) == 0);
|
||||
return furi_string_cmp(browser->path_start, browser->path_current) == 0;
|
||||
}
|
||||
|
||||
void file_browser_worker_folder_exit(BrowserWorker* browser) {
|
||||
|
||||
@@ -157,7 +157,7 @@ void menu_free(Menu* menu) {
|
||||
|
||||
View* menu_get_view(Menu* menu) {
|
||||
furi_check(menu);
|
||||
return (menu->view);
|
||||
return menu->view;
|
||||
}
|
||||
|
||||
void menu_add_item(
|
||||
|
||||
@@ -136,7 +136,7 @@ static char get_selected_char(TextInputModel* model) {
|
||||
}
|
||||
|
||||
static bool char_is_lowercase(char letter) {
|
||||
return (letter >= 0x61 && letter <= 0x7A);
|
||||
return letter >= 0x61 && letter <= 0x7A;
|
||||
}
|
||||
|
||||
static char char_to_uppercase(const char letter) {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <loader/firmware_api/firmware_api.h>
|
||||
|
||||
#define TAG "Loader"
|
||||
#define TAG "Loader"
|
||||
|
||||
#define LOADER_MAGIC_THREAD_VALUE 0xDEADBEEF
|
||||
|
||||
// helpers
|
||||
|
||||
@@ -31,7 +31,7 @@ float locale_fahrenheit_to_celsius(float temp_f) {
|
||||
}
|
||||
|
||||
float locale_celsius_to_fahrenheit(float temp_c) {
|
||||
return (temp_c * 1.8f + 32.f);
|
||||
return temp_c * 1.8f + 32.f;
|
||||
}
|
||||
|
||||
void locale_format_time(
|
||||
|
||||
@@ -143,17 +143,16 @@ static void notification_apply_notification_leds(NotificationApp* app, const uin
|
||||
|
||||
// settings
|
||||
uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value) {
|
||||
return (value * app->settings.display_brightness);
|
||||
return value * app->settings.display_brightness;
|
||||
}
|
||||
|
||||
static uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value) {
|
||||
return (value * app->settings.led_brightness);
|
||||
return value * app->settings.led_brightness;
|
||||
}
|
||||
|
||||
static uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app) {
|
||||
return (
|
||||
(float)(app->settings.display_off_delay_ms) /
|
||||
(1000.0f / furi_kernel_get_tick_frequency()));
|
||||
return (float)(app->settings.display_off_delay_ms) /
|
||||
(1000.0f / furi_kernel_get_tick_frequency());
|
||||
}
|
||||
|
||||
// generics
|
||||
|
||||
@@ -232,7 +232,7 @@ bool rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_t count) {
|
||||
rpc_debug_print_data("INPUT", buf, bytes_received);
|
||||
#endif
|
||||
|
||||
return (count == bytes_received);
|
||||
return count == bytes_received;
|
||||
}
|
||||
|
||||
static bool rpc_pb_content_callback(pb_istream_t* stream, const pb_field_t* field, void** arg) {
|
||||
|
||||
@@ -40,5 +40,5 @@ const char* filesystem_api_error_get_desc(FS_Error error_id) {
|
||||
|
||||
bool file_info_is_dir(const FileInfo* file_info) {
|
||||
furi_check(file_info);
|
||||
return (file_info->flags & FSF_DIRECTORY);
|
||||
return file_info->flags & FSF_DIRECTORY;
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ static void storage_cli_write(Cli* cli, FuriString* path, FuriString* args) {
|
||||
fflush(stdout);
|
||||
read_index++;
|
||||
|
||||
if(((read_index % buffer_size) == 0)) {
|
||||
if((read_index % buffer_size) == 0) {
|
||||
size_t written_size = storage_file_write(file, buffer, buffer_size);
|
||||
|
||||
if(written_size != buffer_size) {
|
||||
|
||||
@@ -929,12 +929,12 @@ File* storage_file_alloc(Storage* storage) {
|
||||
|
||||
bool storage_file_is_open(File* file) {
|
||||
furi_check(file);
|
||||
return (file->type != FileTypeClosed);
|
||||
return file->type != FileTypeClosed;
|
||||
}
|
||||
|
||||
bool storage_file_is_dir(File* file) {
|
||||
furi_check(file);
|
||||
return (file->type == FileTypeOpenDir);
|
||||
return file->type == FileTypeOpenDir;
|
||||
}
|
||||
|
||||
void storage_file_free(File* file) {
|
||||
|
||||
@@ -337,7 +337,7 @@ static bool storage_ext_file_open(
|
||||
|
||||
file->internal_error_id = f_open(file_data, path, _mode);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_ext_file_close(void* ctx, File* file) {
|
||||
@@ -347,7 +347,7 @@ static bool storage_ext_file_close(void* ctx, File* file) {
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
free(file_data);
|
||||
storage_set_storage_file_data(file, NULL, storage);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
@@ -392,7 +392,7 @@ static bool
|
||||
}
|
||||
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint64_t storage_ext_file_tell(void* ctx, File* file) {
|
||||
@@ -416,7 +416,7 @@ static bool storage_ext_file_truncate(void* ctx, File* file) {
|
||||
|
||||
file->internal_error_id = f_truncate(file_data);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ static bool storage_ext_file_sync(void* ctx, File* file) {
|
||||
|
||||
file->internal_error_id = f_sync(file_data);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ static bool storage_ext_dir_open(void* ctx, File* file, const char* path) {
|
||||
storage_set_storage_file_data(file, file_data, storage);
|
||||
file->internal_error_id = f_opendir(file_data, path);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_ext_dir_close(void* ctx, File* file) {
|
||||
@@ -474,7 +474,7 @@ static bool storage_ext_dir_close(void* ctx, File* file) {
|
||||
file->internal_error_id = f_closedir(file_data);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
free(file_data);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_ext_dir_read(
|
||||
@@ -505,7 +505,7 @@ static bool storage_ext_dir_read(
|
||||
file->error_id = FSE_NOT_EXIST;
|
||||
}
|
||||
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_ext_dir_rewind(void* ctx, File* file) {
|
||||
@@ -514,7 +514,7 @@ static bool storage_ext_dir_rewind(void* ctx, File* file) {
|
||||
|
||||
file->internal_error_id = f_readdir(file_data, NULL);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
/******************* Common FS Functions *******************/
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <furi_hal.h>
|
||||
#include <toolbox/path.h>
|
||||
|
||||
#define TAG "StorageInt"
|
||||
#define TAG "StorageInt"
|
||||
|
||||
#define STORAGE_PATH STORAGE_INT_PATH_PREFIX
|
||||
#define LFS_CLEAN_FINGERPRINT 0
|
||||
|
||||
@@ -287,7 +288,7 @@ static bool storage_int_check_for_free_space(StorageData* storage) {
|
||||
lfs_size_t free_space =
|
||||
(lfs_data->config.block_count - result) * lfs_data->config.block_size;
|
||||
|
||||
return (free_space > LFS_RESERVED_PAGES_COUNT * furi_hal_flash_get_page_size());
|
||||
return free_space > LFS_RESERVED_PAGES_COUNT * furi_hal_flash_get_page_size();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -344,7 +345,7 @@ static bool storage_int_file_open(
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_file_close(void* ctx, File* file) {
|
||||
@@ -360,7 +361,7 @@ static bool storage_int_file_close(void* ctx, File* file) {
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
lfs_handle_free(handle);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
@@ -430,7 +431,7 @@ static bool
|
||||
}
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint64_t storage_int_file_tell(void* ctx, File* file) {
|
||||
@@ -475,7 +476,7 @@ static bool storage_int_file_truncate(void* ctx, File* file) {
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
}
|
||||
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_file_sync(void* ctx, File* file) {
|
||||
@@ -490,7 +491,7 @@ static bool storage_int_file_sync(void* ctx, File* file) {
|
||||
}
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint64_t storage_int_file_size(void* ctx, File* file) {
|
||||
@@ -557,7 +558,7 @@ static bool storage_int_dir_open(void* ctx, File* file, const char* path) {
|
||||
}
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_dir_close(void* ctx, File* file) {
|
||||
@@ -573,7 +574,7 @@ static bool storage_int_dir_close(void* ctx, File* file) {
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
lfs_handle_free(handle);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_dir_read(
|
||||
@@ -614,7 +615,7 @@ static bool storage_int_dir_read(
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
}
|
||||
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_dir_rewind(void* ctx, File* file) {
|
||||
@@ -629,7 +630,7 @@ static bool storage_int_dir_rewind(void* ctx, File* file) {
|
||||
}
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
/******************* Common FS Functions *******************/
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
#include "hid_icons.h"
|
||||
|
||||
#define TAG "HidMouseClicker"
|
||||
#define TAG "HidMouseClicker"
|
||||
|
||||
#define DEFAULT_CLICK_RATE 1
|
||||
#define MAXIMUM_CLICK_RATE 60
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include "../js_modules.h"
|
||||
#include <m-array.h>
|
||||
|
||||
#define TAG "js_serial"
|
||||
#define TAG "JsSerial"
|
||||
|
||||
#define RX_BUF_LEN 2048
|
||||
|
||||
typedef struct {
|
||||
@@ -529,14 +530,14 @@ static int32_t js_serial_expect_check_pattern_start(
|
||||
int32_t pattern_last) {
|
||||
size_t array_len = PatternArray_size(patterns);
|
||||
if((pattern_last + 1) >= (int32_t)array_len) {
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
for(size_t i = pattern_last + 1; i < array_len; i++) {
|
||||
if(PatternArray_get(patterns, i)->data[0] == value) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void js_serial_expect(struct mjs* mjs) {
|
||||
|
||||
@@ -18,7 +18,7 @@ static bool storage_move_to_sd_check_entry(const char* name, FileInfo* fileinfo,
|
||||
return true;
|
||||
}
|
||||
|
||||
return (name && (*name != '.'));
|
||||
return name && (*name != '.');
|
||||
}
|
||||
|
||||
static void storage_move_to_sd_remove_region() {
|
||||
|
||||
@@ -36,7 +36,7 @@ static bool page_task_compare_flash(
|
||||
const uint8_t* update_block,
|
||||
uint16_t update_block_len) {
|
||||
const size_t page_addr = furi_hal_flash_get_base() + furi_hal_flash_get_page_size() * i_page;
|
||||
return (memcmp(update_block, (void*)page_addr, update_block_len) == 0);
|
||||
return memcmp(update_block, (void*)page_addr, update_block_len) == 0;
|
||||
}
|
||||
|
||||
/* Verifies a flash operation address for fitting into writable memory
|
||||
@@ -44,7 +44,7 @@ static bool page_task_compare_flash(
|
||||
static bool check_address_boundaries(const size_t address) {
|
||||
const size_t min_allowed_address = furi_hal_flash_get_base();
|
||||
const size_t max_allowed_address = (size_t)furi_hal_flash_get_free_end_address();
|
||||
return ((address >= min_allowed_address) && (address < max_allowed_address));
|
||||
return (address >= min_allowed_address) && (address < max_allowed_address);
|
||||
}
|
||||
|
||||
static bool update_task_flash_program_page(
|
||||
|
||||
Reference in New Issue
Block a user