[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:
hedger
2024-07-15 07:38:49 +03:00
committed by GitHub
parent a5e89315ae
commit ffa3996a5e
475 changed files with 3187 additions and 3159 deletions

View File

@@ -14,15 +14,15 @@
#define TAG "SubGhzProtocolBinRaw"
//change very carefully, RAM ends at the most inopportune moment
#define BIN_RAW_BUF_RAW_SIZE 2048
#define BIN_RAW_BUF_RAW_SIZE 2048
#define BIN_RAW_BUF_DATA_SIZE 512
#define BIN_RAW_THRESHOLD_RSSI -85.0f
#define BIN_RAW_DELTA_RSSI 7.0f
#define BIN_RAW_SEARCH_CLASSES 20
#define BIN_RAW_TE_MIN_COUNT 40
#define BIN_RAW_THRESHOLD_RSSI -85.0f
#define BIN_RAW_DELTA_RSSI 7.0f
#define BIN_RAW_SEARCH_CLASSES 20
#define BIN_RAW_TE_MIN_COUNT 40
#define BIN_RAW_BUF_MIN_DATA_COUNT 128
#define BIN_RAW_MAX_MARKUP_COUNT 20
#define BIN_RAW_MAX_MARKUP_COUNT 20
//#define BIN_RAW_DEBUG
@@ -131,7 +131,7 @@ static uint16_t subghz_protocol_bin_raw_get_full_byte(uint16_t bit_count) {
if(bit_count & 0x7) {
return (bit_count >> 3) + 1;
} else {
return (bit_count >> 3);
return bit_count >> 3;
}
}

View File

@@ -13,12 +13,13 @@
*/
#define TAG "SubGhzProtocolCame"
#define CAME_12_COUNT_BIT 12
#define CAME_24_COUNT_BIT 24
#define PRASTEL_COUNT_BIT 25
#define PRASTEL_NAME "Prastel"
#define CAME_12_COUNT_BIT 12
#define CAME_24_COUNT_BIT 24
#define PRASTEL_COUNT_BIT 25
#define PRASTEL_NAME "Prastel"
#define AIRFORCE_COUNT_BIT 18
#define AIRFORCE_NAME "Airforce"
#define AIRFORCE_NAME "Airforce"
static const SubGhzBlockConst subghz_protocol_came_const = {
.te_short = 320,
@@ -173,7 +174,7 @@ SubGhzProtocolStatus
if(ret != SubGhzProtocolStatusOk) {
break;
}
if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) {
if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) {
FURI_LOG_E(TAG, "Wrong number of bits in key");
ret = SubGhzProtocolStatusErrorValueBitCount;
break;
@@ -336,7 +337,7 @@ SubGhzProtocolStatus
if(ret != SubGhzProtocolStatusOk) {
break;
}
if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) {
if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) {
FURI_LOG_E(TAG, "Wrong number of bits in key");
ret = SubGhzProtocolStatusErrorValueBitCount;
break;

View File

@@ -9,8 +9,8 @@
#define TAG "SubGhzProtocolChambCode"
#define CHAMBERLAIN_CODE_BIT_STOP 0b0001
#define CHAMBERLAIN_CODE_BIT_1 0b0011
#define CHAMBERLAIN_CODE_BIT_0 0b0111
#define CHAMBERLAIN_CODE_BIT_1 0b0011
#define CHAMBERLAIN_CODE_BIT_0 0b0111
#define CHAMBERLAIN_7_CODE_MASK 0xF000000FF0F
#define CHAMBERLAIN_8_CODE_MASK 0xF00000F00F

View File

@@ -267,13 +267,12 @@ void subghz_protocol_decoder_clemsa_feed(void* context, bool level, uint32_t dur
} else if(
DURATION_DIFF(duration, subghz_protocol_clemsa_const.te_short * 51) <
subghz_protocol_clemsa_const.te_delta * 25) {
if((DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) <
subghz_protocol_clemsa_const.te_delta)) {
if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) <
subghz_protocol_clemsa_const.te_delta) {
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
} else if((DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) <
subghz_protocol_clemsa_const.te_delta * 3)) {
} else if(
DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) <
subghz_protocol_clemsa_const.te_delta * 3) {
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
} else {
instance->decoder.parser_step = ClemsaDecoderStepReset;

View File

@@ -219,8 +219,8 @@ void subghz_protocol_decoder_doitrand_feed(void* context, bool level, uint32_t d
}
break;
case DoitrandDecoderStepFoundStartBit:
if(level && ((DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) <
subghz_protocol_doitrand_const.te_delta * 3))) {
if(level && (DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) <
subghz_protocol_doitrand_const.te_delta * 3)) {
//Found start bit
instance->decoder.parser_step = DoitrandDecoderStepSaveDuration;
instance->decoder.decode_data = 0;

View File

@@ -212,8 +212,8 @@ void subghz_protocol_decoder_gate_tx_feed(void* context, bool level, uint32_t du
}
break;
case GateTXDecoderStepFoundStartBit:
if(level && ((DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) <
subghz_protocol_gate_tx_const.te_delta * 3))) {
if(level && (DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) <
subghz_protocol_gate_tx_const.te_delta * 3)) {
//Found start bit
instance->decoder.parser_step = GateTXDecoderStepSaveDuration;
instance->decoder.decode_data = 0;

View File

@@ -16,7 +16,7 @@
#define TAG "SubGhzProtocolHoltek"
#define HOLTEK_HEADER_MASK 0xF000000000
#define HOLTEK_HEADER 0x5000000000
#define HOLTEK_HEADER 0x5000000000
static const SubGhzBlockConst subghz_protocol_holtek_const = {
.te_short = 430,
@@ -358,7 +358,7 @@ void subghz_protocol_decoder_holtek_get_string(void* context, FuriString* output
if((instance->generic.btn & 0xF) == 0xE) {
furi_string_cat_printf(output, "ON\r\n");
} else if(((instance->generic.btn & 0xF) == 0xB)) {
} else if((instance->generic.btn & 0xF) == 0xB) {
furi_string_cat_printf(output, "OFF\r\n");
}
}

View File

@@ -473,7 +473,7 @@ static inline bool subghz_protocol_keeloq_check_decrypt_centurion(
uint8_t btn) {
furi_assert(instance);
if((decrypt >> 28 == btn) && (((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE))) {
if((decrypt >> 28 == btn) && ((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE)) {
instance->cnt = decrypt & 0x0000FFFF;
return true;
}
@@ -521,7 +521,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector(
// https://phreakerclub.com/forum/showpost.php?p=43557&postcount=37
man = subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key);
decrypt = subghz_protocol_keeloq_common_decrypt(hop, man);
if((strcmp(furi_string_get_cstr(manufacture_code->name), "Centurion") == 0)) {
if(strcmp(furi_string_get_cstr(manufacture_code->name), "Centurion") == 0) {
if(subghz_protocol_keeloq_check_decrypt_centurion(instance, decrypt, btn)) {
*manufacture_name = furi_string_get_cstr(manufacture_code->name);
return 1;

View File

@@ -16,11 +16,11 @@
* KeeLoq learning types
* https://phreakerclub.com/forum/showthread.php?t=67
*/
#define KEELOQ_LEARNING_UNKNOWN 0u
#define KEELOQ_LEARNING_SIMPLE 1u
#define KEELOQ_LEARNING_NORMAL 2u
#define KEELOQ_LEARNING_SECURE 3u
#define KEELOQ_LEARNING_MAGIC_XOR_TYPE_1 4u
#define KEELOQ_LEARNING_UNKNOWN 0u
#define KEELOQ_LEARNING_SIMPLE 1u
#define KEELOQ_LEARNING_NORMAL 2u
#define KEELOQ_LEARNING_SECURE 3u
#define KEELOQ_LEARNING_MAGIC_XOR_TYPE_1 4u
#define KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_1 5u
#define KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_2 6u
#define KEELOQ_LEARNING_MAGIC_SERIAL_TYPE_3 7u

View File

@@ -243,8 +243,8 @@ void subghz_protocol_decoder_linear_feed(void* context, bool level, uint32_t dur
if(duration >= (subghz_protocol_linear_const.te_short * 5)) {
instance->decoder.parser_step = LinearDecoderStepReset;
//checking that the duration matches the guardtime
if((DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) >
subghz_protocol_linear_const.te_delta * 20)) {
if(DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) >
subghz_protocol_linear_const.te_delta * 20) {
break;
}
if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_linear_const.te_short) <

View File

@@ -269,14 +269,14 @@ void subghz_protocol_decoder_mastercode_feed(void* context, bool level, uint32_t
} else if(
DURATION_DIFF(duration, subghz_protocol_mastercode_const.te_short * 15) <
subghz_protocol_mastercode_const.te_delta * 15) {
if((DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) <
subghz_protocol_mastercode_const.te_delta)) {
if(DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) <
subghz_protocol_mastercode_const.te_delta) {
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
} else if((DURATION_DIFF(
instance->decoder.te_last,
subghz_protocol_mastercode_const.te_long) <
subghz_protocol_mastercode_const.te_delta * 8)) {
} else if(
DURATION_DIFF(
instance->decoder.te_last, subghz_protocol_mastercode_const.te_long) <
subghz_protocol_mastercode_const.te_delta * 8) {
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
} else {
instance->decoder.parser_step = MastercodeDecoderStepReset;

View File

@@ -15,7 +15,7 @@
#define TAG "SubGhzProtocoNiceFlorS"
#define NICE_ONE_COUNT_BIT 72
#define NICE_ONE_NAME "Nice One"
#define NICE_ONE_NAME "Nice One"
static const SubGhzBlockConst subghz_protocol_nice_flor_s_const = {
.te_short = 500,

View File

@@ -215,8 +215,8 @@ void subghz_protocol_decoder_phoenix_v2_feed(void* context, bool level, uint32_t
}
break;
case Phoenix_V2DecoderStepFoundStartBit:
if(level && ((DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) <
subghz_protocol_phoenix_v2_const.te_delta * 4))) {
if(level && (DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) <
subghz_protocol_phoenix_v2_const.te_delta * 4)) {
//Found start bit
instance->decoder.parser_step = Phoenix_V2DecoderStepSaveDuration;
instance->decoder.decode_data = 0;

View File

@@ -8,7 +8,8 @@
#include "../blocks/math.h"
#define TAG "SubGhzProtocolPowerSmart"
#define POWER_SMART_PACKET_HEADER 0xFD000000AA000000
#define POWER_SMART_PACKET_HEADER 0xFD000000AA000000
#define POWER_SMART_PACKET_HEADER_MASK 0xFF000000FF000000
#define CHANNEL_PATTERN "%c%c%c%c%c%c"

View File

@@ -13,6 +13,7 @@
*/
#define TAG "SubGhzProtocolPrinceton"
#define PRINCETON_GUARD_TIME_DEFALUT 30 //GUARD_TIME = PRINCETON_GUARD_TIME_DEFALUT * TE
// Guard Time value should be between 15 -> 72 otherwise default value will be used

View File

@@ -9,6 +9,7 @@
#include <lib/toolbox/stream/stream.h>
#define TAG "SubGhzProtocolRaw"
#define SUBGHZ_DOWNLOAD_MAX_SIZE 512
static const SubGhzBlockConst subghz_protocol_raw_const = {

View File

@@ -14,16 +14,16 @@
#define TAG "SubGhzProtocoSecPlusV1"
#define SECPLUS_V1_BIT_ERR -1 //0b0000
#define SECPLUS_V1_BIT_0 0 //0b0001
#define SECPLUS_V1_BIT_1 1 //0b0011
#define SECPLUS_V1_BIT_2 2 //0b0111
#define SECPLUS_V1_BIT_0 0 //0b0001
#define SECPLUS_V1_BIT_1 1 //0b0011
#define SECPLUS_V1_BIT_2 2 //0b0111
#define SECPLUS_V1_PACKET_1_HEADER 0x00
#define SECPLUS_V1_PACKET_2_HEADER 0x02
#define SECPLUS_V1_PACKET_1_HEADER 0x00
#define SECPLUS_V1_PACKET_2_HEADER 0x02
#define SECPLUS_V1_PACKET_1_INDEX_BASE 0
#define SECPLUS_V1_PACKET_2_INDEX_BASE 21
#define SECPLUS_V1_PACKET_1_ACCEPTED (1 << 0)
#define SECPLUS_V1_PACKET_2_ACCEPTED (1 << 1)
#define SECPLUS_V1_PACKET_1_ACCEPTED (1 << 0)
#define SECPLUS_V1_PACKET_2_ACCEPTED (1 << 1)
static const SubGhzBlockConst subghz_protocol_secplus_v1_const = {
.te_short = 500,

View File

@@ -15,10 +15,10 @@
#define TAG "SubGhzProtocoSecPlusV2"
#define SECPLUS_V2_HEADER 0x3C0000000000
#define SECPLUS_V2_HEADER 0x3C0000000000
#define SECPLUS_V2_HEADER_MASK 0xFFFF3C0000000000
#define SECPLUS_V2_PACKET_1 0x000000000000
#define SECPLUS_V2_PACKET_2 0x010000000000
#define SECPLUS_V2_PACKET_1 0x000000000000
#define SECPLUS_V2_PACKET_2 0x010000000000
#define SECPLUS_V2_PACKET_MASK 0x30000000000
static const SubGhzBlockConst subghz_protocol_secplus_v2_const = {