mirror of
https://github.com/flipperdevices/flipperzero-firmware.git
synced 2025-12-12 04:41:26 +04:00
[FL-3867] Code formatting update (#3765)
* clang-format: AllowShortEnumsOnASingleLine: false * clang-format: InsertNewlineAtEOF: true * clang-format: Standard: c++20 * clang-format: AlignConsecutiveBitFields * clang-format: AlignConsecutiveMacros * clang-format: RemoveParentheses: ReturnStatement * clang-format: RemoveSemicolon: true * Restored RemoveParentheses: Leave, retained general changes for it * formatting: fixed logging TAGs * Formatting update for dev Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -9,4 +9,4 @@ typedef enum {
|
||||
BtHidViewTikTok,
|
||||
HidViewDialog,
|
||||
HidViewPopup,
|
||||
} HidView;
|
||||
} HidView;
|
||||
|
||||
@@ -39,12 +39,12 @@ typedef struct {
|
||||
int8_t y;
|
||||
} HidKeyboardPoint;
|
||||
// 4 BY 12
|
||||
#define MARGIN_TOP 0
|
||||
#define MARGIN_LEFT 4
|
||||
#define KEY_WIDTH 9
|
||||
#define KEY_HEIGHT 12
|
||||
#define KEY_PADDING 1
|
||||
#define ROW_COUNT 7
|
||||
#define MARGIN_TOP 0
|
||||
#define MARGIN_LEFT 4
|
||||
#define KEY_WIDTH 9
|
||||
#define KEY_HEIGHT 12
|
||||
#define KEY_PADDING 1
|
||||
#define ROW_COUNT 7
|
||||
#define COLUMN_COUNT 12
|
||||
|
||||
// 0 width items are not drawn, but their value is used
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <gui/view.h>
|
||||
|
||||
#define MOUSE_MOVE_SHORT 5
|
||||
#define MOUSE_MOVE_LONG 20
|
||||
#define MOUSE_MOVE_LONG 20
|
||||
|
||||
typedef struct Hid Hid;
|
||||
typedef struct HidMouse HidMouse;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "hid_icons.h"
|
||||
|
||||
#define TAG "HidMouseClicker"
|
||||
|
||||
#define DEFAULT_CLICK_RATE 1
|
||||
#define MAXIMUM_CLICK_RATE 60
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <gui/view.h>
|
||||
|
||||
#define MOUSE_MOVE_SHORT 5
|
||||
#define MOUSE_MOVE_LONG 20
|
||||
#define MOUSE_MOVE_LONG 20
|
||||
|
||||
typedef struct Hid Hid;
|
||||
typedef struct HidMouseJiggler HidMouseJiggler;
|
||||
|
||||
@@ -126,4 +126,4 @@ mjs_val_t js_module_require(JsModules* modules, const char* name, size_t name_le
|
||||
furi_string_free(module_name);
|
||||
|
||||
return module_object;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <flipper_application/plugins/plugin_manager.h>
|
||||
#include <flipper_application/plugins/composite_resolver.h>
|
||||
|
||||
#define PLUGIN_APP_ID "js"
|
||||
#define PLUGIN_APP_ID "js"
|
||||
#define PLUGIN_API_VERSION 1
|
||||
|
||||
typedef void* (*JsModeConstructor)(struct mjs* mjs, mjs_val_t* object);
|
||||
|
||||
@@ -159,7 +159,7 @@ static void js_badusb_is_connected(struct mjs* mjs) {
|
||||
|
||||
uint16_t get_keycode_by_name(const char* key_name, size_t name_len) {
|
||||
if(name_len == 1) { // Single char
|
||||
return (HID_ASCII_TO_KEY(key_name[0]));
|
||||
return HID_ASCII_TO_KEY(key_name[0]);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < COUNT_OF(key_codes); i++) {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#include "furi_hal_random.h"
|
||||
#include <float.h>
|
||||
|
||||
#define JS_MATH_PI ((double)M_PI)
|
||||
#define JS_MATH_E ((double)M_E)
|
||||
#define JS_MATH_PI ((double)M_PI)
|
||||
#define JS_MATH_E ((double)M_E)
|
||||
#define JS_MATH_EPSILON ((double)DBL_EPSILON)
|
||||
|
||||
#define TAG "JsMath"
|
||||
|
||||
@@ -106,4 +106,4 @@ static const FlipperAppPluginDescriptor plugin_descriptor = {
|
||||
|
||||
const FlipperAppPluginDescriptor* js_notification_ep(void) {
|
||||
return &plugin_descriptor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include "../js_modules.h"
|
||||
#include <m-array.h>
|
||||
|
||||
#define TAG "js_serial"
|
||||
#define TAG "JsSerial"
|
||||
|
||||
#define RX_BUF_LEN 2048
|
||||
|
||||
typedef struct {
|
||||
@@ -444,14 +445,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) {
|
||||
|
||||
@@ -217,4 +217,4 @@ static const FlipperAppPluginDescriptor textbox_plugin_descriptor = {
|
||||
|
||||
const FlipperAppPluginDescriptor* js_textbox_ep(void) {
|
||||
return &textbox_plugin_descriptor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
* Resolver interface with private application's symbols.
|
||||
* Implementation is contained in app_api_table.c
|
||||
*/
|
||||
extern const ElfApiInterface* const application_api_interface;
|
||||
extern const ElfApiInterface* const application_api_interface;
|
||||
|
||||
@@ -15,4 +15,4 @@ uint32_t js_flags_wait(struct mjs* mjs, uint32_t flags, uint32_t timeout);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "../js_app_i.h"
|
||||
#include "console_font.h"
|
||||
|
||||
#define CONSOLE_LINES 8
|
||||
#define CONSOLE_CHAR_W 5
|
||||
#define CONSOLE_LINES 8
|
||||
#define CONSOLE_CHAR_W 5
|
||||
#define LINE_BREAKS_MAX 3
|
||||
#define LINE_LEN_MAX (128 / CONSOLE_CHAR_W)
|
||||
#define LINE_LEN_MAX (128 / CONSOLE_CHAR_W)
|
||||
|
||||
struct JsConsoleView {
|
||||
View* view;
|
||||
@@ -161,4 +161,4 @@ void console_view_free(JsConsoleView* console_view) {
|
||||
|
||||
View* console_view_get_view(JsConsoleView* console_view) {
|
||||
return console_view->view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ static bool storage_move_to_sd_check_entry(const char* name, FileInfo* fileinfo,
|
||||
return true;
|
||||
}
|
||||
|
||||
return (name && (*name != '.'));
|
||||
return name && (*name != '.');
|
||||
}
|
||||
|
||||
bool storage_move_to_sd_perform(void) {
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define UPDATE_DELAY_OPERATION_OK 10
|
||||
#define UPDATE_DELAY_OPERATION_OK 10
|
||||
#define UPDATE_DELAY_OPERATION_ERROR INT_MAX
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <storage/storage.h>
|
||||
#include <furi_hal.h>
|
||||
|
||||
#define UPDATE_TASK_NOERR 0
|
||||
#define UPDATE_TASK_NOERR 0
|
||||
#define UPDATE_TASK_FAILED -1
|
||||
|
||||
typedef struct UpdateTask {
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
|
||||
#define TAG "UpdWorkerRam"
|
||||
|
||||
#define STM_DFU_VENDOR_ID 0x0483
|
||||
#define STM_DFU_PRODUCT_ID 0xDF11
|
||||
#define STM_DFU_VENDOR_ID 0x0483
|
||||
#define STM_DFU_PRODUCT_ID 0xDF11
|
||||
/* Written into DFU file by build pipeline */
|
||||
#define FLIPPER_ZERO_DFU_DEVICE_CODE 0xFFFF
|
||||
/* Time, in ms, to wait for system restart by C2 before crashing */
|
||||
#define C2_MODE_SWITCH_TIMEOUT 10000
|
||||
#define C2_MODE_SWITCH_TIMEOUT 10000
|
||||
|
||||
static const DfuValidationParams flipper_dfu_params = {
|
||||
.device = FLIPPER_ZERO_DFU_DEVICE_CODE,
|
||||
@@ -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